MCPcopy Create free account
hub / github.com/InternScience/SciReason / get_command_template

Function get_command_template

opencompass/runners/local.py:24–36  ·  view source on GitHub ↗

Format command template given available gpu ids.

(gpu_ids: List[int])

Source from the content-addressed store, hash-verified

22
23
24def get_command_template(gpu_ids: List[int]) -> str:
25 """Format command template given available gpu ids."""
26 if is_npu_available():
27 tmpl = 'ASCEND_RT_VISIBLE_DEVICES=' + ','.join(str(i) for i in gpu_ids)
28 tmpl += ' {task_cmd}'
29 elif sys.platform == 'win32': # Always return win32 for Windows
30 # use command in Windows format
31 tmpl = 'set CUDA_VISIBLE_DEVICES=' + ','.join(str(i) for i in gpu_ids)
32 tmpl += ' & {task_cmd}'
33 else:
34 tmpl = 'CUDA_VISIBLE_DEVICES=' + ','.join(str(i) for i in gpu_ids)
35 tmpl += ' {task_cmd}'
36 return tmpl
37
38
39@RUNNERS.register_module()

Callers 2

launchMethod · 0.85
_launchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected