Commit a944f914 authored by Daniel Wortmann's avatar Daniel Wortmann

Refactoring to make directory juDFT a standalone libraray

parent 73bbd502
...@@ -79,7 +79,8 @@ if (${FLEUR_USE_SERIAL}) ...@@ -79,7 +79,8 @@ if (${FLEUR_USE_SERIAL})
add_executable(fleur ${fleur_SRC} ${c_filesFleur}) add_executable(fleur ${fleur_SRC} ${c_filesFleur})
target_compile_definitions(fleur PUBLIC ${FLEUR_DEFINITIONS}) target_compile_definitions(fleur PUBLIC ${FLEUR_DEFINITIONS})
target_link_libraries(fleur ${FLEUR_LIBRARIES}) target_link_libraries(fleur ${FLEUR_LIBRARIES})
set_target_properties(fleur PROPERTIES Fortran_MODULE_DIRECTORY fleur_modules COMPILE_OPTIONS -Ifleur_modules) target_link_libraries(fleur juDFT)
set_target_properties(fleur PROPERTIES Fortran_MODULE_DIRECTORY fleur_modules COMPILE_OPTIONS "-IjuDFT_modules -Ifleur_modules")
#inpgen executable #inpgen executable
add_executable(inpgen ${inpgen_F77} ${inpgen_F90} ${juDFT_SRC_F90} ${c_filesInpgen}) add_executable(inpgen ${inpgen_F77} ${inpgen_F90} ${juDFT_SRC_F90} ${c_filesInpgen})
target_compile_definitions(inpgen PUBLIC ${FLEUR_DEFINITIONS}) target_compile_definitions(inpgen PUBLIC ${FLEUR_DEFINITIONS})
......
...@@ -32,5 +32,6 @@ io/writeOutParameters.f90 ...@@ -32,5 +32,6 @@ io/writeOutParameters.f90
io/xsf_io.f90 io/xsf_io.f90
io/xmlIntWrapFort.f90 io/xmlIntWrapFort.f90
io/xmlOutput.F90 io/xmlOutput.F90
io/iomatrix_hdf.F90
) )
This diff is collapsed.
set(fleur_F77 ${fleur_F77}
)
if (${FLEUR_USE_HDF5}) if (${FLEUR_USE_HDF5})
set(fleur_F90 ${fleur_F90} set(judft_HDF
juDFT/hdf_accessprp.F90 juDFT/hdf_accessprp.F90
juDFT/hdf_tools.F90 juDFT/hdf_tools.F90
juDFT/hdf_tools_attr.F90 juDFT/hdf_tools_attr.F90
...@@ -10,8 +8,12 @@ juDFT/hdf_tools_misc.F90 ...@@ -10,8 +8,12 @@ juDFT/hdf_tools_misc.F90
juDFT/hdf_tools_rw.F90 juDFT/hdf_tools_rw.F90
juDFT/hdf_tools_rw_var.F90 juDFT/hdf_tools_rw_var.F90
juDFT/hdf_tools_stride.F90) juDFT/hdf_tools_stride.F90)
else()
set(judft_HDF "")
endif() endif()
set(fleur_F90 ${fleur_F90}
add_library(juDFT STATIC
${judft_HDF}
juDFT/usage_data.F90 juDFT/usage_data.F90
juDFT/info.F90 juDFT/info.F90
juDFT/init.F90 juDFT/init.F90
...@@ -21,4 +23,9 @@ juDFT/string.f90 ...@@ -21,4 +23,9 @@ juDFT/string.f90
juDFT/time.F90 juDFT/time.F90
juDFT/args.F90 juDFT/args.F90
juDFT/sysinfo.F90 juDFT/sysinfo.F90
main/fleur_arguments.F90
juDFT/xmlOutput.F90
) )
target_compile_definitions(juDFT PUBLIC ${FLEUR_DEFINITIONS})
target_link_libraries(juDFT ${FLEUR_LIBRARIES})
set_target_properties(juDFT PROPERTIES Fortran_MODULE_DIRECTORY juDFT_modules COMPILE_OPTIONS -IjuDFT_modules)
...@@ -37,6 +37,8 @@ module m_hdf_accessprp ...@@ -37,6 +37,8 @@ module m_hdf_accessprp
character(len=128)::path character(len=128)::path
#ifdef CPP_HDFMPI #ifdef CPP_HDFMPI
INCLUDE 'mpif.h' INCLUDE 'mpif.h'
LOGICAL :: l_mpi
CALL MPI_INITALIZED(l_mpi,ierr)
#endif #endif
IF (.not.present(setupfile)) THEN IF (.not.present(setupfile)) THEN
...@@ -61,7 +63,11 @@ module m_hdf_accessprp ...@@ -61,7 +63,11 @@ module m_hdf_accessprp
readloop:DO readloop:DO
filename="default" filename="default"
#ifdef CPP_HDFMPI #ifdef CPP_HDFMPI
driver="mpiio" IF (l_mpi) THEN
driver="mpiio"
ELSE
driver='default'
ENDIF
#else #else
driver="default" driver="default"
#endif #endif
...@@ -96,6 +102,7 @@ module m_hdf_accessprp ...@@ -96,6 +102,7 @@ module m_hdf_accessprp
cycle readloop cycle readloop
ENDIF ENDIF
#ifdef CPP_HDFMPI #ifdef CPP_HDFMPI
IF (l_mpi) THEN
CALL MPI_BARRIER(MPI_COMM_WORLD,hdferr) CALL MPI_BARRIER(MPI_COMM_WORLD,hdferr)
IF (index(driver,"mpiio")==1) THEN IF (index(driver,"mpiio")==1) THEN
!create info object !create info object
...@@ -122,6 +129,7 @@ module m_hdf_accessprp ...@@ -122,6 +129,7 @@ module m_hdf_accessprp
if (alignment>0) CALL h5pset_alignment_f(access_prp(n), INT(0,hsize_t),alignment, hdferr) if (alignment>0) CALL h5pset_alignment_f(access_prp(n), INT(0,hsize_t),alignment, hdferr)
cycle readloop cycle readloop
ENDIF ENDIF
ENDIF
#endif #endif
write(0,*) "Driver name unkown:",driver write(0,*) "Driver name unkown:",driver
call judft_error("Unkown driver",calledby="gf_io2dmat") call judft_error("Unkown driver",calledby="gf_io2dmat")
......
...@@ -301,8 +301,14 @@ ...@@ -301,8 +301,14 @@
#ifdef CPP_HDFMPI #ifdef CPP_HDFMPI
INCLUDE 'mpif.h' INCLUDE 'mpif.h'
INTEGER::hdferr INTEGER::hdferr
CALL h5pcreate_f(H5P_DATASET_XFER_F, trans, hdferr) LOGICAL::l_mpi
CALL h5pset_dxpl_mpio_f(trans,H5FD_MPIO_INDEPENDENT_F,hdferr) CALL MPI_INITIALIZED(l_mpi,hdferr)
IF (l_mpi) THEN
CALL h5pcreate_f(H5P_DATASET_XFER_F, trans, hdferr)
CALL h5pset_dxpl_mpio_f(trans,H5FD_MPIO_INDEPENDENT_F,hdferr)
ELSE
trans=H5P_DEFAULT_f
ENDIF
#else #else
trans=H5P_DEFAULT_f trans=H5P_DEFAULT_f
#endif #endif
...@@ -352,8 +358,12 @@ ...@@ -352,8 +358,12 @@
#ifdef CPP_HDFMPI #ifdef CPP_HDFMPI
include 'mpif.h' include 'mpif.h'
INTEGER :: irank,nerr INTEGER :: irank,nerr
CALL MPI_COMM_rank(MPI_COMM_WORLD,irank,nerr) LOGICAL :: l_mpi
WRITE(pe,"(i4,a)") irank,":" CALL MPI_INITIALIZED(l_mpi,nerr)
IF (l_mpi) THEN
CALL MPI_COMM_rank(MPI_COMM_WORLD,irank,nerr)
WRITE(pe,"(i4,a)") irank,":"
ENDIF
#endif #endif
n = 500 n = 500
IF (err>=0) RETURN IF (err>=0) RETURN
......
...@@ -18,8 +18,8 @@ contains ...@@ -18,8 +18,8 @@ contains
integer:: irank=0,ierr integer:: irank=0,ierr
#ifdef CPP_MPI #ifdef CPP_MPI
include 'mpif.h' include 'mpif.h'
logical:: l_mpi=.true. LOGICAL:: l_mpi
CALL mpi_initialized(l_mpi,ierr)
CALL MPI_COMM_RANK(MPI_COMM_WORLD,irank,ierr) CALL MPI_COMM_RANK(MPI_COMM_WORLD,irank,ierr)
#else #else
logical :: l_mpi=.false. logical :: l_mpi=.false.
......
...@@ -47,9 +47,14 @@ ...@@ -47,9 +47,14 @@
#ifdef CPP_MPI #ifdef CPP_MPI
include "mpif.h" include "mpif.h"
INTEGER:: irank,ierr INTEGER:: irank,ierr
LOGICAL:: mpi_init
CALL MPI_COMM_RANK (MPI_COMM_WORLD,irank,ierr) CALL MPI_initialized(mpi_init,ierr)
WRITE(0,*) "Signal ",signal," detected on PE:",irank IF (mpi_init) THEN
CALL MPI_COMM_RANK (MPI_COMM_WORLD,irank,ierr)
WRITE(0,*) "Signal ",signal," detected on PE:",irank
ELSE
WRITE(0,*) "Signal detected:",signal
END IF
#else #else
WRITE(0,*) "Signal detected:",signal WRITE(0,*) "Signal detected:",signal
#endif #endif
...@@ -62,7 +67,7 @@ ...@@ -62,7 +67,7 @@
CALL writetimes() CALL writetimes()
CALL PRINT_memory_info(0,.true.) CALL PRINT_memory_info(0,.true.)
#ifdef CPP_MPI #ifdef CPP_MPI
CALL MPI_ABORT(MPI_COMM_WORLD,ierr) IF (mpi_init) CALL MPI_ABORT(MPI_COMM_WORLD,ierr)
#endif #endif
STOP "Signal" STOP "Signal"
intel_signal_handler=0 intel_signal_handler=0
......
...@@ -50,7 +50,7 @@ CONTAINS ...@@ -50,7 +50,7 @@ CONTAINS
SUBROUTINE juDFT_error(message,calledby,hint,no,warning,file,line) SUBROUTINE juDFT_error(message,calledby,hint,no,warning,file,line)
USE m_judft_usage USE m_judft_usage
USE m_xmloutput USE m_judft_xmloutput
IMPLICIT NONE IMPLICIT NONE
CHARACTER*(*),INTENT(IN) :: message CHARACTER*(*),INTENT(IN) :: message
CHARACTER*(*),OPTIONAL,INTENT(IN) :: calledby,hint CHARACTER*(*),OPTIONAL,INTENT(IN) :: calledby,hint
...@@ -60,13 +60,21 @@ CONTAINS ...@@ -60,13 +60,21 @@ CONTAINS
INTEGER,INTENT(IN),OPTIONAL :: line INTEGER,INTENT(IN),OPTIONAL :: line
LOGICAL :: callstop,warn,first_pe LOGICAL :: callstop,warn,first_pe
LOGICAL :: l_mpi=.FALSE.
INTEGER :: isize,irank,e,i INTEGER :: isize,irank,e,i
CHARACTER(len=100),ALLOCATABLE::message_list(:) CHARACTER(len=100),ALLOCATABLE::message_list(:)
#ifdef CPP_MPI #ifdef CPP_MPI
include 'mpif.h' include 'mpif.h'
LOGICAL :: first_parallel LOGICAL :: first_parallel
CALL MPI_COMM_RANK(MPI_COMM_WORLD,irank,e) CALL MPI_INITALIZED(l_mpi,e)
CALL MPI_COMM_SIZE(MPI_COMM_WORLD,isize,e) IF (l_mpi) THEN
CALL MPI_COMM_RANK(MPI_COMM_WORLD,irank,e)
CALL MPI_COMM_SIZE(MPI_COMM_WORLD,isize,e)
ELSE
first_pe=.TRUE.
isize=1
irank=0
ENDIF
#else #else
first_pe=.TRUE. first_pe=.TRUE.
isize=1 isize=1
...@@ -87,7 +95,7 @@ CONTAINS ...@@ -87,7 +95,7 @@ CONTAINS
ENDIF ENDIF
#ifdef CPP_MPI #ifdef CPP_MPI
CALL collect_messages(message,message_list,first_pe) if (l_mpi) CALL collect_messages(message,message_list,first_pe)
#endif #endif
IF (first_pe) THEN IF (first_pe) THEN
...@@ -114,18 +122,20 @@ CONTAINS ...@@ -114,18 +122,20 @@ CONTAINS
ENDIF ENDIF
ENDIF ENDIF
#ifdef CPP_MPI #ifdef CPP_MPI
WRITE(0,'(a,i0,a,i0)') "Error from PE:",irank,"/",isize IF (l_mpi) THEN
first_parallel=.TRUE. WRITE(0,'(a,i0,a,i0)') "Error from PE:",irank,"/",isize
DO i=0,isize-1 first_parallel=.TRUE.
IF (i==irank) CYCLE DO i=0,isize-1
IF (LEN_TRIM(message_list(i))>1)THEN IF (i==irank) CYCLE
IF (first_parallel) THEN IF (LEN_TRIM(message_list(i))>1)THEN
WRITE(0,'(2a)') "Other PEs with error messages:" IF (first_parallel) THEN
first_parallel=.FALSE. WRITE(0,'(2a)') "Other PEs with error messages:"
first_parallel=.FALSE.
END IF
WRITE(0,'(a,i4,2a)') " ",i,"-",message_list(i)
END IF END IF
WRITE(0,'(a,i4,2a)') " ",i,"-",message_list(i) END DO
END IF END IF
END DO
#endif #endif
WRITE(0,'(2a)') "*****************************************" WRITE(0,'(2a)') "*****************************************"
...@@ -174,18 +184,20 @@ CONTAINS ...@@ -174,18 +184,20 @@ CONTAINS
SUBROUTINE juDFT_END(message, irank, l_endXML) SUBROUTINE juDFT_END(message, irank, l_endXML)
! If irank is present every mpi process has to call this routine. ! If irank is present every mpi process has to call this routine.
! Otherwise only a single mpi process is allowed to call the routine. ! Otherwise only a single mpi process is allowed to call the routine.
USE m_xmlOutput USE m_judft_xmlOutput
USE m_judft_usage USE m_judft_usage
IMPLICIT NONE IMPLICIT NONE
#ifdef CPP_MPI
INCLUDE 'mpif.h'
INTEGER :: ierr
#endif
CHARACTER*(*), INTENT(IN) :: message CHARACTER*(*), INTENT(IN) :: message
INTEGER, OPTIONAL, INTENT(IN) :: irank INTEGER, OPTIONAL, INTENT(IN) :: irank
LOGICAL, OPTIONAL, INTENT(IN) :: l_endXML LOGICAL, OPTIONAL, INTENT(IN) :: l_endXML
LOGICAL l_endXML_local LOGICAL l_endXML_local
LOGICAL :: l_mpi=.false.
#ifdef CPP_MPI
INCLUDE 'mpif.h'
INTEGER :: ierr
CALL MPI_INITALIZED(l_mpi,ierr)
#endif
l_endXML_local = .TRUE. l_endXML_local = .TRUE.
IF(PRESENT(l_endXML)) THEN IF(PRESENT(l_endXML)) THEN
...@@ -211,13 +223,15 @@ CONTAINS ...@@ -211,13 +223,15 @@ CONTAINS
CALL print_memory_info(0,.true.) CALL print_memory_info(0,.true.)
CALL send_usage_data() CALL send_usage_data()
#ifdef CPP_MPI #ifdef CPP_MPI
IF(PRESENT(irank)) THEN IF (l_mpi) THEN
write (*,*) "Going into post send barrier" IF(PRESENT(irank)) THEN
CALL MPI_BARRIER(MPI_COMM_WORLD,ierr) WRITE (*,*) "Going into post send barrier"
CALL MPI_FINALIZE(ierr) CALL MPI_BARRIER(MPI_COMM_WORLD,ierr)
ELSE CALL MPI_FINALIZE(ierr)
CALL juDFT_STOP(0) ELSE
END IF CALL juDFT_STOP(0)
END IF
ENDIF
#endif #endif
STOP 'OK' STOP 'OK'
END SUBROUTINE juDFT_END END SUBROUTINE juDFT_END
...@@ -227,16 +241,16 @@ CONTAINS ...@@ -227,16 +241,16 @@ CONTAINS
SUBROUTINE juDFT_stop(errorCode) SUBROUTINE juDFT_stop(errorCode)
#ifdef __INTEL_COMPILER #ifdef __INTEL_COMPILER
USE ifcore USE ifcore
#endif
#ifdef CPP_MPI
INCLUDE 'mpif.h'
#endif #endif
INTEGER, OPTIONAL, INTENT(IN) :: errorCode INTEGER, OPTIONAL, INTENT(IN) :: errorCode
INTEGER :: error INTEGER :: error
LOGICAL :: calltrace LOGICAL :: calltrace
LOGICAL,ALLOCATABLE::a(:) LOGICAL,ALLOCATABLE::a(:)
LOGICAL :: l_mpi=.FALSE.
#ifdef CPP_MPI #ifdef CPP_MPI
INTEGER :: ierr INTEGER :: ierr
INCLUDE 'mpif.h'
CALL mpi_initialized(l_mpi,ierr)
#endif #endif
error = 0 error = 0
...@@ -258,14 +272,16 @@ CONTAINS ...@@ -258,14 +272,16 @@ CONTAINS
ENDIF ENDIF
#if defined(CPP_MPI) #if defined(CPP_MPI)
IF(error.EQ.0) THEN IF (l_mpi) THEN
WRITE(0,*) "" IF(error.EQ.0) THEN
WRITE(0,*) "Terminating all MPI processes." WRITE(0,*) ""
WRITE(0,*) "Note: This is a normal procedure." WRITE(0,*) "Terminating all MPI processes."
WRITE(0,*) " Error messages in the following lines can be ignored." WRITE(0,*) "Note: This is a normal procedure."
WRITE(0,*) "" WRITE(0,*) " Error messages in the following lines can be ignored."
END IF WRITE(0,*) ""
CALL MPI_ABORT(MPI_COMM_WORLD,error,ierr) END IF
CALL MPI_ABORT(MPI_COMM_WORLD,error,ierr)
ENDIF
#endif #endif
STOP 'juDFT-STOPPED' STOP 'juDFT-STOPPED'
END SUBROUTINE juDFT_stop END SUBROUTINE juDFT_stop
......
...@@ -23,9 +23,15 @@ CONTAINS ...@@ -23,9 +23,15 @@ CONTAINS
LOGICAL,INTENT(IN),OPTIONAL :: maxmem LOGICAL,INTENT(IN),OPTIONAL :: maxmem
CHARACTER(LEN=1024):: line CHARACTER(LEN=1024):: line
INTEGER :: err,irank INTEGER :: err,irank
LOGICAL :: l_mpi=.FALSE.
#ifdef CPP_MPI #ifdef CPP_MPI
INCLUDE 'mpif.h' INCLUDE 'mpif.h'
CALL MPI_COMM_RANK(MPI_COMM_WORLD,irank,err) CALL mpi_initialized(l_mpi,err)
IF (l_mpi) THEN
CALL MPI_COMM_RANK(MPI_COMM_WORLD,irank,err)
ELSE
irank=0
ENDIF
#else #else
irank=0 irank=0
#endif #endif
...@@ -80,7 +86,7 @@ CONTAINS ...@@ -80,7 +86,7 @@ CONTAINS
SUBROUTINE checkstack() SUBROUTINE checkstack()
CHARACTER(LEN=10):: l1,l2,l3,l4 CHARACTER(LEN=10):: l1,l2,l3,l4
INTEGER :: err INTEGER :: err
LOGICAL :: unlimited LOGICAL :: unlimited,l_mpi
#ifdef CPP_MPI #ifdef CPP_MPI
include 'mpif.h' include 'mpif.h'
INTEGER:: ierr,irank INTEGER:: ierr,irank
...@@ -97,7 +103,9 @@ CONTAINS ...@@ -97,7 +103,9 @@ CONTAINS
ENDDO ENDDO
999 CLOSE(99,IOSTAT=err) 999 CLOSE(99,IOSTAT=err)
#ifdef CPP_MPI #ifdef CPP_MPI
CALL MPI_COMM_RANK(MPI_COMM_WORLD,irank,ierr) CALL mpi_initialized(l_mpi,ierr)
irank=0
if (l_mpi) CALL MPI_COMM_RANK(MPI_COMM_WORLD,irank,ierr)
IF (irank.NE.0) THEN IF (irank.NE.0) THEN
IF (.NOT.unlimited) WRITE(*,*)"Warning, stacksize limited at PE:",irank IF (.NOT.unlimited) WRITE(*,*)"Warning, stacksize limited at PE:",irank
RETURN RETURN
......
...@@ -12,7 +12,7 @@ MODULE m_juDFT_time ...@@ -12,7 +12,7 @@ MODULE m_juDFT_time
! called with suitable names for timers ! called with suitable names for timers
! Daniel Wortmann, Fri Sep 6 11:53:08 2002 ! Daniel Wortmann, Fri Sep 6 11:53:08 2002
!***************************************************************** !*****************************************************************
USE m_xmlOutput USE m_judft_xmlOutput
IMPLICIT NONE IMPLICIT NONE
! List of different timers ! List of different timers
PRIVATE PRIVATE
...@@ -95,10 +95,6 @@ CONTAINS ...@@ -95,10 +95,6 @@ CONTAINS
INTEGER, INTENT(IN), OPTIONAL :: line INTEGER, INTENT(IN), OPTIONAL :: line
INTEGER::n INTEGER::n
#ifdef CPP_MPI
INTEGER::irank, ierr
INCLUDE 'mpif.h'
#endif
IF (PRESENT(file)) lastfile = file IF (PRESENT(file)) lastfile = file
IF (PRESENT(line)) lastline = line IF (PRESENT(line)) lastline = line
IF (.NOT. ASSOCIATED(current_timer)) THEN IF (.NOT. ASSOCIATED(current_timer)) THEN
...@@ -158,13 +154,19 @@ CONTAINS ...@@ -158,13 +154,19 @@ CONTAINS
CHARACTER(LEN=*), INTENT(IN):: startstop, name CHARACTER(LEN=*), INTENT(IN):: startstop, name
#ifdef CPP_MPI #ifdef CPP_MPI
INTEGER::irank, ierr INTEGER::irank, ierr
LOGICAL:: l_mpi
INCLUDE 'mpif.h' INCLUDE 'mpif.h'
#endif #endif
IF (.NOT. l_debug) RETURN IF (.NOT. l_debug) RETURN
if (debugtimestart < 0) debugtimestart = cputime() if (debugtimestart < 0) debugtimestart = cputime()
#ifdef CPP_MPI #ifdef CPP_MPI
CALL MPI_COMM_RANK(MPI_COMM_WORLD, irank, ierr) CALL MPI_INITALIZED(l_mpi,ierr)
WRITE (*, "(i3,3a,f20.2,5x,a)") irank, startstop, name, " at:", cputime() - debugtimestart, memory_usage_string() IF (l_mpi) THEN
CALL MPI_COMM_RANK(MPI_COMM_WORLD, irank, ierr)
WRITE (*, "(i3,3a,f20.2,5x,a)") irank, startstop, name, " at:", cputime() - debugtimestart, memory_usage_string()
ELSE
WRITE (*, "(3a,f20.2,5x,a)") startstop, name, " at:", cputime() - debugtimestart, memory_usage_string()
ENDIF
#else #else
WRITE (*, "(3a,f20.2,5x,a)") startstop, name, " at:", cputime() - debugtimestart, memory_usage_string() WRITE (*, "(3a,f20.2,5x,a)") startstop, name, " at:", cputime() - debugtimestart, memory_usage_string()
#endif #endif
...@@ -353,9 +355,10 @@ CONTAINS ...@@ -353,9 +355,10 @@ CONTAINS
CHARACTER(len=:), allocatable :: json_str CHARACTER(len=:), allocatable :: json_str
#ifdef CPP_MPI #ifdef CPP_MPI
INCLUDE "mpif.h" INCLUDE "mpif.h"
INTEGER::err, isize INTEGER::err,isize
LOGICAL:: l_mpi
CALL MPI_COMM_RANK(MPI_COMM_WORLD, irank, err) CALL mpi_initialized(l_mpi,err)
if (l_mpi) CALL MPI_COMM_RANK(MPI_COMM_WORLD, irank, err)
#endif #endif
IF (.NOT. ASSOCIATED(globaltimer)) RETURN !write nothing if no timing recorded IF (.NOT. ASSOCIATED(globaltimer)) RETURN !write nothing if no timing recorded
l_out = .FALSE. l_out = .FALSE.
...@@ -376,8 +379,10 @@ CONTAINS ...@@ -376,8 +379,10 @@ CONTAINS
WRITE (fn, "('Total execution time: ',i0,'sec, minimal timing printed:',i0,'sec')") & WRITE (fn, "('Total execution time: ',i0,'sec, minimal timing printed:',i0,'sec')") &
INT(globaltimer%time), INT(min_time*globaltimer%time) INT(globaltimer%time), INT(min_time*globaltimer%time)
#ifdef CPP_MPI #ifdef CPP_MPI
CALL MPI_COMM_SIZE(MPI_COMM_WORLD, isize, err) IF (l_mpi) THEN
WRITE (fn, *) "Program used ", isize, " PE" CALL MPI_COMM_SIZE(MPI_COMM_WORLD, isize, err)
WRITE (fn, *) "Program used ", isize, " PE"
ENDIF
#endif #endif
CALL priv_writetimes(globaltimer, 1, fn) CALL priv_writetimes(globaltimer, 1, fn)
...@@ -410,8 +415,9 @@ CONTAINS ...@@ -410,8 +415,9 @@ CONTAINS
#ifdef CPP_MPI #ifdef CPP_MPI
INCLUDE "mpif.h" INCLUDE "mpif.h"
INTEGER::err, isize INTEGER::err, isize
LOGICAL:: l_mpi
CALL MPI_COMM_RANK(MPI_COMM_WORLD, irank, err) CALL mpi_initialized(l_mpi,err)
IF (l_mpi) CALL MPI_COMM_RANK(MPI_COMM_WORLD, irank, err)
#endif #endif
IF (irank .NE. 0) RETURN IF (irank .NE. 0) RETURN
...@@ -486,7 +492,9 @@ CONTAINS ...@@ -486,7 +492,9 @@ CONTAINS
#ifdef CPP_MPI #ifdef CPP_MPI
INCLUDE "mpif.h" INCLUDE "mpif.h"
INTEGER::err, isize INTEGER::err, isize
CALL MPI_COMM_RANK(MPI_COMM_WORLD, irank, err) LOGICAL:: l_mpi
CALL mpi_initialized(l_mpi,err)
if (l_mpi) CALL MPI_COMM_RANK(MPI_COMM_WORLD, irank, err)
#endif #endif
IF (.NOT. l_cont) RETURN !stop anyway IF (.NOT. l_cont) RETURN !stop anyway
...@@ -519,8 +527,9 @@ CONTAINS ...@@ -519,8 +527,9 @@ CONTAINS
#ifdef CPP_MPI #ifdef CPP_MPI
INCLUDE "mpif.h" INCLUDE "mpif.h"
INTEGER::err, isize INTEGER::err, isize
LOGICAL:: l_mpi
CALL MPI_COMM_RANK(MPI_COMM_WORLD, irank, err) CALL mpi_initialized(l_mpi,err)
if (l_mpi) CALL MPI_COMM_RANK(MPI_COMM_WORLD, irank, err)
#endif #endif
!Check if not enough time for another iteration is left !Check if not enough time for another iteration is left
......
...@@ -88,9 +88,12 @@ CONTAINS ...@@ -88,9 +88,12 @@ CONTAINS
INTEGER(8) :: r