Skip to content

Updating for libEnsemble v0.9.2

Stephen Hudson edited this page Jul 14, 2022 · 1 revision

Note to macOS users

If you are running on macOS, you may find that with libEnsemble v0.9.2+ you get an error that includes the following lines:

    This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:

         if __name__ == '__main__':
            freeze_support()

Why am I seeing this?

When using local (multiprocessing) comms, macOS uses the spawn start method by default. We used to switich the start method to fork on macoS - we no longer do this because libEnsemble now works with spawn and:

  • We could be overriding user settings.
  • Some libraries require spawn (such as pytorch) and this swtich could harm compatibility.

How to fix?

  1. Put the code in your calling script (excluding import lines) inside a if __name__ == "__main__": block (our regression tests demonstrate this).

  2. Alternatively, switch to fork. Add these lines to your calling script:

    from multiprocessing import set_start_method
    set_start_method("fork", force=True)
    

Note that Windows always uses spawn.