Skip to content

Commit

Permalink
mpi: make functions starpu_mpi_exchange_data_before_execution() and s…
Browse files Browse the repository at this point in the history
…tarpu_mpi_exchange_data_before_execution(() public
  • Loading branch information
nfurmento committed Jan 31, 2025
1 parent 565ac88 commit bd436eb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
17 changes: 17 additions & 0 deletions mpi/include/starpu_mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,23 @@ int starpu_mpi_task_exchange_data_before_execution(MPI_Comm comm, struct starpu_
*/
int starpu_mpi_task_exchange_data_after_execution(MPI_Comm comm, struct starpu_data_descr *descrs, unsigned nb_data, struct starpu_mpi_task_exchange_params params);

/**
Send \p data from node \p me to the node who is going to execute
the task.
This function should normally only be called by
starpu_mpi_task_exchange_data_before_execution(). Please be careful
when calling it directly.
*/
int starpu_mpi_exchange_data_before_execution(MPI_Comm comm, starpu_data_handle_t data, enum starpu_data_access_mode mode, struct starpu_mpi_task_exchange_params params);

/**
Receive \p data from the node who executed the task.
This function should normally only be called by
starpu_mpi_task_exchange_data_after_execution(). Please be careful
when calling it directly.
*/
int starpu_mpi_exchange_data_after_execution(MPI_Comm comm, starpu_data_handle_t data, enum starpu_data_access_mode mode, struct starpu_mpi_task_exchange_params params);

/**
Transfer data \p data_handle to MPI node \p node, sending it from
its owner if needed. At least the target node and the owner have to
Expand Down
15 changes: 14 additions & 1 deletion mpi/src/starpu_mpi_task_insert.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ int _starpu_mpi_find_executee_node(starpu_data_handle_t data, enum starpu_data_a
return 0;
}

int starpu_mpi_exchange_data_before_execution(MPI_Comm comm, starpu_data_handle_t data, enum starpu_data_access_mode mode, struct starpu_mpi_task_exchange_params params)
{
int me;
starpu_mpi_comm_rank(comm, &me);
return _starpu_mpi_exchange_data_before_execution(data, mode, me, params.xrank, params.do_execute, params.priority, comm);
}

int _starpu_mpi_exchange_data_before_execution(starpu_data_handle_t data, enum starpu_data_access_mode mode, int me, int xrank, int do_execute, int prio, MPI_Comm comm)
{
if (data && data->mpi_data)
Expand Down Expand Up @@ -184,7 +191,6 @@ int _starpu_mpi_exchange_data_before_execution(starpu_data_handle_t data, enum s
return 0;
}

static
int _starpu_mpi_exchange_data_after_execution(starpu_data_handle_t data, enum starpu_data_access_mode mode, int me, int xrank, int do_execute, int prio, MPI_Comm comm)
{
if ((mode & STARPU_REDUX || mode & STARPU_MPI_REDUX) && data)
Expand Down Expand Up @@ -259,6 +265,13 @@ int _starpu_mpi_exchange_data_after_execution(starpu_data_handle_t data, enum st
return 0;
}

int starpu_mpi_exchange_data_after_execution(MPI_Comm comm, starpu_data_handle_t data, enum starpu_data_access_mode mode, struct starpu_mpi_task_exchange_params params)
{
int me;
starpu_mpi_comm_rank(comm, &me);
return _starpu_mpi_exchange_data_after_execution(data, mode, me, params.xrank, params.do_execute, params.priority, comm);
}

static
void _starpu_mpi_clear_data_after_execution(starpu_data_handle_t data, enum starpu_data_access_mode mode, int me, int do_execute)
{
Expand Down

0 comments on commit bd436eb

Please sign in to comment.