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

Add `fmpi_run_task()`

parent 3d7c9d31
Branches
Tags
No related merge requests found
...@@ -36,7 +36,7 @@ int main(int argc, char * argv[]) ...@@ -36,7 +36,7 @@ int main(int argc, char * argv[])
fmpi_data_out(ctx, &out), fmpi_data_out(ctx, &out),
fmpi_data_1d_in(ctx, in, in_size) fmpi_data_1d_in(ctx, in, in_size)
); );
fmpi_task_run_sync(ctx, &array_sum_task); fmpi_run_task(ctx, &array_sum_task);
printf("rank=%d sum=%ld\n", fmpi_world_rank(ctx), out); printf("rank=%d sum=%ld\n", fmpi_world_rank(ctx), out);
fmpi_exit(&ctx); fmpi_exit(&ctx);
return EXIT_SUCCESS; return EXIT_SUCCESS;
......
...@@ -126,6 +126,10 @@ int fmpi_world_rank(const struct fmpi_ctx * ctx); ...@@ -126,6 +126,10 @@ int fmpi_world_rank(const struct fmpi_ctx * ctx);
fmpi_world_barrier() fmpi_world_barrier()
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
int fmpi_world_barrier(const struct fmpi_ctx * ctx); int fmpi_world_barrier(const struct fmpi_ctx * ctx);
/*------------------------------------------------------------------------------
fmpi_run_task()
------------------------------------------------------------------------------*/
int fmpi_run_task(const struct fmpi_ctx * ctx, const struct fmpi_task * task);
/*============================================================================== /*==============================================================================
MACRO MACRO
==============================================================================*/ ==============================================================================*/
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <stdio.h> // fprintf() #include <stdio.h> // fprintf()
#include <stdlib.h> // NULL, abort() #include <stdlib.h> // NULL, abort()
// Internal // Internal
#include "fmpi_task.h"
#include "internal/fmpi_ctx.h" #include "internal/fmpi_ctx.h"
#include "internal/fmpi_error.h" #include "internal/fmpi_error.h"
#include "internal/fmpi_mpi.h" #include "internal/fmpi_mpi.h"
...@@ -94,3 +95,16 @@ int fmpi_world_barrier(const struct fmpi_ctx * const ctx) ...@@ -94,3 +95,16 @@ int fmpi_world_barrier(const struct fmpi_ctx * const ctx)
} }
return err_id; return err_id;
} }
/*------------------------------------------------------------------------------
fmpi_run_task()
------------------------------------------------------------------------------*/
int fmpi_run_task(
const struct fmpi_ctx * const ctx, const struct fmpi_task * const task
){
assert(ctx != NULL);
assert(task != NULL);
if(task->type == FMPI_TASK_TYPE_SYNC) {
return fmpi_task_run_sync(ctx, task);
}
return fmpi_task_run_async(ctx, task);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment