diff --git a/include/fmpi_task.h b/include/fmpi_task.h index 85ff21b9e2dbdc510d0c86e708ce6f36ba2fb2fc..f13eba125e22e8007003e08fbccf66d509aeb06d 100644 --- a/include/fmpi_task.h +++ b/include/fmpi_task.h @@ -27,10 +27,10 @@ INCLUDE ==============================================================================*/ // C Standard Library -#include <stddef.h> +#include <stddef.h> // size_t // Internal #include "fmpi_data.h" -#include "internal/fmpi_ctx.h" +#include "fmpi_domain.h" #include "internal/fmpi_futhark.h" #include "internal/generic/fmpi_task_generic.h" /*============================================================================== @@ -93,6 +93,7 @@ typedef void (*fmpi_task_func)( typedef struct fmpi_task { fmpi_task_func func; //!< TODO struct fmpi_task_args args; //!< TODO + struct fmpi_domain domains[FMPI_TASK_ARGS_CNT_MAX]; //!< TODO } fmpi_task; /*============================================================================== PUBLIC FUNCTION @@ -119,7 +120,7 @@ typedef struct fmpi_task { * } */ struct fmpi_task fmpi_task_register( - const struct fmpi_ctx * ctx, const fmpi_task_func func, + struct fmpi_ctx * ctx, const fmpi_task_func func, const struct fmpi_task_args * args ); /*------------------------------------------------------------------------------ diff --git a/src/fmpi_data.c b/src/fmpi_data.c index 97ffa1dd96e2f840518b00561e72bff9d6d7c062..dc53ee764668963c968f11654be6759f95a599b5 100644 --- a/src/fmpi_data.c +++ b/src/fmpi_data.c @@ -64,7 +64,6 @@ struct fmpi_data fmpi_data_##D##d_in_new_##T( \ assert(ctx != NULL); \ assert(data != NULL); \ const size_t cnt = (x * y * z); \ - struct futhark_##T##_##D##d * const start = fmpi_futhark_new_##D##d_##T(ctx->fut, data, x, y, z); \ return (struct fmpi_data){ \ .type = FMPI_TYPE_##T, \ .type_size = sizeof(T), \ diff --git a/src/fmpi_task.c b/src/fmpi_task.c index ee5791335872df0cd09615398aa31efd4633cb9d..91d40878fd5c3555b081820f0627cc0432f4499e 100644 --- a/src/fmpi_task.c +++ b/src/fmpi_task.c @@ -27,8 +27,12 @@ #include <assert.h> #include <stdint.h> // int64_t // Internal +#include "fmpi_domain.h" +#include "internal/fmpi_ctx.h" #include "internal/fmpi_futhark.h" #include "internal/fmpi_futhark_entry.h" +#include "internal/fmpi_mpi.h" +#include "internal/generic/fmpi_type.h" /*============================================================================== PUBLIC FUNCTION DEFINITION ==============================================================================*/ @@ -36,14 +40,27 @@ fmpi_task_run() ------------------------------------------------------------------------------*/ struct fmpi_task fmpi_task_register( - const struct fmpi_ctx * const ctx, const fmpi_task_func func, + struct fmpi_ctx * const ctx, const fmpi_task_func func, const struct fmpi_task_args * const args ){ assert(ctx != NULL); + assert(args != NULL); struct fmpi_task task = { .func = func, .args = *args }; + const size_t rank = (size_t)ctx->mpi->rank; + for(size_t i = 0; i < task.args.cnt; i++) { + task.domains[i] = fmpi_new_domain(ctx, args->in[i]); + void * start = fmpi_futhark_new_data( + ctx->fut, task.domains[i].parts[rank].start, task.domains[i].data.type, + task.domains[i].data.dim_cnt, + task.domains[i].parts[rank].dim_len[0], + task.domains[i].parts[rank].dim_len[1], + task.domains[i].parts[rank].dim_len[2] + ); + task.args.in[i].start = start; + } futhark_context_sync(ctx->fut->ctx); return task; }