GregDMeyer / dynamite

Fast quantum evolution and eigensolving using Krylov subspace methods via the PETSc/SLEPc libraries.
MIT License
33 stars 6 forks source link

Multiprocessing #14

Closed mielrecio closed 2 years ago

mielrecio commented 2 years ago

Hello, we managed to install dynamite and we are very impressed how fast and optimized is. I have got a very stupid question that you may know the answer. Is dynamite capable of multiprocessing calculations? We can of course run it with mpirun but what we would like to do is to use several cores for a single task like computing time evolution for a certain time. In other words, we know how to run the code in parallel so that, for instance, we assign a core to each point of time evolution. However, we would like to assign several cores to each point of time. We have tried to combine the standard multiprocessing package with dynamite but we have not been successful. Many thanks, Antonio

GregDMeyer commented 2 years ago

Hi @mielrecio ! I am glad to hear you are finding the package useful :-)

Yes, this is one of the core features of dynamite. When you run it under mpirun, it will not run the same calculation separately on each process---they will use MPI to communicate and share the computation among them. So to compute one time evolution using 10 parallel processes (for example), you can simply do mpirun -n 10 python your_script.py.

If you are printing output in your script, you may want to look at mpi_print in dynamite.tools (see documentation here) to only print from process 0, so you don't get output from every single process.

Let me know if this did not answer your question!

mielrecio commented 2 years ago

Thanks! Sure, it answered my question. I was testing mpirun and I got confused with the printing output. Antonio