Skip to content

Commit

Permalink
Merge pull request #356 from sfiligoi/mpiio_2403
Browse files Browse the repository at this point in the history
Make MPI IO striping optional
  • Loading branch information
jcandy authored Mar 6, 2024
2 parents 7a8c9da + 5512c72 commit 7815e25
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
2 changes: 2 additions & 0 deletions cgyro/bin/cgyro_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
x.add('PRINT_STEP','100')
x.add('RESTART_STEP','10')
x.add('RESTART_PRESERVATION_MODE','3')
x.add('MPIIO_STRIPE_FACTOR','0')
x.add('MPIIO_SMALL_STRIPE_FACTOR','0')
x.add('FREQ_TOL','0.001')
x.add('UP_RADIAL','1.0')
x.add('UP_THETA','1.0')
Expand Down
4 changes: 2 additions & 2 deletions cgyro/src/cgyro_globals.F90
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ module cgyro_globals

logical :: printout=.true.

integer, parameter :: mpiio_small_stripe_factor = 4
integer, parameter :: mpiio_stripe_factor = 24
integer :: mpiio_small_stripe_factor ! optional striping for data files
integer :: mpiio_stripe_factor ! optional striping for restart file
character(len=2) :: mpiio_small_stripe_str
character(len=3) :: mpiio_stripe_str
!
Expand Down
13 changes: 10 additions & 3 deletions cgyro/src/cgyro_mpi_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,17 @@ subroutine cgyro_mpi_grid
n_omp = omp_get_max_threads()

!----------------------------------------------------------------------------
! Restart communication setup
! Restart IO setup

write (mpiio_stripe_str,"(I3.3)") mpiio_stripe_factor
write (mpiio_small_stripe_str,"(I2.2)") mpiio_small_stripe_factor
if (mpiio_stripe_factor > 0) then
call cgyro_info("MPI IO factor set for restart file")
write (mpiio_stripe_str,"(I3.3)") mpiio_stripe_factor
endif

if (mpiio_small_stripe_factor > 0) then
call cgyro_info("MPI IO factor set for data files")
write (mpiio_small_stripe_str,"(I2.2)") mpiio_small_stripe_factor
endif

! save hostname configuration
call cgyro_write_hosts
Expand Down
2 changes: 2 additions & 0 deletions cgyro/src/cgyro_read_input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ subroutine cgyro_read_input
call cgyro_readbc_int(print_step,'PRINT_STEP')
call cgyro_readbc_int(restart_step,'RESTART_STEP')
call cgyro_readbc_int(restart_preservation_mode,'RESTART_PRESERVATION_MODE')
call cgyro_readbc_int(mpiio_stripe_factor,'MPIIO_STRIPE_FACTOR')
call cgyro_readbc_int(mpiio_small_stripe_factor,'MPIIO_SMALL_STRIPE_FACTOR')
call cgyro_readbc_real(freq_tol)
call cgyro_readbc_real(up_radial)
call cgyro_readbc_real(up_theta)
Expand Down
7 changes: 5 additions & 2 deletions cgyro/src/cgyro_write_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ subroutine cgyro_write_restart_one
! TODO Error handling
call MPI_INFO_CREATE(finfo,i_err)

! write to a temp file name first, so we don't end up with partially written files
call MPI_INFO_SET(finfo,"striping_factor",mpiio_stripe_str,i_err)
if (mpiio_stripe_factor > 0) then
! user asked us to explicitly set the MPI IO striping factor
call MPI_INFO_SET(finfo,"striping_factor",mpiio_stripe_str,i_err)
endif

! write to a temp file name first, so we don't end up with partially written files
call MPI_FILE_OPEN(CGYRO_COMM_WORLD,&
trim(path)//runfile_restart//".part",&
filemode,&
Expand Down
10 changes: 8 additions & 2 deletions cgyro/src/cgyro_write_timedata.f90
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ subroutine cgyro_write_distributed_bcomplex(datafile,n_fn,fn)

call MPI_INFO_CREATE(finfo,i_err)

call MPI_INFO_SET(finfo,"striping_factor",mpiio_small_stripe_str,i_err)
if (mpiio_small_stripe_factor > 0) then
! user asked us to explicitly set the MPI IO striping factor
call MPI_INFO_SET(finfo,"striping_factor",mpiio_small_stripe_str,i_err)
endif

call MPI_FILE_OPEN(NEW_COMM_2,&
datafile,&
Expand Down Expand Up @@ -364,7 +367,10 @@ subroutine cgyro_write_distributed_breal(datafile,n_fn,fn)

call MPI_INFO_CREATE(finfo,i_err)

call MPI_INFO_SET(finfo,"striping_factor",mpiio_small_stripe_str,i_err)
if (mpiio_small_stripe_factor > 0) then
! user asked us to explicitly set the MPI IO striping factor
call MPI_INFO_SET(finfo,"striping_factor",mpiio_small_stripe_str,i_err)
endif

call MPI_FILE_OPEN(NEW_COMM_2,&
datafile,&
Expand Down

0 comments on commit 7815e25

Please sign in to comment.