Skip to content

Alternative Python multiprocessing implementation#2

Open
jzavatoneveth wants to merge 4 commits into
yale-phys-382L:masterfrom
jzavatoneveth:multiprocessing
Open

Alternative Python multiprocessing implementation#2
jzavatoneveth wants to merge 4 commits into
yale-phys-382L:masterfrom
jzavatoneveth:multiprocessing

Conversation

@jzavatoneveth

Copy link
Copy Markdown

Here is a possible alternate implementation of the multiprocessing code that should not drop temperature steps. It has the distinct disadvantage of storing all the data from each run in main memory before writing it to disk once all temperatures are finished. However, I think that there may be some advantages to using multiprocessing.Pool.map with a partial()-frozen version of the simulation function in terms of code readability, performance, and stability (i.e. not dropping temperatures). I think it should be possible to add the real-time saving back to this variant. If I recall correctly, using the logging module may be the most stable way to do so.

In addition, the temperature list is now constructed with an admittedly more verbose pure Python expression rather than numpy.arange, but should not have the floating point round-off issues that arange exhibits (From https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html: "When using a non-integer step, such as 0.1, the results will often not be consistent. It is better to use linspace for these cases.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant