[gpaw-users] parallel IO

Ask Hjorth Larsen asklarsen at gmail.com
Fri Aug 2 15:46:36 CEST 2019


Dear Geng,

Am So., 21. Juli 2019 um 19:16 Uhr schrieb GENG SUN via gpaw-users
<gpaw-users at listserv.fysik.dtu.dk>:
>
>  Dear GPAW users,
>
> I would like to do some preprocessing before running parallel GPAW calculations.
> The idea is to rewrite a "history.traj" into a list of separate "input%d.traj" files if "history.traj" is found in the current folder. Here is the script (test.py):
>
> from ase.io import read, write
> import sys
> import os
> from ase.parallel import rank,size,world,parprint
> from gpaw import GPAW
>
> checkpoint = "history.traj"
>
> images = None
>
> if os.path.isfile(checkpoint) and os.path.getsize(checkpoint) > 0:
>     images = read(checkpoint, index="::1", format="traj")
>
> world.barrier()
>
> if rank == 0:
>     if images is not None:
>         for index in range(1000):
>             fn = "input%d.traj" % index
>             if index < len(images):
>                 write(fn, images[index])
>             elif os.path.isfile(fn):
>                 os.remove(fn)
> world.barrier()
>
>
> My understanding is that after this script is executed, I can find a list of files "input%d.traj" with the length of the checkpoint.
>
> While when I run the script by mpirun -np 32 gpaw-python test.py, it never finishes.
>
> Then I  tested different numbers of processors. The script only runs successfully with 2 processors and failed to finish with more than 2 processors.
>
> Does anyone see any problem in this script?

The trajectory format has some subtle dependency on the world
communicator.  Hence write() must be done on all processes.  I will
open an issue so we can fix this at some point, but meanwhile you'll
have to call write() on all the processes.

Best regards
Ask

>
> Thank you very much. Any suggestions and help is greatly appreciated.
>
> Best Wishes,
>
> Geng
>
>
>
> _______________________________________________
> gpaw-users mailing list
> gpaw-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users


More information about the gpaw-users mailing list