MCPcopy Create free account
hub / github.com/modelscope/modelscope / make_tmp_dir

Function make_tmp_dir

modelscope/utils/torch_utils.py:203–216  ·  view source on GitHub ↗

Make sure each rank has the same temporary directory on the distributed mode.

()

Source from the content-addressed store, hash-verified

201
202
203def make_tmp_dir():
204 """Make sure each rank has the same temporary directory on the distributed mode.
205 """
206 if not is_dist():
207 return tempfile.mkdtemp()
208
209 tmpdir = None
210 if is_master():
211 tmpdir = tempfile.mkdtemp()
212
213 dist.barrier()
214 tmpdir = broadcast(tmpdir, 0)
215
216 return tmpdir
217
218
219def broadcast(inputs, src):

Callers 2

multi_gpu_testFunction · 0.90
collect_results_cpuFunction · 0.90

Calls 3

is_distFunction · 0.85
is_masterFunction · 0.85
broadcastFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…