diff --git a/CMakeLists.txt b/CMakeLists.txt index 84aeb2e3f..3bbc353f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ option(debug "Compile with debug flags" OFF) option(optimize "Turn on all compiler optimization flags" OFF) option(verbose "Create verbose Makefiles" OFF) option(coverage "Compile with coverage analysis flags" OFF) +option(mpif08 "Use Fortran 2008 MPI interface" OFF) if (verbose) set(CMAKE_VERBOSE_MAKEFILE on) @@ -55,6 +56,12 @@ elseif($ENV{FC} MATCHES "h5pfc$") set(HDF5_ENABLED TRUE) endif() +# Check for Fortran 2008 MPI interface +if(MPI_ENABLED AND mpif08) + message("-- Using Fortran 2008 MPI bindings") + add_definitions(-DMPIF08) +endif() + #=============================================================================== # Set compile/link flags based on which compiler is being used #=============================================================================== diff --git a/src/cmfd_execute.F90 b/src/cmfd_execute.F90 index b967385b3..e620c1be3 100644 --- a/src/cmfd_execute.F90 +++ b/src/cmfd_execute.F90 @@ -95,7 +95,7 @@ contains #ifdef MPI use global, only: mpi_err - use mpi + use message_passing #endif integer :: nx ! maximum number of cells in x direction @@ -224,7 +224,7 @@ contains #ifdef MPI use global, only: mpi_err - use mpi + use message_passing #endif logical, intent(in) :: new_weights ! calcualte new weights diff --git a/src/eigenvalue.F90 b/src/eigenvalue.F90 index 1fe609e47..aefb597d0 100644 --- a/src/eigenvalue.F90 +++ b/src/eigenvalue.F90 @@ -1,7 +1,7 @@ module eigenvalue #ifdef MPI - use mpi + use message_passing #endif use cmfd_execute, only: cmfd_init_batch, execute_cmfd @@ -293,7 +293,11 @@ contains #ifdef MPI integer(8) :: n ! number of sites to send/recv integer :: neighbor ! processor to send/recv data from +#ifdef MPIF08 + type(MPI_Request) :: request(20) +#else integer :: request(20) ! communication request for send/recving sites +#endif integer :: n_request ! number of communication requests integer(8) :: index_local ! index in local source bank integer(8), save, allocatable :: & diff --git a/src/error.F90 b/src/error.F90 index 77f663108..ecd7eb453 100644 --- a/src/error.F90 +++ b/src/error.F90 @@ -6,7 +6,7 @@ module error use global #ifdef MPI - use mpi + use message_passing #endif implicit none @@ -155,7 +155,7 @@ contains #ifdef NO_F2008 stop #else - error stop + error stop #endif end subroutine fatal_error diff --git a/src/finalize.F90 b/src/finalize.F90 index e52f4c862..aa11f4769 100644 --- a/src/finalize.F90 +++ b/src/finalize.F90 @@ -6,7 +6,7 @@ module finalize use tally, only: tally_statistics #ifdef MPI - use mpi + use message_passing #endif #ifdef HDF5 diff --git a/src/fixed_source.F90 b/src/fixed_source.F90 index 7db6d58fa..9e2d34600 100644 --- a/src/fixed_source.F90 +++ b/src/fixed_source.F90 @@ -1,7 +1,7 @@ module fixed_source #ifdef MPI - use mpi + use message_passing #endif use constants, only: ZERO, MAX_LINE_LEN diff --git a/src/global.F90 b/src/global.F90 index b12cd5d12..f7d9f184e 100644 --- a/src/global.F90 +++ b/src/global.F90 @@ -19,6 +19,9 @@ module global #ifdef HDF5 use hdf5_interface, only: HID_T #endif +#ifdef MPIF08 + use mpi_f08 +#endif implicit none save @@ -225,8 +228,13 @@ module global logical :: master = .true. ! master process? logical :: mpi_enabled = .false. ! is MPI in use and initialized? integer :: mpi_err ! MPI error code +#ifdef MPIF08 + type(MPI_Datatype) :: MPI_BANK + type(MPI_Datatype) :: MPI_TALLYRESULT +#else integer :: MPI_BANK ! MPI datatype for fission bank integer :: MPI_TALLYRESULT ! MPI datatype for TallyResult +#endif #ifdef _OPENMP integer :: n_threads = NONE ! number of OpenMP threads diff --git a/src/hdf5_interface.F90 b/src/hdf5_interface.F90 index 2252c3e76..c3e5b44ba 100644 --- a/src/hdf5_interface.F90 +++ b/src/hdf5_interface.F90 @@ -7,7 +7,7 @@ module hdf5_interface use, intrinsic :: ISO_C_BINDING #ifdef MPI - use mpi, only: MPI_COMM_WORLD, MPI_INFO_NULL + use message_passing, only: MPI_COMM_WORLD, MPI_INFO_NULL #endif implicit none @@ -149,7 +149,12 @@ contains ! Setup file access property list with parallel I/O access call h5pcreate_f(H5P_FILE_ACCESS_F, plist, hdf5_err) +#ifdef MPIF08 + call h5pset_fapl_mpio_f(plist, MPI_COMM_WORLD%MPI_VAL, & + MPI_INFO_NULL%MPI_VAL, hdf5_err) +#else call h5pset_fapl_mpio_f(plist, MPI_COMM_WORLD, MPI_INFO_NULL, hdf5_err) +#endif ! Create the file collectively call h5fcreate_f(trim(filename), H5F_ACC_TRUNC_F, file_id, hdf5_err, & @@ -174,7 +179,12 @@ contains ! Setup file access property list with parallel I/O access call h5pcreate_f(H5P_FILE_ACCESS_F, plist, hdf5_err) +#ifdef MPIF08 + call h5pset_fapl_mpio_f(plist, MPI_COMM_WORLD%MPI_VAL, & + MPI_INFO_NULL%MPI_VAL, hdf5_err) +#else call h5pset_fapl_mpio_f(plist, MPI_COMM_WORLD, MPI_INFO_NULL, hdf5_err) +#endif ! Determine access type open_mode = H5F_ACC_RDONLY_F diff --git a/src/initialize.F90 b/src/initialize.F90 index 518a285a4..99a66e2ce 100644 --- a/src/initialize.F90 +++ b/src/initialize.F90 @@ -27,7 +27,7 @@ module initialize use tally_initialize, only: configure_tallies #ifdef MPI - use mpi + use message_passing #endif #ifdef _OPENMP @@ -195,11 +195,17 @@ contains subroutine initialize_mpi() integer :: bank_blocks(4) ! Count for each datatype +#ifdef MPIF08 + type(MPI_Datatype) :: bank_types(4) + type(MPI_Datatype) :: result_types(1) + type(MPI_Datatype) :: temp_type +#else integer :: bank_types(4) ! Datatypes - integer(MPI_ADDRESS_KIND) :: bank_disp(4) ! Displacements - integer :: temp_type ! temporary derived type - integer :: result_blocks(1) ! Count for each datatype integer :: result_types(1) ! Datatypes + integer :: temp_type ! temporary derived type +#endif + integer(MPI_ADDRESS_KIND) :: bank_disp(4) ! Displacements + integer :: result_blocks(1) ! Count for each datatype integer(MPI_ADDRESS_KIND) :: result_disp(1) ! Displacements integer(MPI_ADDRESS_KIND) :: result_base_disp ! Base displacement integer(MPI_ADDRESS_KIND) :: lower_bound ! Lower bound for TallyResult diff --git a/src/mesh.F90 b/src/mesh.F90 index 491b3407f..b9d85f439 100644 --- a/src/mesh.F90 +++ b/src/mesh.F90 @@ -7,7 +7,7 @@ module mesh use search, only: binary_search #ifdef MPI - use mpi + use message_passing #endif implicit none diff --git a/src/message_passing.F90 b/src/message_passing.F90 new file mode 100644 index 000000000..75d0bd301 --- /dev/null +++ b/src/message_passing.F90 @@ -0,0 +1,11 @@ +module message_passing + +#ifdef MPI +#ifdef MPIF08 + use mpi_f08 +#else + use mpi +#endif +#endif + +end module message_passing diff --git a/src/mpiio_interface.F90 b/src/mpiio_interface.F90 index 30093adec..cae01a68e 100644 --- a/src/mpiio_interface.F90 +++ b/src/mpiio_interface.F90 @@ -1,10 +1,17 @@ module mpiio_interface #ifdef MPI - use mpi +#ifndef HDF5 + use message_passing implicit none +#ifdef MPIF08 +#define FH_TYPE type(MPI_File) +#else +#define FH_TYPE integer +#endif + integer :: mpiio_err ! MPI error code ! Generic HDF5 write procedure interface @@ -48,11 +55,11 @@ contains subroutine mpi_create_file(filename, fh) character(*), intent(in) :: filename ! name of file to create - integer, intent(inout) :: fh ! file handle + FH_TYPE, intent(inout) :: fh ! file handle ! Create the file call MPI_FILE_OPEN(MPI_COMM_WORLD, filename, MPI_MODE_CREATE + & - MPI_MODE_WRONLY, MPI_INFO_NULL, fh, mpiio_err) + MPI_MODE_WRONLY, MPI_INFO_NULL, fh, mpiio_err) end subroutine mpi_create_file @@ -64,7 +71,7 @@ contains character(*), intent(in) :: filename ! name of file to open character(*), intent(in) :: mode ! open 'r' read, 'w' write - integer, intent(inout) :: fh ! file handle + FH_TYPE, intent(inout) :: fh ! file handle integer :: open_mode @@ -76,7 +83,7 @@ contains ! Create the file call MPI_FILE_OPEN(MPI_COMM_WORLD, filename, & - open_mode, MPI_INFO_NULL, fh, mpiio_err) + open_mode, MPI_INFO_NULL, fh, mpiio_err) end subroutine mpi_open_file @@ -86,7 +93,7 @@ contains subroutine mpi_close_file(fh) - integer, intent(inout) :: fh ! file handle + FH_TYPE, intent(inout) :: fh ! file handle call MPI_FILE_CLOSE(fh, mpiio_err) @@ -98,16 +105,16 @@ contains subroutine mpi_write_integer(fh, buffer, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: buffer ! data to write logical, intent(in) :: collect ! collective I/O if (collect) then call MPI_FILE_WRITE_ALL(fh, buffer, 1, MPI_INTEGER, & - MPI_STATUS_IGNORE, mpiio_err) + MPI_STATUS_IGNORE, mpiio_err) else call MPI_FILE_WRITE(fh, buffer, 1, MPI_INTEGER, & - MPI_STATUS_IGNORE, mpiio_err) + MPI_STATUS_IGNORE, mpiio_err) end if end subroutine mpi_write_integer @@ -118,7 +125,7 @@ contains subroutine mpi_read_integer(fh, buffer, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(inout) :: buffer ! read data to here logical, intent(in) :: collect ! collective I/O @@ -138,7 +145,7 @@ contains subroutine mpi_write_integer_1Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length ! length of array integer, intent(in) :: buffer(:) ! data to write logical, intent(in) :: collect ! collective I/O @@ -159,7 +166,7 @@ contains subroutine mpi_read_integer_1Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length ! length of array integer, intent(inout) :: buffer(:) ! read data to here logical, intent(in) :: collect ! collective I/O @@ -180,7 +187,7 @@ contains subroutine mpi_write_integer_2Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(2) ! length of array integer, intent(in) :: buffer(length(1),length(2)) ! data to write logical, intent(in) :: collect ! collective I/O @@ -201,7 +208,7 @@ contains subroutine mpi_read_integer_2Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(2) ! length of array integer, intent(inout) :: buffer(length(1),length(2)) ! read data to here logical, intent(in) :: collect ! collective I/O @@ -222,7 +229,7 @@ contains subroutine mpi_write_integer_3Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(3) ! length of array integer, intent(in) :: buffer(length(1),length(2),& length(3)) ! data to write @@ -244,7 +251,7 @@ contains subroutine mpi_read_integer_3Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(3) ! length of array integer, intent(inout) :: buffer(length(1),length(2), & length(3)) ! read data to here @@ -266,7 +273,7 @@ contains subroutine mpi_write_integer_4Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(4) ! length of array integer, intent(in) :: buffer(length(1),length(2),& length(3),length(4)) ! data to write @@ -288,7 +295,7 @@ contains subroutine mpi_read_integer_4Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(4) ! length of array integer, intent(inout) :: buffer(length(1),length(2), & length(3),length(4)) ! read data to here @@ -310,16 +317,16 @@ contains subroutine mpi_write_double(fh, buffer, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle real(8), intent(in) :: buffer ! data to write logical, intent(in) :: collect ! collective I/O if (collect) then call MPI_FILE_WRITE_ALL(fh, buffer, 1, MPI_REAL8, & - MPI_STATUS_IGNORE, mpiio_err) + MPI_STATUS_IGNORE, mpiio_err) else call MPI_FILE_WRITE(fh, buffer, 1, MPI_REAL8, & - MPI_STATUS_IGNORE, mpiio_err) + MPI_STATUS_IGNORE, mpiio_err) end if end subroutine mpi_write_double @@ -330,7 +337,7 @@ contains subroutine mpi_read_double(fh, buffer, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle real(8), intent(inout) :: buffer ! read data to here logical, intent(in) :: collect ! collective I/O @@ -350,7 +357,7 @@ contains subroutine mpi_write_double_1Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length ! length of array real(8), intent(in) :: buffer(:) ! data to write logical, intent(in) :: collect ! collective I/O @@ -371,7 +378,7 @@ contains subroutine mpi_read_double_1Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length ! length of array real(8), intent(inout) :: buffer(:) ! read data to here logical, intent(in) :: collect ! collective I/O @@ -392,7 +399,7 @@ contains subroutine mpi_write_double_2Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(2) ! length of array real(8), intent(in) :: buffer(length(1),length(2)) ! data to write logical, intent(in) :: collect ! collective I/O @@ -413,7 +420,7 @@ contains subroutine mpi_read_double_2Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(2) ! length of array real(8), intent(inout) :: buffer(length(1),length(2)) ! read data to here logical, intent(in) :: collect ! collective I/O @@ -434,7 +441,7 @@ contains subroutine mpi_write_double_3Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(3) ! length of array real(8), intent(in) :: buffer(length(1),length(2),& length(3)) ! data to write @@ -456,7 +463,7 @@ contains subroutine mpi_read_double_3Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(3) ! length of array real(8), intent(inout) :: buffer(length(1),length(2), & length(3)) ! read data to here @@ -478,7 +485,7 @@ contains subroutine mpi_write_double_4Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(4) ! length of array real(8), intent(in) :: buffer(length(1),length(2),& length(3),length(4)) ! data to write @@ -500,7 +507,7 @@ contains subroutine mpi_read_double_4Darray(fh, buffer, length, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length(4) ! length of array real(8), intent(inout) :: buffer(length(1),length(2), & length(3),length(4)) ! read data to here @@ -522,7 +529,7 @@ contains subroutine mpi_write_long(fh, buffer, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer(8), intent(in) :: buffer ! data to write logical, intent(in) :: collect ! collective I/O @@ -542,7 +549,7 @@ contains subroutine mpi_read_long(fh, buffer, collect) - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer(8), intent(inout) :: buffer ! read data to here logical, intent(in) :: collect ! collective I/O @@ -563,7 +570,7 @@ contains subroutine mpi_write_string(fh, buffer, length, collect) character(*), intent(in) :: buffer ! data to write - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length ! length of data logical, intent(in) :: collect ! collective I/O @@ -584,7 +591,7 @@ contains subroutine mpi_read_string(fh, buffer, length, collect) character(*), intent(inout) :: buffer ! read data to here - integer, intent(in) :: fh ! file handle + FH_TYPE, intent(in) :: fh ! file handle integer, intent(in) :: length ! length of string logical, intent(in) :: collect ! collective I/O @@ -598,5 +605,6 @@ contains end subroutine mpi_read_string +#endif #endif end module mpiio_interface diff --git a/src/output_interface.F90 b/src/output_interface.F90 index 816ff2575..9a4341135 100644 --- a/src/output_interface.F90 +++ b/src/output_interface.F90 @@ -7,9 +7,10 @@ module output_interface #ifdef HDF5 use hdf5_interface -#endif +#else #ifdef MPI use mpiio_interface +#endif #endif implicit none @@ -22,8 +23,13 @@ module output_interface integer(HID_T) :: hdf5_fh integer(HID_T) :: hdf5_grp #else - integer :: unit_fh -# endif + integer :: unit_fh +#ifdef MPIF08 + type(MPI_File) :: mpi_fh +#else + integer :: mpi_fh +#endif +#endif logical :: serial ! Serial I/O when using MPI/PHDF5 contains generic, public :: write_data => write_double, & @@ -122,7 +128,7 @@ contains open(NEWUNIT=self % unit_fh, FILE=filename, ACTION="write", & STATUS='replace', ACCESS='stream') else - call mpi_create_file(filename, self % unit_fh) + call mpi_create_file(filename, self % mpi_fh) end if #else open(NEWUNIT=self % unit_fh, FILE=filename, ACTION="write", & @@ -170,7 +176,7 @@ contains STATUS='old', ACCESS='stream') end if else - call mpi_open_file(filename, self % unit_fh, mode) + call mpi_open_file(filename, self % mpi_fh, mode) end if #else ! Check for read/write mode to open, default is read only @@ -203,7 +209,7 @@ contains if (self % serial) then close(UNIT=self % unit_fh) else - call mpi_close_file(self % unit_fh) + call mpi_close_file(self % mpi_fh) end if #else close(UNIT=self % unit_fh) @@ -293,7 +299,7 @@ contains if (self % serial) then write(self % unit_fh) buffer else - call mpi_write_double(self % unit_fh, buffer, collect_) + call mpi_write_double(self % mpi_fh, buffer, collect_) end if #else write(self % unit_fh) buffer @@ -354,7 +360,7 @@ contains if (self % serial) then read(self % unit_fh) buffer else - call mpi_read_double(self % unit_fh, buffer, collect_) + call mpi_read_double(self % mpi_fh, buffer, collect_) end if #else read(self % unit_fh) buffer @@ -417,7 +423,7 @@ contains if (self % serial) then write(self % unit_fh) buffer(1:length) else - call mpi_write_double_1Darray(self % unit_fh, buffer, length, collect_) + call mpi_write_double_1Darray(self % mpi_fh, buffer, length, collect_) end if #else write(self % unit_fh) buffer(1:length) @@ -480,7 +486,7 @@ contains if (self % serial) then read(self % unit_fh) buffer(1:length) else - call mpi_read_double_1Darray(self % unit_fh, buffer, length, collect_) + call mpi_read_double_1Darray(self % mpi_fh, buffer, length, collect_) end if #else read(self % unit_fh) buffer(1:length) @@ -543,7 +549,7 @@ contains if (self % serial) then write(self % unit_fh) buffer(1:length(1),1:length(2)) else - call mpi_write_double_2Darray(self % unit_fh, buffer, length, collect_) + call mpi_write_double_2Darray(self % mpi_fh, buffer, length, collect_) end if #else write(self % unit_fh) buffer(1:length(1),1:length(2)) @@ -606,7 +612,7 @@ contains if (self % serial) then read(self % unit_fh) buffer(1:length(1),1:length(2)) else - call mpi_read_double_2Darray(self % unit_fh, buffer, length, collect_) + call mpi_read_double_2Darray(self % mpi_fh, buffer, length, collect_) end if #else read(self % unit_fh) buffer(1:length(1),1:length(2)) @@ -669,7 +675,7 @@ contains if (self % serial) then write(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3)) else - call mpi_write_double_3Darray(self % unit_fh, buffer, length, collect_) + call mpi_write_double_3Darray(self % mpi_fh, buffer, length, collect_) end if #else write(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3)) @@ -732,7 +738,7 @@ contains if (self % serial) then read(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3)) else - call mpi_read_double_3Darray(self % unit_fh, buffer, length, collect_) + call mpi_read_double_3Darray(self % mpi_fh, buffer, length, collect_) end if #else read(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3)) @@ -798,7 +804,7 @@ contains write(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3), & 1:length(4)) else - call mpi_write_double_4Darray(self % unit_fh, buffer, length, collect_) + call mpi_write_double_4Darray(self % mpi_fh, buffer, length, collect_) end if #else write(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3), & @@ -864,7 +870,7 @@ contains read(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3), & 1:length(4)) else - call mpi_read_double_4Darray(self % unit_fh, buffer, length, collect_) + call mpi_read_double_4Darray(self % mpi_fh, buffer, length, collect_) end if #else read(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3), & @@ -926,7 +932,7 @@ contains if (self % serial) then write(self % unit_fh) buffer else - call mpi_write_integer(self % unit_fh, buffer, collect_) + call mpi_write_integer(self % mpi_fh, buffer, collect_) end if #else write(self % unit_fh) buffer @@ -987,7 +993,7 @@ contains if (self % serial) then read(self % unit_fh) buffer else - call mpi_read_integer(self % unit_fh, buffer, collect_) + call mpi_read_integer(self % mpi_fh, buffer, collect_) end if #else read(self % unit_fh) buffer @@ -1050,7 +1056,7 @@ contains if (self % serial) then write(self % unit_fh) buffer(1:length) else - call mpi_write_integer_1Darray(self % unit_fh, buffer, length, collect_) + call mpi_write_integer_1Darray(self % mpi_fh, buffer, length, collect_) end if #else write(self % unit_fh) buffer(1:length) @@ -1114,7 +1120,7 @@ contains if (self % serial) then read(self % unit_fh) buffer(1:length) else - call mpi_read_integer_1Darray(self % unit_fh, buffer, length, collect_) + call mpi_read_integer_1Darray(self % mpi_fh, buffer, length, collect_) end if #else read(self % unit_fh) buffer(1:length) @@ -1177,7 +1183,7 @@ contains if (self % serial) then write(self % unit_fh) buffer(1:length(1),1:length(2)) else - call mpi_write_integer_2Darray(self % unit_fh, buffer, length, collect_) + call mpi_write_integer_2Darray(self % mpi_fh, buffer, length, collect_) end if #else write(self % unit_fh) buffer(1:length(1),1:length(2)) @@ -1240,7 +1246,7 @@ contains if (self % serial) then read(self % unit_fh) buffer(1:length(1),1:length(2)) else - call mpi_read_integer_2Darray(self % unit_fh, buffer, length, collect_) + call mpi_read_integer_2Darray(self % mpi_fh, buffer, length, collect_) end if #else read(self % unit_fh) buffer(1:length(1),1:length(2)) @@ -1303,7 +1309,7 @@ contains if (self % serial) then write(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3)) else - call mpi_write_integer_3Darray(self % unit_fh, buffer, length, collect_) + call mpi_write_integer_3Darray(self % mpi_fh, buffer, length, collect_) end if #else write(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3)) @@ -1366,7 +1372,7 @@ contains if (self % serial) then read(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3)) else - call mpi_read_integer_3Darray(self % unit_fh, buffer, length, collect_) + call mpi_read_integer_3Darray(self % mpi_fh, buffer, length, collect_) end if #else read(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3)) @@ -1431,7 +1437,7 @@ contains write(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3), & 1:length(4)) else - call mpi_write_integer_4Darray(self % unit_fh, buffer, length, collect_) + call mpi_write_integer_4Darray(self % mpi_fh, buffer, length, collect_) end if #else write(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3), & @@ -1497,7 +1503,7 @@ contains read(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3), & 1:length(4)) else - call mpi_read_integer_4Darray(self % unit_fh, buffer, length, collect_) + call mpi_read_integer_4Darray(self % mpi_fh, buffer, length, collect_) end if #else read(self % unit_fh) buffer(1:length(1),1:length(2),1:length(3), & @@ -1560,7 +1566,7 @@ contains if (self % serial) then write(self % unit_fh) buffer else - call mpi_write_long(self % unit_fh, buffer, collect_) + call mpi_write_long(self % mpi_fh, buffer, collect_) end if #else write(self % unit_fh) buffer @@ -1622,7 +1628,7 @@ contains if (self % serial) then read(self % unit_fh) buffer else - call mpi_read_long(self % unit_fh, buffer, collect_) + call mpi_read_long(self % mpi_fh, buffer, collect_) end if #else read(self % unit_fh) buffer @@ -1688,7 +1694,7 @@ contains if (self % serial) then write(self % unit_fh) buffer else - call mpi_write_string(self % unit_fh, buffer, n, collect_) + call mpi_write_string(self % mpi_fh, buffer, n, collect_) end if #else write(self % unit_fh) buffer @@ -1754,7 +1760,7 @@ contains if (self % serial) then read(self % unit_fh) buffer else - call mpi_read_string(self % unit_fh, buffer, n, collect_) + call mpi_read_string(self % mpi_fh, buffer, n, collect_) end if #else read(self % unit_fh) buffer @@ -1914,7 +1920,7 @@ contains # elif MPI ! Write out tally buffer - call MPI_FILE_READ(self % unit_fh, buffer, n1*n2, MPI_TALLYRESULT, & + call MPI_FILE_READ(self % mpi_fh, buffer, n1*n2, MPI_TALLYRESULT, & MPI_STATUS_IGNORE, mpiio_err) #else @@ -1943,7 +1949,11 @@ contains # ifndef HDF5 integer(MPI_OFFSET_KIND) :: offset ! offset of data integer :: size_bank ! size of bank to write +#ifdef MPIF08 + type(MPI_Datatype) :: datatype +#else integer :: datatype +#endif # endif # ifdef HDF5 integer(8) :: offset(1) ! source data offset @@ -2023,7 +2033,7 @@ contains #elif MPI ! Get current offset for master - if (master) call MPI_FILE_GET_POSITION(self % unit_fh, offset, mpiio_err) + if (master) call MPI_FILE_GET_POSITION(self % mpi_fh, offset, mpiio_err) ! Determine offset on master process and broadcast to all processors call MPI_TYPE_MATCH_SIZE(MPI_TYPECLASS_INTEGER, MPI_OFFSET_KIND, & @@ -2035,7 +2045,7 @@ contains offset = offset + size_bank*work_index(rank) ! Write all source sites - call MPI_FILE_WRITE_AT(self % unit_fh, offset, source_bank(1), int(work), & + call MPI_FILE_WRITE_AT(self % mpi_fh, offset, source_bank(1), int(work), & MPI_BANK, MPI_STATUS_IGNORE, mpiio_err) #else @@ -2124,11 +2134,11 @@ contains ! Go to the end of the file to set file pointer offset = 0 - call MPI_FILE_SEEK(self % unit_fh, offset, MPI_SEEK_END, & + call MPI_FILE_SEEK(self % mpi_fh, offset, MPI_SEEK_END, & mpiio_err) ! Get current offset (will be at EOF) - call MPI_FILE_GET_POSITION(self % unit_fh, offset, mpiio_err) + call MPI_FILE_GET_POSITION(self % mpi_fh, offset, mpiio_err) ! Get the size of the source bank on all procs call MPI_TYPE_SIZE(MPI_BANK, size_bank, mpi_err) @@ -2140,7 +2150,7 @@ contains offset = offset + size_bank*work_index(rank) ! Write all source sites - call MPI_FILE_READ_AT(self % unit_fh, offset, source_bank(1), int(work), & + call MPI_FILE_READ_AT(self % mpi_fh, offset, source_bank(1), int(work), & MPI_BANK, MPI_STATUS_IGNORE, mpiio_err) #else diff --git a/src/source.F90 b/src/source.F90 index 2bd56af88..7cfdcf655 100644 --- a/src/source.F90 +++ b/src/source.F90 @@ -14,7 +14,7 @@ module source use string, only: to_str #ifdef MPI - use mpi + use message_passing #endif implicit none diff --git a/src/state_point.F90 b/src/state_point.F90 index b209d1707..0ba093176 100644 --- a/src/state_point.F90 +++ b/src/state_point.F90 @@ -23,7 +23,7 @@ module state_point use dict_header, only: ElemKeyValueII, ElemKeyValueCI #ifdef MPI - use mpi + use message_passing #endif implicit none diff --git a/src/tally.F90 b/src/tally.F90 index 4f0692877..e78e58f28 100644 --- a/src/tally.F90 +++ b/src/tally.F90 @@ -17,7 +17,7 @@ module tally use tally_header, only: TallyResult, TallyMapItem, TallyMapElement #ifdef MPI - use mpi + use message_passing #endif implicit none diff --git a/src/trigger.F90 b/src/trigger.F90 index d485e057d..6909598db 100644 --- a/src/trigger.F90 +++ b/src/trigger.F90 @@ -1,7 +1,7 @@ module trigger #ifdef MPI - use mpi + use message_passing #endif use constants