2 use mpi_f08,
only : mpi_comm, mpi_datatype, mpi_initialized, mpi_init_thread, &
3 mpi_init, mpi_thread_multiple, mpi_thread_serialized, mpi_comm_rank, &
4 mpi_comm_split, mpi_comm_dup, mpi_barrier, mpi_comm_free, mpi_finalize, &
5 mpi_comm_world, mpi_double_precision, mpi_real, mpi_comm_size
14 bind(c, name=
'neko_comm_wrapper_init')
15 use,
intrinsic :: iso_c_binding, only : c_int
16 integer(c_int),
value :: fcomm
20 subroutine neko_comm_nvshmem_init() &
21 bind(c, name=
'neko_comm_nvshmem_init')
22 end subroutine neko_comm_nvshmem_init
24 subroutine neko_comm_nvshmem_finalize() &
25 bind(c, name=
'neko_comm_nvshmem_finalize')
26 end subroutine neko_comm_nvshmem_finalize
29#if defined(HAVE_NCCL) || defined(HAVE_RCCL)
30 subroutine neko_comm_nccl_init() &
31 bind(c, name=
'neko_comm_nccl_init')
32 end subroutine neko_comm_nccl_init
34 subroutine neko_comm_nccl_finalize() &
35 bind(c, name=
'neko_comm_nccl_finalize')
36 end subroutine neko_comm_nccl_finalize
47#ifdef HAVE_MPI_PARAM_DTYPE
62 logical,
public ::
nio
75 logical :: initialized
76 integer :: provided, nthrds
79 character(len=255) :: color_str
85 call mpi_initialized(initialized, ierr)
87 call get_environment_variable(
"NEKO_COMM_ID", color_str, envvar_len)
88 if (envvar_len .gt. 0)
then
89 read(color_str(1:envvar_len), *) color
101 if (.not.initialized)
then
102 if (nthrds .gt. 1)
then
103 call mpi_init_thread(mpi_thread_multiple, provided, ierr)
104 if (provided .ne. mpi_thread_multiple)
then
107 call neko_error(
'Invalid thread support provided by MPI')
109 call mpi_init_thread(mpi_thread_serialized, provided, ierr)
110 if (provided .ne. mpi_thread_serialized)
then
111 call neko_error(
'Invalid thread support provided by MPI')
120#ifndef HAVE_MPI_PARAM_DTYPE
128 call mpi_comm_rank(mpi_comm_world,
pe_rank, ierr)
137 if (envvar_len .gt. 0)
then
152 call neko_comm_nvshmem_init()
155#if defined(HAVE_NCCL) | defined(HAVE_RCCL)
157 call neko_comm_nccl_init()
170 call neko_comm_nccl_finalize()
174 call neko_comm_nvshmem_finalize()
177 call mpi_finalize(ierr)
subroutine, public comm_free
subroutine, public comm_init
logical, public nio
I/O node.
type(mpi_comm), public neko_global_comm
type(mpi_datatype), public mpi_real_precision
MPI type for working precision of REAL types.
integer, public global_pe_rank
Global MPI rank.
integer, public pe_size
MPI size of communicator.
integer, public pe_rank
MPI rank.
integer, public global_pe_size
Global MPI size of communicator.
type(mpi_comm), public neko_comm
MPI communicator.
type(mpi_datatype), public mpi_extra_precision
integer, parameter neko_bcknd_device