wannier-developers / wannier90

Official repository of the Wannier90 code
http://www.wannier.org
GNU General Public License v2.0
238 stars 140 forks source link

Segfault when using write_xyz from parallel mode #303

Closed greschd closed 4 years ago

greschd commented 4 years ago

Wannier90 version: 3.0.0

When trying to run Wannier90 with write_xyz : true enabled in parallel execution, I get a segfault. Compiling with debug flags, the following error is printed:

with ifort (PSXE version 2019.3.199):

Image              PC                Routine            Line        Source
wannier90.x        000000000089AD96  Unknown               Unknown  Unknown
wannier90.x        0000000000652102  w90_wannierise_mp         633  wannierise.F90
wannier90.x        0000000000406053  MAIN__                    227  wannier_prog.F90
wannier90.x        0000000000404182  Unknown               Unknown  Unknown
libc-2.27.so       00007F4E0AA66B97  __libc_start_main     Unknown  Unknown
wannier90.x        000000000040406A  Unknown               Unknown  Unknown
forrtl: severe (408): fort: (8): Attempt to fetch from allocatable variable ATOMS_SPECIES_NUM when it is not allocated

with gfortran (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)), mpirun (Open MPI) 2.1.1:

Fortran runtime error: Index '1' of dimension 1 of array 'atoms_species_num' above upper bound of 0

Error termination. Backtrace:
At line 2326 of file ../wannierise.F90
Fortran runtime error: Index '1' of dimension 1 of array 'atoms_species_num' above upper bound of 0

Error termination. Backtrace:
At line 2326 of file ../wannierise.F90
Fortran runtime error: Index '1' of dimension 1 of array 'atoms_species_num' above upper bound of 0

Error termination. Backtrace:
#0  0x7fa9a6ccb2da in ???
#1  0x7fa9a6ccbec5 in ???
#2  0x7fa9a6ccc297 in ???
#0  0x7f626a2cb2da in ???
#1  0x7f626a2cbec5 in ???
#2  0x7f626a2cc297 in ???
#0  0x7f03fc4cb2da in ???
#1  0x7f03fc4cbec5 in ???
#2  0x7f03fc4cc297 in ???
#3  0x7fa9a82a414c in wann_write_xyz
        at ../wannierise.F90:2326
#4  0x7fa9a82cef8b in __w90_wannierise_MOD_wann_main
        at ../wannierise.F90:691
#5  0x7fa9a8203594 in wannier
        at ../wannier_prog.F90:227
#6  0x7fa9a8204cc9 in main
        at ../wannier_prog.F90:58
#3  0x7f03fdca414c in wann_write_xyz
        at ../wannierise.F90:2326
#4  0x7f03fdccef8b in __w90_wannierise_MOD_wann_main
        at ../wannierise.F90:691
#5  0x7f03fdc03594 in wannier
        at ../wannier_prog.F90:227
#6  0x7f03fdc04cc9 in main
        at ../wannier_prog.F90:58
#3  0x7f626b8a414c in wann_write_xyz
        at ../wannierise.F90:2326
#4  0x7f626b8cef8b in __w90_wannierise_MOD_wann_main
        at ../wannierise.F90:691
#5  0x7f626b803594 in wannier
        at ../wannier_prog.F90:227
#6  0x7f626b804cc9 in main
        at ../wannier_prog.F90:58

The easiest way I've found of reproducing the issue is by adding write_xyz : true to example01/gaas.win (tested also for example07, but that needs additional modification to allow parallel mode). The issue does not occur when running in serial mode.

greschd commented 4 years ago

Ah, this is a duplicate of #260, and fixed in the latest develop.