MCPcopy
hub / github.com/modelscope/ms-swift / _find_free_gpu

Method _find_free_gpu

scripts/benchmark/exp_utils.py:226–234  ·  view source on GitHub ↗
(self, n)

Source from the content-addressed store, hash-verified

224 }
225
226 def _find_free_gpu(self, n):
227 all_gpus = set()
228 for exp in self.exps:
229 all_gpus.update(exp.runtime.get('gpu', set()))
230 all_gpus = {int(g) for g in all_gpus}
231 free_gpu = set(range(get_device_count())) - all_gpus
232 if len(free_gpu) < n:
233 return None
234 return list(free_gpu)[:n]
235
236 def prepare_experiments(self, args: Any):
237 experiments = []

Callers 2

_build_eval_cmdMethod · 0.95
_build_cmdMethod · 0.95

Calls 2

get_device_countFunction · 0.90
updateMethod · 0.45

Tested by

no test coverage detected