GregDMeyer / dynamite

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

Multiple realizations of disordered Hamiltonians #27

Closed sen31123 closed 1 year ago

sen31123 commented 1 year ago

Dear Greg,

Thank you very much for this fantastic package!

May I ask a question about simulating the evolution with disordered Hamiltonian? I can think of two ways, one is to insert the random seed according to the rank of the the mpi processes, so difficult mpi processes return us results from different disorder realization; the other is to use all mpi processes to evolve the system with the same random seed, then repeat the computation with a different random seed.

Could you please kindly comment on which way is better in dynamite? Or there are other good strategies?

Thank you.

Best regards, Sen

yx14 commented 1 year ago

Hi Sen,

Dynamite is set up to use all mpi processes with the same random seed. If you want to set different seeds, for example, you could submit a job array to a cluster.

Best, Julia

On Mon, Nov 14, 2022 at 7:02 AM sen31123 @.***> wrote:

Dear Greg,

Thank you very much for this fantastic package!

May I ask a question about simulating the evolution with disordered Hamiltonian? I can think of two ways, one is to insert the random seed according to the rank of the the mpi processes, so difficult mpi processes return us results from different disorder realization; the other is to use all mpi processes to evolve the system with the same random seed, then repeat the computation with a different random seed.

Could you please kindly comment on which way is better in dynamite? Or there are other good strategies?

Thank you.

Best regards, Sen

— Reply to this email directly, view it on GitHub https://github.com/GregDMeyer/dynamite/issues/27, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWYBQC54BMEZ5TW6V7MPK3WIIS4LANCNFSM6AAAAAAR7X5G6U . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sen31123 commented 1 year ago

Hi Julia,

Thank you very much for your reply. May I just check with you that the Hamiltonian (or any operator) objects are eventually determined by rank 0 process when performing any subsequent computation, though other rank \neq 0 with different random seeds could have constructed Hamiltonian with different parameters prior actual computations?

Thank you. Cheers, Sen

yx14 commented 1 year ago

Hi Sen,

During the actual computation (such as an eigsolve), dynamite will throw an error if the hamiltonian is inconsistent across MPI ranks. I think setting the seed (more info here https://numpy.org/doc/stable/reference/random/generator.html) for all ranks before creating the hamiltonian is probably the best strategy.

Best, Julia

On Thu, Nov 17, 2022 at 9:47 AM Sen @.***> wrote:

Hi Julia,

Thank you very much for your reply. May I just check with you that the Hamiltonian (or any operator) objects are eventually determined by rank 0 process when performing any subsequent computation, though other rank \neq 0 with different random seeds could have constructed Hamiltonian with different parameters prior actual computations?

Thank you. Cheers, Sen

— Reply to this email directly, view it on GitHub https://github.com/GregDMeyer/dynamite/issues/27#issuecomment-1318746606, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWYBQEB4NGYFW6ZKP7QZVTWIZAQHANCNFSM6AAAAAAR7X5G6U . You are receiving this because you commented.Message ID: @.***>

sen31123 commented 1 year ago

Hi Julia,

Thank you! I understand it now, though dynamite doesn't report errors when I explicitly set different seeds for different ranks. I will just set the same seed across all ranks manually.

Cheers, Sen

GregDMeyer commented 1 year ago

Hi Sen (and Julia!). Happy holidays!

Just wanted to add one comment---the check that ensures a Hamiltonian is the same across all ranks is currently in the development branch of dynamite, so that's why you weren't seeing it when you were running with a different seed on each rank. It will be included in the next release (which will probably be quite soon). Thanks for reaching out!

Cheers, Greg