Skip to content
Snippets Groups Projects
Verified Commit e746e94c authored by raphael.bach's avatar raphael.bach
Browse files

Add `fmpi_mpi_type()`

parent a12c4aac
No related branches found
No related tags found
No related merge requests found
...@@ -27,9 +27,10 @@ ...@@ -27,9 +27,10 @@
INCLUDE INCLUDE
==============================================================================*/ ==============================================================================*/
// External // External
#include <mpi.h> // MPI_MAX_PROCESSOR_NAME #include <mpi.h> // MPI_MAX_PROCESSOR_NAME, MPI_Datatype
// Internal // Internal
#include "fmpi_error.h" #include "fmpi_error.h"
#include "internal/fmpi_type.h"
/*============================================================================== /*==============================================================================
STRUCT STRUCT
==============================================================================*/ ==============================================================================*/
...@@ -203,6 +204,10 @@ void fmpi_mpi_abort(const struct fmpi_mpi_ctx * ctx); ...@@ -203,6 +204,10 @@ void fmpi_mpi_abort(const struct fmpi_mpi_ctx * ctx);
fmpi_mpi_world_barrier() fmpi_mpi_world_barrier()
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
int fmpi_mpi_world_barrier(const struct fmpi_mpi_ctx * ctx); int fmpi_mpi_world_barrier(const struct fmpi_mpi_ctx * ctx);
/*------------------------------------------------------------------------------
fmpi_mpi_type()
------------------------------------------------------------------------------*/
MPI_Datatype fmpi_mpi_type(enum fmpi_type_base type);
/*============================================================================== /*==============================================================================
GUARD GUARD
==============================================================================*/ ==============================================================================*/
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <mpi.h> #include <mpi.h>
// Internal // Internal
#include "internal/fmpi_error.h" #include "internal/fmpi_error.h"
#include "internal/fmpi_type.h"
/*============================================================================== /*==============================================================================
DEFINE DEFINE
==============================================================================*/ ==============================================================================*/
...@@ -185,3 +186,23 @@ int fmpi_mpi_world_barrier(const struct fmpi_mpi_ctx * const ctx) ...@@ -185,3 +186,23 @@ int fmpi_mpi_world_barrier(const struct fmpi_mpi_ctx * const ctx)
} }
return err_id; return err_id;
} }
/*------------------------------------------------------------------------------
fmpi_mpi_type()
------------------------------------------------------------------------------*/
MPI_Datatype fmpi_mpi_type(const enum fmpi_type_base type)
{
const static MPI_Datatype fmpi_mpi_type_list[] = {
[FMPI_TYPE_i8] = MPI_INT8_T ,
[FMPI_TYPE_i16] = MPI_INT16_T ,
[FMPI_TYPE_i32] = MPI_INT32_T ,
[FMPI_TYPE_i64] = MPI_INT64_T ,
[FMPI_TYPE_u8] = MPI_UINT8_T ,
[FMPI_TYPE_u16] = MPI_UINT16_T,
[FMPI_TYPE_u32] = MPI_UINT32_T,
[FMPI_TYPE_u64] = MPI_UINT64_T,
[FMPI_TYPE_f32] = MPI_FLOAT ,
[FMPI_TYPE_f64] = MPI_DOUBLE ,
[FMPI_TYPE_bool] = MPI_C_BOOL
};
return fmpi_mpi_type_list[type];
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment