janniklasrose / diffusion-models

Analytical and random walk models of diffusion in permeable layered media
MIT License
0 stars 2 forks source link

Parallelise random walk #3

Open ignasiialemany opened 3 years ago

ignasiialemany commented 3 years ago

The code is optimised to run in serial, but if a large number of walkers and/or time steps is used the runtime can be a limiting factor. Splitting walkers between cores/threads allows for faster overall execution but requires refactoring of the code.

janniklasrose commented 3 years ago

Added support for random number streams in #4. I suggest adding a ParallelMonteCarlo class that wraps around/extends/replaces the existing MonteCarlo class with the methods overridden to handle parallelisation

janniklasrose commented 3 years ago

The only caveat would be that results are not reproducible between runs with different numbers of threads, but I don't see a way around that without major refactoring anyway.