Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
functioning MPI_Comm_get_name, MPI_Comm_set_name
[simgrid.git] / src / smpi / include / private.hpp
index 8292cd7..de6dff6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 #include <unordered_map>
 #include <vector>
 
-#define MPI_REQ_PERSISTENT 0x1
-#define MPI_REQ_NON_PERSISTENT 0x2
-#define MPI_REQ_SEND 0x4
-#define MPI_REQ_RECV 0x8
-//#define MPI_REQ_RECV_DELETE 0x10
-#define MPI_REQ_ISEND 0x20
-#define MPI_REQ_SSEND 0x40
-#define MPI_REQ_PREPARED 0x80
-#define MPI_REQ_FINISHED 0x100
-#define MPI_REQ_RMA 0x200
-#define MPI_REQ_ACCUMULATE 0x400
+constexpr unsigned MPI_REQ_PERSISTENT     = 0x1;
+constexpr unsigned MPI_REQ_NON_PERSISTENT = 0x2;
+constexpr unsigned MPI_REQ_SEND           = 0x4;
+constexpr unsigned MPI_REQ_RECV           = 0x8;
+constexpr unsigned MPI_REQ_RECV_DELETE    = 0x10;
+constexpr unsigned MPI_REQ_ISEND          = 0x20;
+constexpr unsigned MPI_REQ_SSEND          = 0x40;
+constexpr unsigned MPI_REQ_PREPARED       = 0x80;
+constexpr unsigned MPI_REQ_FINISHED       = 0x100;
+constexpr unsigned MPI_REQ_RMA            = 0x200;
+constexpr unsigned MPI_REQ_ACCUMULATE     = 0x400;
+constexpr unsigned MPI_REQ_GENERALIZED    = 0x800;
+constexpr unsigned MPI_REQ_COMPLETE       = 0x1000;
 
 enum class SmpiProcessState { UNINITIALIZED, INITIALIZING, INITIALIZED, FINALIZED };
 
-#define COLL_TAG_REDUCE -112
-#define COLL_TAG_SCATTER -223
-#define COLL_TAG_SCATTERV -334
-#define COLL_TAG_GATHER -445
-#define COLL_TAG_ALLGATHER -556
-#define COLL_TAG_ALLGATHERV -667
-#define COLL_TAG_BARRIER -778
-#define COLL_TAG_REDUCE_SCATTER -889
-#define COLL_TAG_ALLTOALLV -1000
-#define COLL_TAG_ALLTOALL -1112
-#define COLL_TAG_GATHERV -2223
-#define COLL_TAG_BCAST -3334
-#define COLL_TAG_ALLREDUCE -4445
+constexpr int COLL_TAG_REDUCE         = -112;
+constexpr int COLL_TAG_SCATTER        = -223;
+constexpr int COLL_TAG_SCATTERV       = -334;
+constexpr int COLL_TAG_GATHER         = -445;
+constexpr int COLL_TAG_ALLGATHER      = -556;
+constexpr int COLL_TAG_ALLGATHERV     = -667;
+constexpr int COLL_TAG_BARRIER        = -778;
+constexpr int COLL_TAG_REDUCE_SCATTER = -889;
+constexpr int COLL_TAG_ALLTOALLV      = -1000;
+constexpr int COLL_TAG_ALLTOALL       = -1112;
+constexpr int COLL_TAG_GATHERV        = -2223;
+constexpr int COLL_TAG_BCAST          = -3334;
+constexpr int COLL_TAG_ALLREDUCE      = -4445;
 // SMPI_RMA_TAG has to be the smallest one, as it will be decremented for accumulate ordering.
-#define SMPI_RMA_TAG -6666
+constexpr int SMPI_RMA_TAG            = -6666;
+
+#define MPI_REQUEST_IGNORED ((MPI_Request*)-100)
 
 /* Convert between Fortran and C */
 
@@ -62,15 +66,17 @@ XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process();
 XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process_remote(simgrid::s4u::ActorPtr actor);
 XBT_PRIVATE int smpi_process_count();
 
-XBT_PRIVATE void smpi_deployment_register_process(const std::string instance_id, int rank,
+XBT_PRIVATE void smpi_deployment_register_process(const std::string& instance_id, int rank,
                                                   simgrid::s4u::ActorPtr actor);
-XBT_PRIVATE MPI_Comm* smpi_deployment_comm_world(const std::string instance_id);
-XBT_PRIVATE simgrid::s4u::Barrier* smpi_deployment_finalization_barrier(const std::string instance_id);
+XBT_PRIVATE MPI_Comm* smpi_deployment_comm_world(const std::string& instance_id);
+XBT_PRIVATE simgrid::s4u::Barrier* smpi_deployment_finalization_barrier(const std::string& instance_id);
 XBT_PRIVATE void smpi_deployment_cleanup_instances();
 
-XBT_PRIVATE void smpi_comm_copy_buffer_callback(smx_activity_t comm, void* buff, size_t buff_size);
+XBT_PRIVATE void smpi_comm_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, void* buff,
+                                                size_t buff_size);
 
-XBT_PRIVATE void smpi_comm_null_copy_buffer_callback(smx_activity_t comm, void* buff, size_t buff_size);
+XBT_PRIVATE void smpi_comm_null_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, void* buff,
+                                                     size_t buff_size);
 
 XBT_PRIVATE int smpi_enabled();
 XBT_PRIVATE void smpi_global_init();
@@ -102,6 +108,7 @@ XBT_PRIVATE void smpi_shared_destroy();
 XBT_PRIVATE void* smpi_get_tmp_sendbuffer(int size);
 XBT_PRIVATE void* smpi_get_tmp_recvbuffer(int size);
 XBT_PRIVATE void smpi_free_tmp_buffer(void* buf);
+XBT_PRIVATE void smpi_free_replay_tmp_buffers();
 
 extern "C" {
 // f77 wrappers
@@ -141,6 +148,8 @@ void mpi_bcast_(void* buf, int* count, int* datatype, int* root, int* comm, int*
 void mpi_reduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* root, int* comm, int* ierr);
 void mpi_allreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr);
 void mpi_reduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype, int* op, int* comm, int* ierr);
+void mpi_reduce_scatter_block_(void* sendbuf, void* recvbuf, int* recvcount, int* datatype, int* op, int* comm,
+                               int* ierr);
 void mpi_scatter_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype, int* root,
                   int* comm, int* ierr);
 void mpi_scatterv_(void* sendbuf, int* sendcounts, int* displs, int* sendtype, void* recvbuf, int* recvcount,
@@ -153,13 +162,44 @@ void mpi_allgather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf,
                     int* comm, int* ierr);
 void mpi_allgatherv_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* displs,
                      int* recvtype, int* comm, int* ierr);
-void mpi_type_size_(int* datatype, int* size, int* ierr);
-
 void mpi_scan_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr);
 void mpi_alltoall_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
                    int* comm, int* ierr);
 void mpi_alltoallv_(void* sendbuf, int* sendcounts, int* senddisps, int* sendtype, void* recvbuf, int* recvcounts,
                     int* recvdisps, int* recvtype, int* comm, int* ierr);
+void mpi_alltoallw_(void* sendbuf, int* sendcnts, int* sdispls, int* sendtypes, void* recvbuf, int* recvcnts,
+                    int* rdispls, int* recvtypes, int* comm, int* ierr);
+void mpi_exscan_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr);
+
+void mpi_ibarrier_(int* comm, int* request, int* ierr);
+void mpi_ibcast_(void* buf, int* count, int* datatype, int* root, int* comm, int* request, int* ierr);
+void mpi_ireduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* root, int* comm, int* request, int* ierr);
+void mpi_iallreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* request, int* ierr);
+void mpi_ireduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype, int* op, int* comm, int* request, int* ierr);
+void mpi_ireduce_scatter_block_(void* sendbuf, void* recvbuf, int* recvcount, int* datatype, int* op, int* comm, int* request ,
+                               int* ierr);
+void mpi_iscatter_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype, int* root,
+                  int* comm, int* request, int* ierr);
+void mpi_iscatterv_(void* sendbuf, int* sendcounts, int* displs, int* sendtype, void* recvbuf, int* recvcount,
+                   int* recvtype, int* root, int* comm, int* request, int* ierr);
+void mpi_igather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype, int* root,
+                 int* comm, int* request, int* ierr);
+void mpi_igatherv_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcounts, int* displs,
+                  int* recvtype, int* root, int* comm, int* request, int* ierr);
+void mpi_iallgather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
+                    int* comm, int* request, int* ierr);
+void mpi_iallgatherv_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* displs,
+                     int* recvtype, int* comm, int* request, int* ierr);
+void mpi_iscan_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* request, int* ierr);
+void mpi_ialltoall_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
+                   int* comm, int* request, int* ierr);
+void mpi_ialltoallv_(void* sendbuf, int* sendcounts, int* senddisps, int* sendtype, void* recvbuf, int* recvcounts,
+                    int* recvdisps, int* recvtype, int* comm, int* request, int* ierr);
+void mpi_ialltoallw_(void* sendbuf, int* sendcnts, int* sdispls, int* sendtypes, void* recvbuf, int* recvcnts,
+                    int* rdispls, int* recvtypes, int* comm, int* request, int* ierr);
+void mpi_iexscan_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* request, int* ierr);
+
+void mpi_type_size_(int* datatype, int* size, int* ierr);
 void mpi_get_processor_name_(char* name, int* resultlen, int* ierr);
 void mpi_test_(int* request, int* flag, MPI_Status* status, int* ierr);
 void mpi_testall_(int* count, int* requests, int* flag, MPI_Status* statuses, int* ierr);
@@ -277,8 +317,6 @@ void mpi_sendrecv_replace_(void* buf, int* count, int* datatype, int* dst, int*
 void mpi_testany_(int* count, int* requests, int* index, int* flag, MPI_Status* status, int* ierr);
 void mpi_waitsome_(int* incount, int* requests, int* outcount, int* indices, MPI_Status* status, int* ierr);
 void mpi_reduce_local_(void* inbuf, void* inoutbuf, int* count, int* datatype, int* op, int* ierr);
-void mpi_reduce_scatter_block_(void* sendbuf, void* recvbuf, int* recvcount, int* datatype, int* op, int* comm,
-                               int* ierr);
 void mpi_pack_size_(int* incount, int* datatype, int* comm, int* size, int* ierr);
 void mpi_cart_coords_(int* comm, int* rank, int* maxdims, int* coords, int* ierr);
 void mpi_cart_create_(int* comm_old, int* ndims, int* dims, int* periods, int* reorder, int* comm_cart, int* ierr);
@@ -356,10 +394,7 @@ void mpi_type_create_resized_(int* oldtype, MPI_Aint* lb, MPI_Aint* extent, int*
 void mpi_type_create_subarray_(int* ndims, int* array_of_sizes, int* array_of_subsizes, int* array_of_starts,
                                int* order, int* oldtype, int* newtype, int* ierr);
 void mpi_type_match_size_(int* typeclass, int* size, int* datatype, int* ierr);
-void mpi_alltoallw_(void* sendbuf, int* sendcnts, int* sdispls, int* sendtypes, void* recvbuf, int* recvcnts,
-                    int* rdispls, int* recvtypes, int* comm, int* ierr);
-void mpi_exscan_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr);
-void mpi_comm_set_name_(int* comm, char* name, int* ierr, int size);
+void mpi_comm_set_name_(int* comm, char* name, int* ierr);
 void mpi_comm_dup_with_info_(int* comm, int* info, int* newcomm, int* ierr);
 void mpi_comm_split_type_(int* comm, int* split_type, int* key, int* info, int* newcomm, int* ierr);
 void mpi_comm_set_info_(int* comm, int* info, int* ierr);