Commit a1f2133c authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added multipole communication tasks.

parent 3aec2f61
......@@ -27,6 +27,7 @@
/* This object's header. */
#include "error.h"
#include "multipole.h"
#include "part.h"
/**
......@@ -233,6 +234,7 @@ MPI_Datatype part_mpi_type;
MPI_Datatype xpart_mpi_type;
MPI_Datatype gpart_mpi_type;
MPI_Datatype spart_mpi_type;
MPI_Datatype multipole_mpi_type;
/**
* @brief Registers MPI particle types.
......@@ -265,5 +267,10 @@ void part_create_mpi_types() {
MPI_Type_commit(&spart_mpi_type) != MPI_SUCCESS) {
error("Failed to create MPI type for sparts.");
}
if (MPI_Type_contiguous(sizeof(struct multipole) / sizeof(unsigned char),
MPI_BYTE, &multipole_mpi_type) != MPI_SUCCESS ||
MPI_Type_commit(&multipole_mpi_type) != MPI_SUCCESS) {
error("Failed to create MPI type for multipole.");
}
}
#endif
......@@ -86,6 +86,7 @@ extern MPI_Datatype part_mpi_type;
extern MPI_Datatype xpart_mpi_type;
extern MPI_Datatype gpart_mpi_type;
extern MPI_Datatype spart_mpi_type;
extern MPI_Datatype multipole_mpi_type;
void part_create_mpi_types();
#endif
......
......@@ -1786,6 +1786,8 @@ void *runner_main(void *data) {
runner_do_recv_gpart(r, ci, 1);
} else if (t->subtype == task_subtype_spart) {
runner_do_recv_spart(r, ci, 1);
} else if (t->subtype == task_subtype_multipole) {
ci->ti_old_multipole = e->ti_current;
} else {
error("Unknown/invalid task subtype (%d).", t->subtype);
}
......
......@@ -1220,6 +1220,9 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
} else if (t->subtype == task_subtype_spart) {
err = MPI_Irecv(t->ci->sparts, t->ci->scount, spart_mpi_type,
t->ci->nodeID, t->flags, MPI_COMM_WORLD, &t->req);
} else if (t->subtype == task_subtype_multipole) {
err = MPI_Irecv(t->ci->multipole, 1, multipole_mpi_type,
t->ci->nodeID, t->flags, MPI_COMM_WORLD, &t->req);
} else {
error("Unknown communication sub-type");
}
......@@ -1257,6 +1260,9 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
} else if (t->subtype == task_subtype_spart) {
err = MPI_Isend(t->ci->sparts, t->ci->scount, spart_mpi_type,
t->cj->nodeID, t->flags, MPI_COMM_WORLD, &t->req);
} else if (t->subtype == task_subtype_multipole) {
err = MPI_Isend(t->ci->multipole, 1, multipole_mpi_type,
t->cj->nodeID, t->flags, MPI_COMM_WORLD, &t->req);
} else {
error("Unknown communication sub-type");
}
......
......@@ -69,9 +69,10 @@ const char *taskID_names[task_type_count] = {"none",
"cooling",
"sourceterms"};
/* Sub-task type names. */
const char *subtaskID_names[task_subtype_count] = {
"none", "density", "gradient", "force", "grav", "external_grav",
"tend", "xv", "rho", "gpart", "spart"};
"tend", "xv", "rho", "gpart", "multipole", "spart"};
/**
* @brief Computes the overlap between the parts array of two given cells.
......
......@@ -74,6 +74,7 @@ enum task_subtypes {
task_subtype_xv,
task_subtype_rho,
task_subtype_gpart,
task_subtype_multipole,
task_subtype_spart,
task_subtype_count
} __attribute__((packed));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment