14#include "arcane/parallel/mpi/ArcaneMpi.h"
16#include "arcane/utils/String.h"
17#include "arcane/impl/ArcaneMain.h"
18#include "arcane/ApplicationBuildInfo.h"
26#if __has_include(<mpi-ext.h>)
39extern "C++" ARCANE_MPI_EXPORT
bool
42 bool is_aware =
false;
45#if defined(ARCANE_OS_LINUX)
46#if defined(MPIX_CUDA_AWARE_SUPPORT) || defined(MPIX_GPU_SUPPORT_CUDA)
47 is_aware = (MPIX_Query_cuda_support()==1);
53extern "C++" ARCANE_MPI_EXPORT
bool
56 bool is_aware =
false;
61#if defined(ARCANE_OS_LINUX)
62#if defined(MPIX_GPU_SUPPORT_HIP)
64# if defined(CRAY_MPICH_VERSION)
66 MPIX_GPU_query_support(MPIX_GPU_SUPPORT_HIP,&is_supported);
67 is_aware = (is_supported!=0);
69 is_aware = (MPIX_Query_hip_support()==1);
74#if defined(MPIX_ROCM_AWARE_SUPPORT)
75 is_aware = (MPIX_Query_rocm_support()==1);
84extern "C++" ARCANE_MPI_EXPORT
bool
101 MpiAutoInit() =
default;
105 void initialize(
int* argc,
char*** argv,
int wanted_thread_level)
108 MPI_Initialized(&is_init);
113 int thread_provided = 0;
114 MPI_Init_thread(argc, argv, wanted_thread_level, &thread_provided);
115 m_need_finalize =
true;
120 if (m_need_finalize){
122 m_need_finalize =
false;
128 bool m_need_finalize =
false;
159 String message_passing_service = app_build_info.messagePassingService();
160 bool need_init = message_passing_service !=
"SequentialParallelSuperMng";
161 bool has_shared_memory_message_passing = app_build_info.nbSharedMemorySubDomain()>0;
167 int thread_wanted = MPI_THREAD_SERIALIZED;
168 if (has_shared_memory_message_passing)
169 thread_wanted = MPI_THREAD_MULTIPLE;
177 char*** argv =
nullptr;
180 MPI_Comm_size(MPI_COMM_WORLD,&comm_size);
186 message_passing_service =
"Sequential";
188 if (has_shared_memory_message_passing)
189 message_passing_service =
"Hybrid";
191 message_passing_service =
"Mpi";
194 if (has_shared_memory_message_passing)
195 message_passing_service =
"MpiSharedMemory";
197 message_passing_service =
"MpiSequential";
199 message_passing_service = message_passing_service +
"ParallelSuperMng";
211bool global_already_added =
false;
217extern "C" ARCANE_MPI_EXPORT
void
220 if (!global_already_added)
222 global_already_added =
true;
225extern "C++" ARCANE_MPI_EXPORT
void
228 global_mpi_auto_init.initialize(argc,argv,wanted_thread_level);
231extern "C++" ARCANE_MPI_EXPORT
void
234 global_mpi_auto_init.finalize();
Informations pour construire une instance de IApplication.
void internalSetDefaultMessagePassingService(const String &name)
Nom du gestionnaire de message par défaut. Ne doit être modifié que par Arcane.
static void addApplicationBuildInfoVisitor(IApplicationBuildInfoVisitor *visitor)
Ajoute un visiteur pour remplir ApplicationBuildInfo.
void visit(ApplicationBuildInfo &app_build_info) override
Remplit les valeurs par défaut pour les services d'échange de message.
Classe singleton pour appeler automatiquement MPI_Init et MPI_Finalize si besoin. On appelle MPI_Fina...
Chaîne de caractères unicode.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
ARCANE_MPI_EXPORT void arcaneInitializeMPI(int *argc, char ***argv, int wanted_thread_level)
ARCANE_MPI_EXPORT bool arcaneIsAcceleratorAwareMPI()
Indique si le runtime actuel de MPI a le support des accélérateurs.
ARCANE_MPI_EXPORT bool arcaneIsCudaAwareMPI()
Indique si le runtime actuel de MPI a le support de CUDA.
ARCANE_MPI_EXPORT void arcaneAutoDetectMessagePassingServiceMPI()
Mécanisme pour initialiser automatiquement MPI et les services d'échange de messages de Arcane en fon...
ARCANE_MPI_EXPORT void arcaneFinalizeMPI()