Skip to content

Commit 2fe5d52

Browse files
committed
Compile and load modules on parallel threads
1 parent 22e8c24 commit 2fe5d52

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

warp/_src/context.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import types
3333
import weakref
3434
from collections.abc import Iterable, Mapping, Sequence
35+
from concurrent.futures import ThreadPoolExecutor
3536
from copy import copy as shallowcopy
3637
from pathlib import Path
3738
from typing import (
@@ -6963,8 +6964,9 @@ def force_load(
69636964
modules = user_modules.values()
69646965

69656966
for d in devices:
6966-
for m in modules:
6967-
m.load(d, block_dim=block_dim)
6967+
with ThreadPoolExecutor() as executor:
6968+
for m in modules:
6969+
executor.submit(m.load, d, block_dim=block_dim)
69686970

69696971
if is_cuda_available():
69706972
# restore original context to avoid side effects

0 commit comments

Comments
 (0)