diff --git a/include/internal/fmpi_futhark.h b/include/internal/fmpi_futhark.h index 99673c43496cacccca23bbe9306b4f69ab1499ee..c87d0a0a7193e885158ff6e26ec864d6393da7f6 100644 --- a/include/internal/fmpi_futhark.h +++ b/include/internal/fmpi_futhark.h @@ -139,6 +139,13 @@ void * fmpi_futhark_get_data_sync( const struct fmpi_futhark_ctx * ctx, void * in, void * out, enum fmpi_type_base type, size_t dim_cnt ); +/*------------------------------------------------------------------------------ + fmpi_futhark_get_data_async() +------------------------------------------------------------------------------*/ +void * fmpi_futhark_get_data_async( + const struct fmpi_futhark_ctx * ctx, void * in, void * out, + enum fmpi_type_base type, size_t dim_cnt +); /*============================================================================== MACRO ==============================================================================*/ diff --git a/src/fmpi_futhark.c b/src/fmpi_futhark.c index 112a8eaaf7403aaa6dad62f3a3618d86bfd9c5a1..991d4dfaa3a24b330c86ec1828156472d128081f 100644 --- a/src/fmpi_futhark.c +++ b/src/fmpi_futhark.c @@ -161,7 +161,7 @@ void * fmpi_futhark_new_data( return fmpi_futhark_new_data_func_list[idx](ctx, data, x, y, z); } /*------------------------------------------------------------------------------ - fmpi_futhark_get_data() + fmpi_futhark_get_data_sync() ------------------------------------------------------------------------------*/ void * fmpi_futhark_get_data_sync( const struct fmpi_futhark_ctx * const ctx, void * const in, void * const out, @@ -183,6 +183,25 @@ void * fmpi_futhark_get_data_sync( } return out; } +/*------------------------------------------------------------------------------ + fmpi_futhark_get_data_async() +------------------------------------------------------------------------------*/ +void * fmpi_futhark_get_data_async( + const struct fmpi_futhark_ctx * const ctx, void * const in, void * const out, + const enum fmpi_type_base type, const size_t dim_cnt +){ + assert(ctx != NULL); + assert(in != NULL); + assert(out != NULL); + assert(dim_cnt <= FMPI_DIM_MAX); + const size_t idx = FMPI_PRIV_FUTHARK_FUNC_IDX(dim_cnt, type); + const int err = fmpi_futhark_get_data_func_list[idx](ctx, in, out); + if(err != FUTHARK_SUCCESS) { + FMPI_RAISE_FUTHARK_ERROR(ctx, "futhark_values_##T##_##D##d() failed!"); + return NULL; + } + return out; +} #define FMPI_FUTHARK_DEFINITION(D, T) \ void * fmpi_futhark_new_##D##d_##T( \