-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathio_netcdf_workaround_module.F90
More file actions
49 lines (39 loc) · 1.64 KB
/
io_netcdf_workaround_module.F90
File metadata and controls
49 lines (39 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
module io_netcdf_workaround_module
private
public next_io_rank
integer, parameter :: SEQUENTIAL_IO_RANK = 0
contains
integer function next_io_rank(communicator, async_netcdf_allowed, partit) result(result)
USE MOD_PARTIT
USE MOD_PARSUP
use mpi_topology_module
integer, intent(in) :: communicator
logical, intent(out) :: async_netcdf_allowed
type(t_partit), intent(in), target :: partit
! EO args
integer rank_use_count
integer rank
result = next_io_rank_helper(communicator, rank_use_count)
if(rank_use_count > 1) then
if(partit%mype == SEQUENTIAL_IO_RANK) print *,"rejecting additional async NetCDF for process:",result, "use count:", rank_use_count, "falling back to sequential I/O on process ",SEQUENTIAL_IO_RANK
result = SEQUENTIAL_IO_RANK
async_netcdf_allowed = .false.
else
async_netcdf_allowed = .true.
end if
end function next_io_rank
integer recursive function next_io_rank_helper(communicator, rank_use_count) result(result)
use mpi_topology_module
integer, intent(in) :: communicator
integer, intent(out) :: rank_use_count
! EO args
integer rank
rank = mpi_topology%next_host_head_rank(communicator, rank_use_count)
! we want to skip rank SEQUENTIAL_IO_RANK as we already do serial netcdf I/O calls from it
if(rank == SEQUENTIAL_IO_RANK) then
! todo: recursion will never end if SEQUENTIAL_IO_RANK is our only rank
rank = next_io_rank_helper(communicator, rank_use_count)
end if
result = rank
end function next_io_rank_helper
end module io_netcdf_workaround_module