Skip to content

Commit d7e0703

Browse files
committed
Also support max_workers for wp.load_module()
1 parent c468864 commit d7e0703

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

warp/_src/context.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7000,6 +7000,7 @@ def load_module(
70007000
device: Device | str | list[Device] | list[str] | None = None,
70017001
recursive: bool = False,
70027002
block_dim: int | None = None,
7003+
max_workers: int | None = None,
70037004
):
70047005
"""Force a user-defined module to be compiled and loaded.
70057006
@@ -7026,6 +7027,8 @@ def load_module(
70267027
``warp.render``, this will also load ``warp.render.utils`` and
70277028
``warp.render.opengl``.
70287029
block_dim: The number of threads per block (always 1 for ``"cpu"`` devices).
7030+
max_workers: The maximum number of parallel threads to use for loading modules. ``0`` means serial loading.
7031+
If ``None``, ```warp.config.parallel_module_load`` determines the default behavior.
70297032
70307033
Raises:
70317034
RuntimeError: If the specified module does not contain any Warp kernels, functions,
@@ -7069,7 +7072,7 @@ def load_module(
70697072
"or has not been imported yet."
70707073
)
70717074

7072-
force_load(device=device, modules=modules, block_dim=block_dim)
7075+
force_load(device=device, modules=modules, block_dim=block_dim, max_workers=max_workers)
70737076

70747077

70757078
def _resolve_module(module: Module | types.ModuleType | str) -> Module:

0 commit comments

Comments
 (0)