- if (rank == root)
- send = smpi_get_tmp_sendbuffer(send_sum * MPI_CURRENT_TYPE2->size());
-
- std::vector<int>* trace_sendcounts = new std::vector<int>(sendcounts, sendcounts + comm_size);
-
- TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
- "gatherV", root, -1, trace_sendcounts, recv_size, nullptr,
- encode_datatype(MPI_CURRENT_TYPE), encode_datatype(MPI_CURRENT_TYPE2)));
-
- Colls::scatterv(send, sendcounts, disps, MPI_CURRENT_TYPE, recv, recv_size, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
-
- TRACE_smpi_comm_out(Actor::self()->getPid());
- log_timed_action(action, clock);
-}
-
-static void action_reducescatter(const char *const *action) {
- /* The structure of the reducescatter action for the rank 0 (total 4 processes) is the following:
- 0 reduceScatter 275427 275427 275427 204020 11346849 0
- where:
- 1) The first four values after the name of the action declare the recvcounts array
- 2) The value 11346849 is the amount of instructions
- 3) The last value corresponds to the datatype, see decode_datatype().
-*/
- double clock = smpi_process()->simulated_elapsed();
- int comm_size = MPI_COMM_WORLD->size();
- CHECK_ACTION_PARAMS(action, comm_size+1, 1)
- int comp_size = parse_double(action[2+comm_size]);
- int recvcounts[comm_size];
- int my_proc_id = Actor::self()->getPid();
- int size = 0;
- std::vector<int>* trace_recvcounts = new std::vector<int>;
- MPI_CURRENT_TYPE = (action[3 + comm_size]) ? decode_datatype(action[3 + comm_size]) : MPI_DEFAULT_TYPE;
-
- for(int i=0;i<comm_size;i++) {
- recvcounts[i] = atoi(action[i+2]);
- trace_recvcounts->push_back(recvcounts[i]);
- size+=recvcounts[i];
- }
-
- TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
- new simgrid::instr::VarCollTIData("reduceScatter", -1, 0, nullptr, -1, trace_recvcounts,
- std::to_string(comp_size), /* ugly hack to print comp_size */
- encode_datatype(MPI_CURRENT_TYPE)));
-
- void *sendbuf = smpi_get_tmp_sendbuffer(size* MPI_CURRENT_TYPE->size());
- void *recvbuf = smpi_get_tmp_recvbuffer(size* MPI_CURRENT_TYPE->size());
-
- Colls::reduce_scatter(sendbuf, recvbuf, recvcounts, MPI_CURRENT_TYPE, MPI_OP_NULL, MPI_COMM_WORLD);
- smpi_execute_flops(comp_size);