diff --git a/source/adios2/helper/mpidummy.cpp b/source/adios2/helper/mpidummy.cpp index dc2eda8f45..fa53c2c331 100644 --- a/source/adios2/helper/mpidummy.cpp +++ b/source/adios2/helper/mpidummy.cpp @@ -181,6 +181,14 @@ int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, recvcount, recvtype, 0, comm); } +int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int *recvcounts, int *displs, + MPI_Datatype recvtype, MPI_Comm comm) +{ + return MPIDUMMY::MPI_Gatherv(sendbuf, sendcount, sendtype, recvbuf, + recvcounts, displs, recvtype, 0, comm); +} + int MPI_Scatter(const void *sendbuf, int sendcnt, MPI_Datatype sendtype, void *recvbuf, int recvcnt, MPI_Datatype recvtype, int root, MPI_Comm comm) diff --git a/source/adios2/helper/mpidummy.h b/source/adios2/helper/mpidummy.h index bbaa555bbd..6415ada89a 100644 --- a/source/adios2/helper/mpidummy.h +++ b/source/adios2/helper/mpidummy.h @@ -80,8 +80,20 @@ typedef int MPI_Op; #define MPI_ANY_SOURCE 0 #define MPI_ANY_TAG 0 -#define MPI_SUM 0 -#define MPI_MAX 1 +#define MPI_MAX 0 +#define MPI_MIN 1 +#define MPI_SUM 2 +#define MPI_PROD 3 +#define MPI_LAND 4 +#define MPI_BAND 5 +#define MPI_LOR 6 +#define MPI_BOR 7 +#define MPI_LXOR 8 +#define MPI_BXOR 9 +#define MPI_MAXLOC 10 +#define MPI_MINLOC 11 +#define MPI_REPLACE 12 +#define MPI_NO_OP 13 #define MPI_MAX_PROCESSOR_NAME 32 @@ -132,6 +144,9 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm); +int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, + void *recvbuf, int *recvcounts, int *displs, + MPI_Datatype recvtype, MPI_Comm comm); int MPI_Scatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, diff --git a/source/adios2/helper/mpiwrap.h b/source/adios2/helper/mpiwrap.h index 403848b5bd..da3c58cedc 100644 --- a/source/adios2/helper/mpiwrap.h +++ b/source/adios2/helper/mpiwrap.h @@ -79,6 +79,8 @@ int SMPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, MPI_Datatype recvtype, int root, MPI_Comm comm); int SMPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm); +int SMPI_Allreduce(const void *sendbuf, void *recvbuf, int count, + MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); #ifdef __cplusplus } diff --git a/source/adios2/toolkit/sst/CMakeLists.txt b/source/adios2/toolkit/sst/CMakeLists.txt index 34b8e23045..60d4b0012d 100644 --- a/source/adios2/toolkit/sst/CMakeLists.txt +++ b/source/adios2/toolkit/sst/CMakeLists.txt @@ -9,6 +9,7 @@ add_library(sst cp/cp_writer.c cp/cp_common.c cp/ffs_marshal.c + ${PROJECT_SOURCE_DIR}/source/adios2/helper/mpidummy.cpp ) target_link_libraries(sst PRIVATE taustubs) diff --git a/source/adios2/toolkit/sst/cp/cp_common.c b/source/adios2/toolkit/sst/cp/cp_common.c index 99cc437519..f75b469ee0 100644 --- a/source/adios2/toolkit/sst/cp/cp_common.c +++ b/source/adios2/toolkit/sst/cp/cp_common.c @@ -8,11 +8,6 @@ #include "adios2/ADIOSConfig.h" #include #include -#ifdef ADIOS2_HAVE_MPI -#include -#else -#include "sstmpidummy.h" -#endif #include "sst.h" diff --git a/source/adios2/toolkit/sst/cp/cp_reader.c b/source/adios2/toolkit/sst/cp/cp_reader.c index bcfd3e8901..6fe7b73917 100644 --- a/source/adios2/toolkit/sst/cp/cp_reader.c +++ b/source/adios2/toolkit/sst/cp/cp_reader.c @@ -13,11 +13,6 @@ #include "adios2/ADIOSConfig.h" #include #include -#ifdef ADIOS2_HAVE_MPI -#include -#else -#include "sstmpidummy.h" -#endif #include #include "sst.h" diff --git a/source/adios2/toolkit/sst/cp/cp_writer.c b/source/adios2/toolkit/sst/cp/cp_writer.c index f4d44e6d0c..03d407fe44 100644 --- a/source/adios2/toolkit/sst/cp/cp_writer.c +++ b/source/adios2/toolkit/sst/cp/cp_writer.c @@ -12,11 +12,6 @@ #include "adios2/ADIOSConfig.h" #include #include -#ifdef ADIOS2_HAVE_MPI -#include -#else -#include "sstmpidummy.h" -#endif #include #include "sst.h" diff --git a/source/adios2/toolkit/sst/cp/ffs_marshal.c b/source/adios2/toolkit/sst/cp/ffs_marshal.c index 18e714206b..cd3381817d 100644 --- a/source/adios2/toolkit/sst/cp/ffs_marshal.c +++ b/source/adios2/toolkit/sst/cp/ffs_marshal.c @@ -6,11 +6,6 @@ #include "adios2/ADIOSConfig.h" #include #include -#ifdef ADIOS2_HAVE_MPI -#include -#else -#include "sstmpidummy.h" -#endif #include #include "adios2/ADIOSConfig.h" diff --git a/source/adios2/toolkit/sst/cp/ffs_zfp.c b/source/adios2/toolkit/sst/cp/ffs_zfp.c index 97149ad9bc..f8a252162b 100644 --- a/source/adios2/toolkit/sst/cp/ffs_zfp.c +++ b/source/adios2/toolkit/sst/cp/ffs_zfp.c @@ -6,11 +6,6 @@ #include "adios2/ADIOSConfig.h" #include #include -#ifdef ADIOS2_HAVE_MPI -#include -#else -#include "sstmpidummy.h" -#endif #include #include "sst.h" diff --git a/source/adios2/toolkit/sst/dp/rdma_dp.c b/source/adios2/toolkit/sst/dp/rdma_dp.c index 95e274281f..07fcd28024 100644 --- a/source/adios2/toolkit/sst/dp/rdma_dp.c +++ b/source/adios2/toolkit/sst/dp/rdma_dp.c @@ -7,11 +7,6 @@ #include "adios2/ADIOSConfig.h" #include #include -#ifdef ADIOS2_HAVE_MPI -#include -#else -#include "sstmpidummy.h" -#endif #include diff --git a/source/adios2/toolkit/sst/dp_interface.h b/source/adios2/toolkit/sst/dp_interface.h index 65321b656c..251b990b99 100644 --- a/source/adios2/toolkit/sst/dp_interface.h +++ b/source/adios2/toolkit/sst/dp_interface.h @@ -4,12 +4,9 @@ #include #include "adios2/ADIOSConfig.h" +#include "adios2/helper/mpiwrap.h" #include -#ifdef ADIOS2_HAVE_MPI -#include -#else -#include "sstmpidummy.h" -#endif + /*! * * CP_DP_Interface is the set of data format descriptions and function diff --git a/source/adios2/toolkit/sst/sst.h b/source/adios2/toolkit/sst/sst.h index c1bbdb902c..ace492dd20 100644 --- a/source/adios2/toolkit/sst/sst.h +++ b/source/adios2/toolkit/sst/sst.h @@ -10,6 +10,8 @@ #ifndef SST_H_ #define SST_H_ +#include "adios2/helper/mpiwrap.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/source/adios2/toolkit/sst/sstmpidummy.h b/source/adios2/toolkit/sst/sstmpidummy.h deleted file mode 100644 index d60f570f26..0000000000 --- a/source/adios2/toolkit/sst/sstmpidummy.h +++ /dev/null @@ -1,238 +0,0 @@ -#ifndef SSTMPIDUMMY_H_ -#define SSTMPIDUMMY_H_ - -#include - -typedef int MPI_Comm; -typedef int MPI_Status; -typedef int MPI_request; -typedef int MPI_Datatype; -typedef int MPI_Op; - -#define MPI_SUCCESS 0 -#define MPI_ERR_BUFFER 1 /* Invalid buffer pointer */ -#define MPI_ERR_COUNT 2 /* Invalid count argument */ -#define MPI_ERR_TYPE 3 /* Invalid datatype argument */ -#define MPI_ERR_TAG 4 /* Invalid tag argument */ -#define MPI_ERR_COMM 5 /* Invalid communicator */ -#define MPI_ERR_INTERN 17 /* Invalid memory */ -#define MPI_MAX_ERROR_STRING 512 -#define MPI_MODE_RDONLY 1 -#define MPI_MODE_WRONLY 2 -#define MPI_MODE_RDWR (MPI_MODE_RDONLY | MPI_MODE_RDONLY) -#define MPI_MODE_CREATE MPI_MODE_WRONLY -#define MPI_MODE_EXCL 0 -#define MPI_MODE_DELETE_ON_CLOSE 0 -#define MPI_MODE_UNIQUE_OPEN 0 -#define MPI_MODE_SEQUENTIAL 0 -#define MPI_MODE_APPEND 4 -#define MPI_SEEK_SET SEEK_SET -#define MPI_SEEK_CUR SEEK_CUR -#define MPI_SEEK_END SEEK_END -#define MPI_INFO_NULL 0 - -#define MPI_COMM_NULL 0 -#define MPI_COMM_WORLD 1 -#define MPI_COMM_SELF 2 - -#define MPI_INT 1 -#define MPI_CHAR 2 -#define MPI_BYTE 2 -#define MPI_DOUBLE 3 -#define MPI_UNSIGNED 4 -#define MPI_UNSIGNED_LONG 5 -#define MPI_UNSIGNED_LONG_LONG 6 -#define MPI_SHORT 7 -#define MPI_LONG 8 -#define MPI_UNSIGNED_CHAR 9 -#define MPI_2INT 10 -#define MPI_UNSIGNED_SHORT 11 -#define MPI_LONG_LONG_INT 12 -#define MPI_LONG_LONG 12 -#define MPI_LONG_DOUBLE 13 -#define MPI_FLOAT_INT 14 -#define MPI_DOUBLE_INT 15 -#define MPI_LONG_DOUBLE_INT 16 -#define MPI_SHORT_INT 17 - -#define MPI_ANY_SOURCE 0 -#define MPI_ANY_TAG 0 - -#define MPI_MAX 0 -#define MPI_MIN 1 -#define MPI_SUM 2 -#define MPI_PROD 3 -#define MPI_LAND 4 -#define MPI_BAND 5 -#define MPI_LOR 6 -#define MPI_BOR 7 -#define MPI_LXOR 8 -#define MPI_BXOR 9 -#define MPI_MAXLOC 10 -#define MPI_MINLOC 11 -#define MPI_REPLACE 12 -#define MPI_NO_OP 13 - -#define MPI_Init(argc, argv) - -static int MPI_Comm_rank(MPI_Comm comm, int *rank) -{ - *rank = 0; - return MPI_SUCCESS; -} - -static int MPI_Comm_size(MPI_Comm comm, int *size) -{ - *size = 1; - return MPI_SUCCESS; -} - -static int MPI_Gather(const void *sendbuf, int sendcnt, MPI_Datatype sendtype, - void *recvbuf, int recvcnt, MPI_Datatype recvtype, - int root, MPI_Comm comm) -{ - int ier = MPI_SUCCESS; - size_t n = 0, nsent = 0, nrecv = 0; - if (!sendbuf && !recvbuf) - { - return ier; - } - if (comm == MPI_COMM_NULL || root) - { - ier = MPI_ERR_COMM; - } - - switch (sendtype) - { - case MPI_CHAR: - n = sizeof(char); - break; - case MPI_INT: - n = sizeof(int); - break; - case MPI_UNSIGNED: - n = sizeof(unsigned int); - break; - case MPI_UNSIGNED_LONG: - case MPI_LONG: - n = sizeof(unsigned long); - break; - case MPI_UNSIGNED_LONG_LONG: - case MPI_LONG_LONG: - n = sizeof(unsigned long long); - break; - default: - return MPI_ERR_TYPE; - } - nsent = n * sendcnt; - - switch (recvtype) - { - case MPI_CHAR: - nrecv = sizeof(char); - break; - case MPI_INT: - nrecv = sizeof(int); - break; - case MPI_UNSIGNED: - nrecv = sizeof(unsigned int); - break; - case MPI_UNSIGNED_LONG: - case MPI_LONG: - nrecv = sizeof(unsigned long); - break; - case MPI_UNSIGNED_LONG_LONG: - case MPI_LONG_LONG: - nrecv = sizeof(unsigned long long); - break; - default: - return MPI_ERR_TYPE; - } - nrecv = n * recvcnt; - - if (nrecv != nsent) - { - ier = MPI_ERR_COUNT; - } - - if (ier == MPI_SUCCESS) - { - memcpy(recvbuf, sendbuf, nsent); - } - else - { - fprintf(stderr, "could not gather data\n"); - } - - return ier; -} - -static int MPI_Gatherv(const void *sendbuf, int sendcnt, MPI_Datatype sendtype, - void *recvbuf, const int *recvcnts, const int *displs, - MPI_Datatype recvtype, int root, MPI_Comm comm) -{ - int ier = MPI_SUCCESS; - if (*recvcnts != sendcnt) - { - ier = MPI_ERR_BUFFER; - return ier; - } - - ier = MPI_Gather(sendbuf, sendcnt, sendtype, recvbuf, *recvcnts, recvtype, - root, comm); - return ier; -} - -static int MPI_Allgather(const void *sendbuf, int sendcount, - MPI_Datatype sendtype, void *recvbuf, int recvcount, - MPI_Datatype recvtype, MPI_Comm comm) -{ - return MPI_Gather(sendbuf, sendcount, sendtype, recvbuf, recvcount, - recvtype, 0, comm); -} - -static int MPI_Allreduce(void *send_data, void *recv_data, int count, - MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) -{ - return MPI_Gather(send_data, count, datatype, recv_data, count, datatype, 0, - comm); -} - -static int MPI_Reduce(void *send_data, void *recv_data, int count, - MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm) -{ - return MPI_Allreduce(send_data, recv_data, count, datatype, op, comm); -} - -static int MPI_Allgatherv(const void *sendbuf, int sendcount, - MPI_Datatype sendtype, void *recvbuf, int *recvcounts, - int *displs, MPI_Datatype recvtype, MPI_Comm comm) -{ - *recvcounts = 1; - *displs = 0; - return MPI_Gather(sendbuf, sendcount, sendtype, recvbuf, sendcount, - recvtype, 0, comm); -} - -static int MPI_Barrier(MPI_Comm comm) { return MPI_SUCCESS; } - -static int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, - MPI_Comm comm) -{ - return MPI_SUCCESS; -} - -static double MPI_Wtime() -{ - struct timeval tv; - - if (gettimeofday(&tv, NULL) < 0) - { - perror("could not get time"); - return (0.); - } - - return (tv.tv_sec + ((double)tv.tv_usec / 1000000.)); -} - -#endif diff --git a/source/adios2/toolkit/sst/util/sst_conn_tool.c b/source/adios2/toolkit/sst/util/sst_conn_tool.c index 2770f0c1b0..578cdea567 100644 --- a/source/adios2/toolkit/sst/util/sst_conn_tool.c +++ b/source/adios2/toolkit/sst/util/sst_conn_tool.c @@ -46,11 +46,6 @@ to any interfaces. #include "adios2/ADIOSConfig.h" #include #include -#ifdef ADIOS2_HAVE_MPI -#include -#else -#include "sstmpidummy.h" -#endif #include #include "sst.h"