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
15 bind(c, name=
'neko_comm_wrapper_init')
16 use,
intrinsic :: iso_c_binding, only : c_int
17 integer(c_int),
value :: fcomm
21 subroutine neko_comm_nvshmem_init() &
22 bind(c, name=
'neko_comm_nvshmem_init')
23 end subroutine neko_comm_nvshmem_init
25 subroutine neko_comm_nvshmem_finalize() &
26 bind(c, name=
'neko_comm_nvshmem_finalize')
27 end subroutine neko_comm_nvshmem_finalize
30#if defined(HAVE_NCCL) || defined(HAVE_RCCL)
31 subroutine neko_comm_nccl_init() &
32 bind(c, name=
'neko_comm_nccl_init')
33 end subroutine neko_comm_nccl_init
35 subroutine neko_comm_nccl_finalize() &
36 bind(c, name=
'neko_comm_nccl_finalize')
37 end subroutine neko_comm_nccl_finalize
48#ifdef HAVE_MPI_PARAM_DTYPE
63 logical,
public ::
nio
76 logical :: initialized
77 integer :: provided, nthrds
80 character(len=255) :: color_str
89 call mpi_initialized(initialized, ierr)
91 call get_environment_variable(
"NEKO_COMM_ID", color_str, envvar_len)
92 if (envvar_len .gt. 0)
then
93 read(color_str(1:envvar_len), *) color
105 if (.not.initialized)
then
106 if (nthrds .gt. 1)
then
107 call mpi_init_thread(mpi_thread_multiple, provided, ierr)
108 if (provided .ne. mpi_thread_multiple)
then
111 call neko_error(
'Invalid thread support provided by MPI')
113 call mpi_init_thread(mpi_thread_serialized, provided, ierr)
114 if (provided .ne. mpi_thread_serialized)
then
115 call neko_error(
'Invalid thread support provided by MPI')
124#ifndef HAVE_MPI_PARAM_DTYPE
132 call mpi_comm_rank(mpi_comm_world,
pe_rank, ierr)
141 if (envvar_len .gt. 0)
then
156 call neko_comm_nvshmem_init()
159#if defined(HAVE_NCCL) | defined(HAVE_RCCL)
161 call neko_comm_nccl_init()
166 if (nthrds .gt. 1)
then
170 call neko_error(
'Invalid thread support provided by SHMEM')
174 call neko_error(
'Invalid thread support provided by SHMEM')
194 call neko_comm_nccl_finalize()
198 call neko_comm_nvshmem_finalize()
205 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
Fortran bindings to SHMEM's C API.
@ shmem_thread_serialized