Program listing for file numerics/src/tools/NM_MPI.h#
Return to documentation for this file
1#include "NumericsFwd.h"
2#include "SiconosConfig.h"
3
4#ifdef SICONOS_HAS_MPI
5#include <mpi.h>
6#endif
7
8#if defined(__cplusplus) && !defined(BUILD_AS_CPP)
9extern "C"
10{
11#endif
12
13#ifdef SICONOS_HAS_MPI
14MPI_Comm NM_MPI_comm(NumericsMatrix* A);
15void NM_MPI_set_comm(NumericsMatrix* A, MPI_Comm comm);
16#include <stdio.h>
17#define CHECK_MPI(COMM, EXPR) \
18 do \
19 { \
20 int error_code = EXPR; \
21 MPI_Comm_set_errhandler(COMM, MPI_ERRORS_RETURN); \
22 if (error_code != MPI_SUCCESS) { \
23 char error_string[1024]; \
24 int length_of_error_string, error_class; \
25 MPI_Error_class(error_code, &error_class); \
26 MPI_Error_string(error_class, error_string, &length_of_error_string); \
27 fprintf(stderr, "%3d: %s\n", 0, error_string); \
28 MPI_Error_string(error_code, error_string, &length_of_error_string); \
29 fprintf(stderr, "%3d: %s\n", 0, error_string); \
30 MPI_Abort(COMM, error_code); \
31 }; \
32 } while(0)
33#endif
34
35 int NM_MPI_rank(NumericsMatrix* A);
36
37 void NM_MPI_copy(const NumericsMatrix* A, NumericsMatrix* B);
38
39#if defined(__cplusplus) && !defined(BUILD_AS_CPP)
40}
41#endif