mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-30 04:50:16 +08:00
max num threads as config parameter
This commit is contained in:
1 parent
5f85ef181d
commit
d1350e1ecf
1 file changed
+4
-1
@@ -72,6 +72,9 @@ class ParallelDataManagerConfig(DataManagerConfig):
|
|||||||
queue_size: int = 2
|
queue_size: int = 2
|
||||||
"""Size of shared data queue containing generated ray bundles and batches.
|
"""Size of shared data queue containing generated ray bundles and batches.
|
||||||
If queue_size <= 0, the queue size is infinite."""
|
If queue_size <= 0, the queue size is infinite."""
|
||||||
|
max_thread_workers: Optional[int] = 1
|
||||||
|
"""Maximum number of threads to use in thread pool executor. If None, automatically
|
||||||
|
set to harware cpu_count + 4."""
|
||||||
|
|
||||||
|
|
||||||
class DataProc(mp.Process):
|
class DataProc(mp.Process):
|
||||||
@@ -176,7 +179,7 @@ class ParallelDataManager(DataManager, Generic[TDataset]):
|
|||||||
proc.start()
|
proc.start()
|
||||||
super().__init__()
|
super().__init__()
|
||||||
# Prime the executor with the first batch
|
# Prime the executor with the first batch
|
||||||
self.executor = concurrent.futures.ThreadPoolExecutor(max_workers=1)
|
self.executor = concurrent.futures.ThreadPoolExecutor(max_workers=self.config.max_thread_workers)
|
||||||
self.batch_fut = self.executor.submit(self.data_q.get)
|
self.batch_fut = self.executor.submit(self.data_q.get)
|
||||||
|
|
||||||
def create_train_dataset(self) -> TDataset:
|
def create_train_dataset(self) -> TDataset:
|
||||||
|
|||||||
Reference in new issue
Block a user