fast-aircraft-design / FAST-OAD

FAST-OAD: An open source framework for rapid Overall Aircraft Design
GNU General Public License v3.0
53 stars 26 forks source link

FAST-OAD not working in MPI environment #441

Closed christophe-david closed 2 years ago

christophe-david commented 2 years ago

Describe the bug Most FAST-OAD operations do not work in an environment with multiprocessing capabilities

To Reproduce In a terminal, with a compatible MPI library installed:

pip install mpi4py  # if not already installed
fastoad gen_conf foo.yml
fastoad gen_inputs foo.yml

Error message

Traceback (most recent call last):
  File "[...]/.cache/pypoetry/virtualenvs/fast-oad-core-e8KXACVB-py3.7/bin/fastoad", line 5, in <module>
    fast_oad()
  File "[...]/lib/python3.7/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "[...]/lib/python3.7/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "[...]/lib/python3.7/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "[...]/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "[...]/lib/python3.7/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "[...]/FAST-OAD/src/fastoad/cmd/cli.py", line 125, in gen_inputs
    overwrite=force,
  File "[...]/FAST-OAD/src/fastoad/cmd/cli_utils.py", line 67, in manage_overwrite
    written = _run_func(func, filename_func, **kwargs)
  File "[...]/FAST-OAD/src/fastoad/cmd/cli_utils.py", line 80, in _run_func
    result = func(**kwargs)
  File "[...]/FAST-OAD/src/fastoad/cmd/api.py", line 231, in generate_inputs
    conf.write_needed_inputs(source_path)
  File "[...]/FAST-OAD/src/fastoad/io/configuration/configuration.py", line 214, in write_needed_inputs
    problem.setup()
  File "[...]/FAST-OAD/src/fastoad/openmdao/problem.py", line 76, in setup
    problem_copy = deepcopy(self)
  File "/opt/tools/python-3.7.4-intel-19/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/opt/tools/python-3.7.4-intel-19/lib/python3.7/copy.py", line 280, in _reconstruct
    state = deepcopy(state, memo)
  File "/opt/tools/python-3.7.4-intel-19/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/opt/tools/python-3.7.4-intel-19/lib/python3.7/copy.py", line 240, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/opt/tools/python-3.7.4-intel-19/lib/python3.7/copy.py", line 169, in deepcopy
    rv = reductor(4)
TypeError: can't pickle mpi4py.MPI.Intracomm objects

Environment