Skip to content

Commit

Permalink
add exception for mpicomm evaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
Deathn0t committed Mar 29, 2024
1 parent e3bdd21 commit 2609c91
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions deephyper/evaluator/_mpi_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ def __init__(
self.num_workers = self.comm.Get_size() - 1 # 1 rank is the master
self.sem = asyncio.Semaphore(self.num_workers)
logging.info(f"Creating MPICommExecutor with {self.num_workers} max_workers...")

if self.num_workers == 0 and self.comm.Get_size() <= 1:
raise RuntimeError(
"No workers was detected because there was only 1 MPI rank. The number of MPI ranks must be greater than 1."
)

self.executor = MPICommExecutor(comm=self.comm, root=self.root)
self.master_executor = None
logging.info("Creation of MPICommExecutor done")
Expand Down

0 comments on commit 2609c91

Please sign in to comment.