Add MPI_Comm_get_attr function with MPI_TAG_UB to STUBS library

This commit is contained in:
Stan Gerald Moore
2024-04-30 12:29:18 -06:00
parent 25f32b78dd
commit 32244eeb0d
2 changed files with 24 additions and 1 deletions

View File

@ -20,6 +20,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <climits>
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
@ -40,7 +41,7 @@ typedef struct _mpi_double_int double_int;
#define MAXEXTRA_DATATYPE 16
int nextra_datatype;
int nextra_datatype,attribute_val;
MPI_Datatype *ptr_datatype[MAXEXTRA_DATATYPE];
int index_datatype[MAXEXTRA_DATATYPE];
int size_datatype[MAXEXTRA_DATATYPE];
@ -708,3 +709,21 @@ int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype sen
}
/* ---------------------------------------------------------------------- */
int MPI_Comm_get_attr(MPI_Comm comm, int comm_keyval, void **attribute_val_ptr,
int *flag)
{
if (comm_keyval != MPI_TAG_UB) {
attribute_val_ptr = nullptr;
*flag = 0;
return MPI_ERR_ARG;
}
attribute_val = INT_MAX;
*attribute_val_ptr = (void*) &attribute_val;
*flag = 1;
return MPI_SUCCESS;
}
/* ---------------------------------------------------------------------- */

View File

@ -57,6 +57,8 @@
#define MPI_ANY_SOURCE -1
#define MPI_STATUS_IGNORE NULL
#define MPI_TAG_UB 0
#define MPI_Comm int
#define MPI_Request int
#define MPI_Datatype int
@ -163,6 +165,8 @@ int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recv
int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype sendtype,
void *recvbuf, int *recvcounts, int *rdispls, MPI_Datatype recvtype,
MPI_Comm comm);
int MPI_Comm_get_attr(MPI_Comm comm, int comm_keyval, void **attribute_val,
int *flag);
/* ---------------------------------------------------------------------- */
#endif