Quentin Tiefaine
Quentin Tiefaine

Reputation: 83

OpenMDAO SimpleGADriver Run Parallel

Have some of you succeeded to run the OpenMDAO SimpleGADriver with the run parallel mod enabled?

When I am trying to run their example from the official website (https://openmdao.org/newdocs/versions/latest/features/building_blocks/drivers/genetic_algorithm.html#running-a-ga-in-parallel), it fails every time and returns me this error:

Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 24, in <module>
  File "C:\Users\z004cn5y\.virtualenvs\python-flask-server-generated\lib\site-packages\openmdao\utils\hooks.py", line 130, in execute_hooks
    ret = f(*args, **kwargs)
  File "C:\Users\z004cn5y\.virtualenvs\python-flask-server-generated\lib\site-packages\openmdao\core\problem.py", line 856, in run_driver
    return self.driver.run()
  File "C:\Users\z004cn5y\.virtualenvs\python-flask-server-generated\lib\site-packages\openmdao\drivers\genetic_algorithm_driver.py", line 385, in run
    desvar_new, obj, self._nfit = ga.execute_ga(x0, lower_bound, upper_bound, outer_bound,
  File "C:\Users\z004cn5y\.virtualenvs\python-flask-server-generated\lib\site-packages\openmdao\drivers\genetic_algorithm_driver.py", line 716, in execute_ga
    x_pop = comm.bcast(x_pop, root=0)
AttributeError: 'FakeComm' object has no attribute 'bcast'

Has someone ever faced and solved this issue ?

Many thanks in advance

Upvotes: 1

Views: 136

Answers (1)

John Jasa
John Jasa

Reputation: 192

It looks like instead of the script using a proper MPI installation, it's using the FakeComm, which is a dummy class used if mpi4py is not installed. You should be able to pip install mpi4py and then run that example in parallel.

Upvotes: 0

Related Questions