The powdermodel example script is somewhat complicated due to the fact that a main function needs to be defined for it to work on windows and MacOS.
|
def main(): |
|
""" |
|
dummy main function to enable multiprocessing on Windows and macOS. |
|
This is required to avoid starting of the multiprocessing code upon import |
|
of the script and is connected with the used multiprocessing start method. |
|
|
|
See also: |
|
https://docs.python.org/3/library/multiprocessing.html#the-spawn-and-forkserver-start-methods |
|
""" |
There could be a workaround which would not require this for any platform and would make using PowderModel for users of these platforms much easier.
https://stackoverflow.com/questions/79397519/a-solution-to-multiprocessing-in-python-without-the-if-name-main-gu
Its however currently unclear to me how/if this is directly applicable for the multiprocessing code in powder.py.
The powdermodel example script is somewhat complicated due to the fact that a main function needs to be defined for it to work on windows and MacOS.
xrayutilities/examples/simpack_powdermodel.py
Lines 28 to 36 in 4ff4dc8
There could be a workaround which would not require this for any platform and would make using PowderModel for users of these platforms much easier.
https://stackoverflow.com/questions/79397519/a-solution-to-multiprocessing-in-python-without-the-if-name-main-gu
Its however currently unclear to me how/if this is directly applicable for the multiprocessing code in
powder.py.