SunnySuite / Sunny.jl

Spin dynamics and generalization to SU(N) coherent states
Other
86 stars 19 forks source link

Add ParallelTempering #4

Closed mswwilson closed 2 years ago

mswwilson commented 2 years ago

This needs to be tuned and set up for simulations, but the basic implementation is there.

kbarros commented 2 years ago

This looks unobtrusive to me, but the only concern I have is about adding more using statements to the main Sunny.jl package if they are only applicable to certain use cases. In this case, I'm not sure all users want or need MPI.jl. We had a similar problem with GLMakie. Matt, what about a loader for the ParallelTempering module that does @eval using MPI at run time? Let's discuss.

ColeMiles commented 2 years ago

Could you add an example which uses the parallelization / multiple processes? I can't quite figure out how this is intended to be run in the parallel case.

We should also think about how to unify measurements across the single CPU "regular" Sunny code and structs like WangLandau and the Parallel Tempering which constructs ensembles of systems. It seems like we shouldn't have every struct re-implement internal code which does measurements, and we also need some way for users to be able to make custom measurements without changing the internal code of these types' methods.

This seems hard enough that we should probably have a meeting about it.

kbarros commented 2 years ago

There are several design decision to be made -- I agree we should have a meeting.

mswwilson commented 2 years ago

I'm fine with changing where / how MPI is loaded. The file "PT_afm_heiseberg.jl" should be a working example, although the code is more of a skeleton that doesn't make any measurements yet, but simply collects a histogram on each process, performs replica exchanges, and prints the number of accepted exchanges. I run it from the command line like this: "mpiexec -n \<nprocs> julia --project PT_afm_heisenberg.jl".

ColeMiles commented 2 years ago

Oh I see -- I should have read the comment you provided at the top of the script :laughing:. Thanks.

kbarros commented 2 years ago

What are the next steps? I'd like to get these pull requests merged quickly, and Matt can refine later. I guess the main thing is to check whether the using MPI statement will be a problem for ordinary users, and if we can instead @eval using MPI at run time ?

kbarros commented 2 years ago

I think this should be good to merge now.