The idea of the code is to open a file in parallel and then each
core reads different part of that big file. ir_start and ir_stop are therefore different for each core.
I have the following code (part of a much bigger code):
DO iq = 1, nqf
IF (MOD(iq,100) == 0) THEN
WRITE(stdout, '(a,i10,a,i10)' ) ' Progression iq (fine) = ',iq,'/',nqf
ENDIF
CALL MPI_FILE_OPEN (world_comm,filint,MPI_MODE_RDONLY,MPI_INFO_NULL,iunepmatwp2,ierr)
IF( ierr /= 0 ) CALL errore( 'xxxx', 'error in MPI_FILE_OPEN',1 )
DO ir = ir_start, ir_stop
CALL MPI_FILE_SEEK(iunepmatwp2,lrepmatw,MPI_SEEK_SET,ierr)
CALL MPI_FILE_READ(iunepmatwp2, aux, lrepmatw2, MPI_DOUBLE_PRECISION, MPI_STATUS_IGNORE,ierr)
loops:
eptmp ( ibnd, jbnd, ip, imode ) = aux (i)
endloops
CALL mp_sum(eptmp, world_comm)
ENDDO
something is then done with eptmp
ENDDO
The problem that the code systematically crash at:
...
Progression iq (fine) = 32000/ 50000
Progression iq (fine) = 32100/ 50000
Progression iq (fine) = 32200/ 50000
Progression iq (fine) = 32300/ 50000
Progression iq (fine) = 32400/ 50000
Progression iq (fine) = 32500/ 50000
Progression iq (fine) = 32600/ 50000
error in MPI_FILE_OPEN
It look to me (I might be totally wrong) that there might be too many communicators open.
The problem is that I cannot do something like CALL MPI_Comm_free(world_comm) in the q-loop because it kills the code.
Is there a way for each core to use the same world_comm without creating new one?