[Pw_forum] Writing output files in parallel
Lorenzo Paulatto
paulatto at sissa.it
Fri Sep 5 10:25:32 CEST 2008
On Gio, Settembre 4, 2008 15:55, jtmullen at ncsu.edu wrote:
> Can
> someone point me to the relevant code in v4.0.1 which writes the
> wavefunction information to the "prefix.wfc*" file?
Dear Jeff,
it may be easier than you think: most code is executed by all processors,
so you only need to create a unique filename for each processor.
It can be done using the global variables mpime (absolute processor index)
or me_image and my_image_id (processor index within an image and index of
the image); all of them are in module mp_global.
The QE approach is to create a different directory for each image. Images
are used only for NEB calculations and similar stuff, so I will ignore
them from here on.
The following is a code example that should work:
USE mp_global, ONLY : me_image, my_image_id, nimage
USE io_files, ONLY : tmp_dir, prefix, iunmystuff !<- you should add it
USE io_global, ONLY : ionode
CHARACTER(len=256) :: filename, basename
basename = tmp_dir // '/' // prefix // '_' // "my_stuff" // '.'
IF (nimage>1) STOP 1
IF(ionode) WRITE(stdout, '(5x,a)') "I'm going to write my stuff..."
WRITE(filename, '(a,I5.5)' ) basename, me_image
OPEN(filename, unit=iunmystuff ...)
...
If you really want to see how it is done in pw, you'll find it in
PW/pw_restart.f90 and Modules/xml_io_base.f90, but that part of code is a
bit difficult to read, as it takes in account many different cases.
regards
--
Lorenzo Paulatto
SISSA & DEMOCRITOS (Trieste)
phone: +39 040 3787 511
skype: paulatz
www: http://people.sissa.it/~paulatto/
----------------------------------------------------------------
SISSA Webmail https://webmail.sissa.it/
Powered by SquirrelMail http://www.squirrelmail.org/
More information about the Pw_forum
mailing list