DISABLE_MULTIPROCESSING flags

This commit is contained in:
Dun Liang 2021-06-22 17:01:50 +08:00
parent 66c3ab8c5a
commit 1acf6492f4
3 changed files with 13 additions and 1 deletions

View File

@ -9,7 +9,7 @@
# file 'LICENSE.txt', which is part of this source code package.
# ***************************************************************
__version__ = '1.2.3.36'
__version__ = '1.2.3.37'
from jittor_utils import lock
with lock.lock_scope():
ori_int = int

View File

@ -72,6 +72,8 @@ class Dataset(object):
stop_grad = True,
keep_numpy_array = False):
super().__init__()
if os.environ.get("DISABLE_MULTIPROCESSING", '0') == '1':
num_workers = 0
self.total_len = None
self.batch_size = batch_size
self.shuffle = shuffle

View File

@ -193,6 +193,16 @@ def run_cmds(cmds, cache_path, jittor_path, msg="run_cmds"):
finally:
mp.current_process()._config['daemon'] = bk
if os.environ.get("DISABLE_MULTIPROCESSING", '0') == '1':
os.environ["use_parallel_op_compiler"] = '1'
def run_cmds(cmds, cache_path, jittor_path, msg="run_cmds"):
cmds = [ [cmd, cache_path, jittor_path] for cmd in cmds ]
n = len(cmds)
dp = DelayProgress(msg, n)
for i,cmd in enumerate(cmds):
dp.update(i)
do_compile(cmd)
def download(url, filename):
if os.path.isfile(filename):