Skip to content

Commit

Permalink
Merge pull request #279 from asappresearch/parallel-single-machine-je…
Browse files Browse the repository at this point in the history
…remyasapp

Allow parallel runs on the same machine with multiple GPUs
  • Loading branch information
jeremyasapp committed Mar 26, 2020
2 parents 9fbe572 + 635ad91 commit 150a4a2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions flambe/experiment/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,12 @@ def run(self, force: bool = False, verbose: bool = False, debug: bool = False, *

# By default use all CPUs if no GPU is present
devices = self.devices if self.devices else None
if devices is None and utils.local_has_gpu():
devices = {"cpu": 4, "gpu": 1}
if devices is None:
cluster_devices = ray.cluster_resources()
if 'GPU' in cluster_devices or 'gpu' in cluster_devices:
devices = {"cpu": 4, "gpu": 1}
else:
devices = {"cpu": 1}

to_resume = None
if isinstance(self.resume, str):
Expand Down Expand Up @@ -594,7 +598,6 @@ def setup(self, cluster: Cluster, extensions: Dict[str, str], force: bool, **kwa
)

self.set_serializable_attr("resources", new_resources)
self.set_serializable_attr("devices", cluster.get_max_resources())
self.set_serializable_attr(
"save_path", f"{cluster.orchestrator.get_home_path()}/{self.name}")

Expand Down

0 comments on commit 150a4a2

Please sign in to comment.