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

Add `fmpi_data_out()`

parent 40d61780
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,7 @@ int main(int argc, char * argv[])
T out = -1;
struct fmpi_task array_sum_task = FMPI_TASK_REGISTER(
ctx, array_sum, fmpi_no_stencil(),
fmpi_data_1d_out(ctx, &out, 1),
fmpi_data_out(ctx, &out),
fmpi_data_1d_in(ctx, in, in_size)
);
fmpi_task_run_sync(ctx, &array_sum_task);
......
......@@ -52,6 +52,11 @@ typedef struct fmpi_data {
/*==============================================================================
PUBLIC FUNCTION
==============================================================================*/
/*------------------------------------------------------------------------------
fmpi_data_out()
------------------------------------------------------------------------------*/
#define fmpi_data_out(ctx, data) \
FMPI_DATA_FUNC(out, data)(ctx, data)
/*------------------------------------------------------------------------------
fmpi_data_1d()
------------------------------------------------------------------------------*/
......
......@@ -42,6 +42,13 @@ struct fmpi_ctx;
#define FMPI_DATA_FUNC(func, data) \
FMPI_GENERIC_FUNC(data, data_##func, FMPI_DATA_TYPES)
#define FMPI_DATA_FUNC_DECLARATION_T(T) \
struct fmpi_data fmpi_data_out_##T( \
const struct fmpi_ctx * ctx, T * data \
)
FMPI_DECLARE_FUNCS_T(FMPI_DATA_FUNC_DECLARATION_T, FMPI_DATA_TYPES);
#define FMPI_DATA_DECLARATION(D, T) \
struct fmpi_data fmpi_data_##D##d_in_##T( \
const struct fmpi_ctx * ctx, T * data, size_t x, size_t y, size_t z \
......
......@@ -33,6 +33,28 @@
/*==============================================================================
PUBLIC FUNCTION DEFINITION
==============================================================================*/
#define FMPI_DATA_FUNC_DEFINITION_T(T) \
struct fmpi_data fmpi_data_out_##T( \
const struct fmpi_ctx * const ctx, T * const data \
){ \
assert(ctx != NULL); \
assert(data != NULL); \
return (struct fmpi_data){ \
.type = { \
.base = FMPI_TYPE_##T, \
.derived = FMPI_TYPE_NONE, \
.size = sizeof(T) \
}, \
.cnt = 1, \
.size = sizeof(T), \
.dim_len = {0, 0, 0}, \
.dim_cnt = 0, \
.start = data \
}; \
}
FMPI_DEFINE_FUNCS_T(FMPI_DATA_FUNC_DEFINITION_T, FMPI_DATA_TYPES)
#define FMPI_DATA_DEFINITION(D, T) \
struct fmpi_data fmpi_data_##D##d_in_##T( \
const struct fmpi_ctx * const ctx, T * const data, \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment