diff --git a/include/internal/generic/fmpi_futhark_generic.h b/include/internal/generic/fmpi_futhark_generic.h
index 8b7bc084448270ff258900e9b04296517ae232d6..f860bafe059ae8dbe77cb6bdaf709cb6b3bfd72c 100644
--- a/include/internal/generic/fmpi_futhark_generic.h
+++ b/include/internal/generic/fmpi_futhark_generic.h
@@ -33,7 +33,7 @@
 /*==============================================================================
     MACRO
 ==============================================================================*/
-struct fmpi_ctx;
+struct fmpi_futhark_ctx;
 
 #define FMPI_FUTHARK_TYPES \
     FMPI_TYPE_REAL
@@ -63,10 +63,10 @@ struct fmpi_ctx;
 
 #define FMPI_FUTHARK_DECLARATION(D, T) \
 struct futhark_##T##_##D##d * fmpi_futhark_new_##D##d_##T( \
-    const struct fmpi_ctx * ctx, const T * array, size_t x, size_t y, size_t z \
+    const struct fmpi_futhark_ctx * ctx, const T * array, size_t x, size_t y, size_t z \
 ); \
 void fmpi_futhark_free_##D##d_##T( \
-    const struct fmpi_ctx * ctx, struct futhark_##T##_##D##d * array \
+    const struct fmpi_futhark_ctx * ctx, struct futhark_##T##_##D##d * array \
 )
 
 FMPI_DECLARE_DIM_FUNCS(FMPI_FUTHARK_DECLARATION, 1, FMPI_FUTHARK_TYPES);
diff --git a/src/fmpi_data.c b/src/fmpi_data.c
index 217cf6634d47b2c7bb00a875194a7bf97fa0a378..ce3544c1886d70643d88b591f5c6d9f488aeffe5 100644
--- a/src/fmpi_data.c
+++ b/src/fmpi_data.c
@@ -29,6 +29,7 @@
 #include <stdio.h>  // fprintf()
 #include <stdlib.h> // malloc()
 // Internal
+#include "internal/fmpi_ctx.h"
 #include "internal/fmpi_futhark.h"
 #include "internal/generic/fmpi_type.h"
 /*==============================================================================
@@ -56,7 +57,7 @@ struct fmpi_data fmpi_data_##D##d_in_new_##T( \
     assert(ctx != NULL); \
     assert(data != NULL); \
     _Static_assert(D <= 3, ""); \
-    struct futhark_##T##_##D##d * const start = fmpi_futhark_new_##D##d_##T(ctx, data, 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, \
         .dims_length = {x, y, z}, \
diff --git a/src/fmpi_futhark.c b/src/fmpi_futhark.c
index eabd518c32823ba54c8a4f56dc28500b0a6a4287..f5a23bdfcc9753ec2b8bb10dcf1c5d6d8ffc0d09 100644
--- a/src/fmpi_futhark.c
+++ b/src/fmpi_futhark.c
@@ -130,26 +130,26 @@ _Bool fmpi_futhark_check_error(
 
 #define FMPI_FUTHARK_DEFINITION(D, T) \
 struct futhark_##T##_##D##d * fmpi_futhark_new_##D##d_##T( \
-    const struct fmpi_ctx * const ctx, const T * const array, size_t x, size_t y, size_t z \
+    const struct fmpi_futhark_ctx * const ctx, const T * const array, size_t x, size_t y, size_t z \
 ){ \
     assert(ctx != NULL); \
     assert(array != NULL); \
-    struct futhark_##T##_##D##d * data = FMPI_FUTHARK_NEW_##D(D, T, ctx->fut->ctx, array, x, y, z); \
+    struct futhark_##T##_##D##d * data = FMPI_FUTHARK_NEW_##D(D, T, ctx->ctx, array, x, y, z); \
     if(data == NULL) { \
-        fmpi_futhark_check_error(ctx->fut, CPL_STRINGIFY(futhark_new_##T##_##D##d)); \
+        fmpi_futhark_check_error(ctx, CPL_STRINGIFY(futhark_new_##T##_##D##d)); \
     } \
-    fmpi_futhark_sync(ctx->fut); \
+    fmpi_futhark_sync(ctx); \
     return data; \
 }\
 void fmpi_futhark_free_##D##d_##T( \
-    const struct fmpi_ctx * const ctx, struct futhark_##T##_##D##d * const array \
+    const struct fmpi_futhark_ctx * const ctx, struct futhark_##T##_##D##d * const array \
 ){ \
     assert(ctx != NULL); \
     assert(array != NULL); \
-    fmpi_futhark_sync(ctx->fut);\
-    const int err = futhark_free_##T##_##D##d(ctx->fut->ctx, array); \
+    fmpi_futhark_sync(ctx);\
+    const int err = futhark_free_##T##_##D##d(ctx->ctx, array); \
     if(err != 0) { \
-        fmpi_futhark_check_error(ctx->fut, CPL_STRINGIFY(futhark_free_##T##_##D##d)); \
+        fmpi_futhark_check_error(ctx, CPL_STRINGIFY(futhark_free_##T##_##D##d)); \
     } \
 }
 
diff --git a/src/fmpi_reduce.c b/src/fmpi_reduce.c
index b81ffeadbceeeb892bba83250b86dda42059b626..3c0936ec763fad1a5a177d88445802dc39fffd64 100644
--- a/src/fmpi_reduce.c
+++ b/src/fmpi_reduce.c
@@ -46,14 +46,14 @@ T fmpi_local_reduce_prod_##T( \
 ){ \
     assert(ctx != NULL); \
     assert(array != NULL); \
-    struct futhark_##T##_1d * data = fmpi_futhark_new_1d_##T(ctx, array, length, 0, 0);\
+    struct futhark_##T##_1d * data = fmpi_futhark_new_1d_##T(ctx->fut, array, length, 0, 0);\
     T result = FMPI_TYPE_DEFAULT_##T; \
     const int err = futhark_entry_reduce_prod_##T(ctx->fut->ctx, &result, data); \
     if(err != 0) { \
         fmpi_futhark_check_error(ctx->fut, CPL_STRINGIFY(futhark_entry_reduce_prod_##T)); \
     } \
     fmpi_futhark_sync(ctx->fut); \
-    fmpi_futhark_free_1d_##T(ctx, data); \
+    fmpi_futhark_free_1d_##T(ctx->fut, data); \
     return result; \
 }\
 T fmpi_reduce_prod_##T(const struct fmpi_ctx * const ctx, const T * const array) \