Skip to content
Snippets Groups Projects
Commit b59b76a1 authored by Sergey Kosukhin's avatar Sergey Kosukhin
Browse files

Run additional check for the external32 packing at the configure stage.

parent 62e2d0d8
No related branches found
No related tags found
No related merge requests found
test_mpi_pack_external_1.txt
\ No newline at end of file
/* This test checks whether the MPI library supports external32 packing
of the types transfered by YAC (see definition of get_mpi_datatype
in ../../src/communicator_mpi.c) */
#include <stdint.h>
#include <limits.h>
#include <mpi.h>
#include <stdio.h>
char buf[100]; // should be enough to keep all the packed variables
MPI_Aint position = 0;
#define PACK_EXTERNAL(mpi_type) printf("Packing " #mpi_type "\n"); MPI_Pack_external("external32", &mpi_type ## _var, 1, mpi_type, buf, sizeof(buf), &position);
double MPI_DOUBLE_var;
unsigned int MPI_UNSIGNED_var;
signed int MPI_INT_var;
unsigned char MPI_BYTE_var;
char MPI_CHAR_var;
char MPI_PACKED_var;
#if SIZE_MAX == UCHAR_MAX
unsigned char SIZE_T_var;
# define SIZE_T MPI_UNSIGNED_CHAR
#elif SIZE_MAX == USHRT_MAX
unsigned short SIZE_var;
# define SIZE_T MPI_UNSIGNED_SHORT
#elif SIZE_MAX == UINT_MAX
unsigned int SIZE_T_var;
# define SIZE_T MPI_UNSIGNED
#elif SIZE_MAX == ULONG_MAX
unsigned long SIZE_T_var;
# define SIZE_T MPI_UNSIGNED_LONG
#elif SIZE_MAX == ULLONG_MAX
unsigned long long SIZE_T_var;
# define SIZE_T MPI_UNSIGNED_LONG_LONG
#else
# error "Unknown SIZE_MAX."
#endif
int main(int argc, char *argv[])
{
MPI_Init(&argc, &argv);
PACK_EXTERNAL(MPI_DOUBLE)
PACK_EXTERNAL(MPI_UNSIGNED)
PACK_EXTERNAL(MPI_INT)
PACK_EXTERNAL(MPI_BYTE)
PACK_EXTERNAL(MPI_CHAR)
PACK_EXTERNAL(MPI_PACKED)
PACK_EXTERNAL(SIZE_T)
MPI_Finalize();
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment