Skip to content
Snippets Groups Projects
Commit 40b2e1fc authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Undo last commit

parent 0883c5a2
No related branches found
No related tags found
No related merge requests found
...@@ -323,6 +323,40 @@ void proxy_cells_exchange_first_mapper(void *map_data, int num_elements, ...@@ -323,6 +323,40 @@ void proxy_cells_exchange_first_mapper(void *map_data, int num_elements,
} }
} }
struct unpack_mapper_data {
struct space *s;
const int with_gravity;
MPI_Request *reqs_in;
struct proxy *proxies;
};
void proxy_cells_wait_and_unpack_mapper(void *map_data, int num_elements,
void *extra_data) {
MPI_Request *reqs = (MPI_Request *)map_data;
struct unpack_mapper_data *data = (struct unpack_mapper_data *)extra_data;
struct space *s = data->s;
const int with_gravity = data->with_gravity;
MPI_Request *reqs_in = data->reqs_in;
struct proxy *proxies = data->proxies;
for (int k = 0; k < num_elements; ++k) {
/* Wait for the data to arrive */
MPI_Status status;
if (MPI_Wait(&reqs[k], &status) != MPI_SUCCESS) error("MPI_Wait failed!");
const int i = &reqs[k] - reqs_in;
/* Un-pack the cells received in this proxy */
int count = 0;
for (int j = 0; j < proxies[i].nr_cells_in; j++)
count += cell_unpack(&proxies[i].pcells_in[count], proxies[i].cells_in[j],
s, with_gravity);
}
}
#endif // WITH_MPI #endif // WITH_MPI
/** /**
...@@ -417,18 +451,12 @@ void proxy_cells_exchange(struct proxy *proxies, int num_proxies, ...@@ -417,18 +451,12 @@ void proxy_cells_exchange(struct proxy *proxies, int num_proxies,
tic2 = getticks(); tic2 = getticks();
/* Wait for each pcell array to come in from the proxies. */ /* Wait for each pcell array to come in from the proxies
for (int k = 0; k < num_proxies; k++) { * and unpack the cells. */
int pid = MPI_UNDEFINED; struct unpack_mapper_data unpack_data = {s, with_gravity, reqs_in, proxies};
MPI_Status status; threadpool_map(&s->e->threadpool, proxy_cells_wait_and_unpack_mapper, reqs_in,
if (MPI_Waitany(num_proxies, reqs_in, &pid, &status) != MPI_SUCCESS || num_proxies, sizeof(MPI_Request), /*chunk_size=*/1,
pid == MPI_UNDEFINED) /*extra_data=*/&unpack_data);
error("MPI_Waitany failed.");
// message( "cell data from proxy %i has arrived." , pid );
for (int count = 0, j = 0; j < proxies[pid].nr_cells_in; j++)
count += cell_unpack(&proxies[pid].pcells_in[count],
proxies[pid].cells_in[j], s, with_gravity);
}
if (s->e->verbose) if (s->e->verbose)
message("Un-packing cells took %.3f %s.", message("Un-packing cells took %.3f %s.",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment