diff --git a/src/engine.c b/src/engine.c index c9a1de94cf8ddc2accc7049fd0ca232e5c650ebf..d2b861b49d71a61171e19b1b3eb7f6dce4d2a101 100644 --- a/src/engine.c +++ b/src/engine.c @@ -217,11 +217,11 @@ void engine_redistribute(struct engine *e) { offset_recv += counts[ind_recv]; } else { if (MPI_Isend(&s->parts[offset_send], counts[ind_send], - *(e->part_mpi_type), k, 2 * ind_send + 0, MPI_COMM_WORLD, + e->part_mpi_type, k, 2 * ind_send + 0, MPI_COMM_WORLD, &reqs[4 * k]) != MPI_SUCCESS) error("Failed to isend parts to node %i.", k); if (MPI_Isend(&s->xparts[offset_send], counts[ind_send], - *(e->xpart_mpi_type), k, 2 * ind_send + 1, MPI_COMM_WORLD, + e->xpart_mpi_type, k, 2 * ind_send + 1, MPI_COMM_WORLD, &reqs[4 * k + 1]) != MPI_SUCCESS) error("Failed to isend xparts to node %i.", k); offset_send += counts[ind_send]; @@ -229,11 +229,11 @@ void engine_redistribute(struct engine *e) { } if (k != nodeID && counts[ind_recv] > 0) { if (MPI_Irecv(&parts_new[offset_recv], counts[ind_recv], - *(e->part_mpi_type), k, 2 * ind_recv + 0, MPI_COMM_WORLD, + e->part_mpi_type, k, 2 * ind_recv + 0, MPI_COMM_WORLD, &reqs[4 * k + 2]) != MPI_SUCCESS) error("Failed to emit irecv of parts from node %i.", k); if (MPI_Irecv(&xparts_new[offset_recv], counts[ind_recv], - *(e->xpart_mpi_type), k, 2 * ind_recv + 1, MPI_COMM_WORLD, + e->xpart_mpi_type, k, 2 * ind_recv + 1, MPI_COMM_WORLD, &reqs[4 * k + 3]) != MPI_SUCCESS) error("Failed to emit irecv of parts from node %i.", k); offset_recv += counts[ind_recv]; @@ -2201,8 +2201,8 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads, /* Construct types for MPI communications */ #ifdef WITH_MPI - part_create_mpi_type(e->part_mpi_type); - xpart_create_mpi_type(e->xpart_mpi_type); + part_create_mpi_type(&e->part_mpi_type); + xpart_create_mpi_type(&e->xpart_mpi_type); #endif /* First of all, init the barrier and lock it. */ diff --git a/src/engine.h b/src/engine.h index 4ab86288a04fc18b6236a6c44a048a01314a088d..017455dc7da812f20703686e5d6b4715862546f1 100644 --- a/src/engine.h +++ b/src/engine.h @@ -134,9 +134,11 @@ struct engine { struct link *links; int nr_links, size_links; +#ifdef WITH_MPI /* MPI data type for the particle transfers */ - MPI_Datatype *part_mpi_type; - MPI_Datatype *xpart_mpi_type; + MPI_Datatype part_mpi_type; + MPI_Datatype xpart_mpi_type; +#endif }; /* Function prototypes. */