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

Add `fmpi_ctx` as a parameter to `fmpi_data_{1,2,3}d`

parent cb94935d
Branches
No related tags found
No related merge requests found
......@@ -35,8 +35,8 @@ int main(int argc, char * argv[])
0,0,0,0,0,0,0,17,
};
T out = 0;
struct fmpi_data data_in = fmpi_data_1d(in, 64);
struct fmpi_data data_out = fmpi_data_1d(&out, 1);
struct fmpi_data data_in = fmpi_data_1d(ctx, in, 64);
struct fmpi_data data_out = fmpi_data_1d(ctx, &out, 1);
struct fmpi_task_args array_sum_args = {
.in = {data_in},
.out = data_out,
......
......@@ -72,8 +72,8 @@ typedef struct fmpi_data {
* TODO
* }
*/
#define fmpi_data_1d(data, x) \
FMPI_GENERIC_FUNC(data, data_1d, FMPI_DATA_TYPES)(data, x, 0, 0)
#define fmpi_data_1d(ctx, data, x) \
FMPI_GENERIC_FUNC(data, data_1d, FMPI_DATA_TYPES)(ctx, data, x, 0, 0)
/*------------------------------------------------------------------------------
fmpi_data_2d()
------------------------------------------------------------------------------*/
......@@ -92,8 +92,8 @@ typedef struct fmpi_data {
* TODO
* }
*/
#define fmpi_data_2d(data, x, y) \
FMPI_GENERIC_FUNC(data, data_2d, FMPI_DATA_TYPES)(data, x, y, 0)
#define fmpi_data_2d(ctx, data, x, y) \
FMPI_GENERIC_FUNC(data, data_2d, FMPI_DATA_TYPES)(ctx, data, x, y, 0)
/*------------------------------------------------------------------------------
fmpi_data_3d()
------------------------------------------------------------------------------*/
......@@ -113,8 +113,8 @@ typedef struct fmpi_data {
* TODO
* }
*/
#define fmpi_data_3d(data, x, y, z) \
FMPI_GENERIC_FUNC(data, data_3d, FMPI_DATA_TYPES)(data, x, y, z)
#define fmpi_data_3d(ctx, data, x, y, z) \
FMPI_GENERIC_FUNC(data, data_3d, FMPI_DATA_TYPES)(ctx, data, x, y, z)
/*==============================================================================
GUARD
==============================================================================*/
......
......@@ -33,11 +33,15 @@
/*==============================================================================
MACRO
==============================================================================*/
struct fmpi_ctx;
#define FMPI_DATA_TYPES \
FMPI_TYPE_REAL
#define FMPI_DATA_DECLARATION(D, T) \
struct fmpi_data fmpi_data_##D##d_##T(T * data, size_t x, size_t y, size_t z)
struct fmpi_data fmpi_data_##D##d_##T( \
const struct fmpi_ctx * ctx, T * data, size_t x, size_t y, size_t z \
)
FMPI_DECLARE_DIM_FUNCS(FMPI_DATA_DECLARATION, 1, FMPI_DATA_TYPES);
FMPI_DECLARE_DIM_FUNCS(FMPI_DATA_DECLARATION, 2, FMPI_DATA_TYPES);
......
......@@ -27,6 +27,7 @@
#include <assert.h>
#include <stddef.h> // NULL, size_t
// Internal
#include "internal/fmpi_futhark.h"
#include "internal/generic/fmpi_type.h"
/*==============================================================================
PRIVATE FUNCTION DECLARATION
......@@ -39,7 +40,7 @@ static struct fmpi_data fmpi_data_create(
==============================================================================*/
#define FMPI_DATA_DEFINITION(D, T) \
struct fmpi_data fmpi_data_##D##d_##T( \
T * const data, const size_t x, const size_t y, const size_t z \
const struct fmpi_ctx * const ctx, T * const data, const size_t x, const size_t y, const size_t z \
){ \
assert(data != NULL); \
return fmpi_data_create(data, FMPI_TYPE_##T, D, x, y, z); \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment