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

Add array of `fmpi_domain` to `fmpi_task`

parent c58faaa3
No related branches found
No related tags found
No related merge requests found
......@@ -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
);
/*------------------------------------------------------------------------------
......
......@@ -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), \
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment