-/* Copyright (c) 2009-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "private.h"
-#include <xbt.h>
-#include <xbt/replay.h>
+#include "xbt/replay.h"
+#include "src/smpi/smpi_group.hpp"
#include <unordered_map>
#include <vector>
static void action_finalize(const char *const *action)
{
- /* do nothing */
+ /* Nothing to do */
}
static void action_comm_size(const char *const *action)
int rank = smpi_process_index();
- int dst_traced = smpi_group_rank(smpi_comm_group(MPI_COMM_WORLD), to);
+ int dst_traced = MPI_COMM_WORLD->group()->rank(to);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_SEND;
extra->send_size = size;
MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
int rank = smpi_process_index();
- int dst_traced = smpi_group_rank(smpi_comm_group(MPI_COMM_WORLD), to);
+ int dst_traced = MPI_COMM_WORLD->group()->rank(to);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_ISEND;
extra->send_size = size;
MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
int rank = smpi_process_index();
- int src_traced = smpi_group_rank(smpi_comm_group(MPI_COMM_WORLD), from);
+ int src_traced = MPI_COMM_WORLD->group()->rank(from);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_RECV;
MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
int rank = smpi_process_index();
- int src_traced = smpi_group_rank(smpi_comm_group(MPI_COMM_WORLD), from);
+ int src_traced = MPI_COMM_WORLD->group()->rank(from);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_IRECV;
extra->send_size = size;
return;
}
- int rank = request->comm != MPI_COMM_NULL ? smpi_comm_rank(request->comm) : -1;
+ int rank = request->comm != MPI_COMM_NULL ? request->comm->rank() : -1;
- MPI_Group group = smpi_comm_group(request->comm);
- int src_traced = smpi_group_rank(group, request->src);
- int dst_traced = smpi_group_rank(group, request->dst);
+ MPI_Group group = request->comm->group();
+ int src_traced = group->rank(request->src);
+ int dst_traced = group->rank(request->dst);
int is_wait_for_receive = request->recv;
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_WAIT;
if(action[3]) {
root= atoi(action[3]);
- if(action[4]) {
+ if(action[4])
MPI_CURRENT_TYPE=decode_datatype(action[4]);
- }
}
int rank = smpi_process_index();
- int root_traced = smpi_group_index(smpi_comm_group(MPI_COMM_WORLD), root);
+ int root_traced = MPI_COMM_WORLD->group()->index(root);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_BCAST;
if(action[4]) {
root= atoi(action[4]);
- if(action[5]) {
+ if(action[5])
MPI_CURRENT_TYPE=decode_datatype(action[5]);
- }
}
int rank = smpi_process_index();
- int root_traced = smpi_group_rank(smpi_comm_group(MPI_COMM_WORLD), root);
+ int root_traced = MPI_COMM_WORLD->group()->rank(root);
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_REDUCE;
extra->send_size = comm_size;
}
static void action_allToAll(const char *const *action) {
- CHECK_ACTION_PARAMS(action, 2, 2) //two mandatory (send and recv volumes)
- //two optional (corresponding datatypes)
+ CHECK_ACTION_PARAMS(action, 2, 2) //two mandatory (send and recv volumes) and two optional (corresponding datatypes)
double clock = smpi_process_simulated_elapsed();
- int comm_size = smpi_comm_size(MPI_COMM_WORLD);
+ int comm_size = MPI_COMM_WORLD->size();
int send_size = parse_double(action[2]);
int recv_size = parse_double(action[3]);
MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
MPI_CURRENT_TYPE=decode_datatype(action[4]);
MPI_CURRENT_TYPE2=decode_datatype(action[5]);
}
- else{
+ else
MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
- }
void *send = smpi_get_tmp_sendbuffer(send_size*comm_size* smpi_datatype_size(MPI_CURRENT_TYPE));
void *recv = smpi_get_tmp_recvbuffer(recv_size*comm_size* smpi_datatype_size(MPI_CURRENT_TYPE2));
*/
CHECK_ACTION_PARAMS(action, 2, 3)
double clock = smpi_process_simulated_elapsed();
- int comm_size = smpi_comm_size(MPI_COMM_WORLD);
+ int comm_size = MPI_COMM_WORLD->size();
int send_size = parse_double(action[2]);
int recv_size = parse_double(action[3]);
MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
int root=0;
if(action[4])
root=atoi(action[4]);
- int rank = smpi_comm_rank(MPI_COMM_WORLD);
+ int rank = MPI_COMM_WORLD->rank();
if(rank==root)
recv = smpi_get_tmp_recvbuffer(recv_size*comm_size* smpi_datatype_size(MPI_CURRENT_TYPE2));
4) 0 is the send datatype id, see decode_datatype()
5) 0 is the recv datatype id, see decode_datatype()
*/
-
double clock = smpi_process_simulated_elapsed();
- int comm_size = smpi_comm_size(MPI_COMM_WORLD);
+ int comm_size = MPI_COMM_WORLD->size();
CHECK_ACTION_PARAMS(action, comm_size+1, 2)
int send_size = parse_double(action[2]);
- int disps[comm_size] = { 0 };
+ int disps[comm_size];
int recvcounts[comm_size];
- int i=0,recv_sum=0;
+ int recv_sum=0;
MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
if(action[4+comm_size] && action[5+comm_size]) {
MPI_CURRENT_TYPE=decode_datatype(action[4+comm_size]);
MPI_CURRENT_TYPE2=decode_datatype(action[5+comm_size]);
- } else {
+ } else
MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
- }
+
void *send = smpi_get_tmp_sendbuffer(send_size* smpi_datatype_size(MPI_CURRENT_TYPE));
void *recv = nullptr;
- for(i=0;i<comm_size;i++) {
+ for(int i=0;i<comm_size;i++) {
recvcounts[i] = atoi(action[i+3]);
recv_sum=recv_sum+recvcounts[i];
+ disps[i]=0;
}
int root=atoi(action[3+comm_size]);
- int rank = smpi_comm_rank(MPI_COMM_WORLD);
+ int rank = MPI_COMM_WORLD->rank();
if(rank==root)
recv = smpi_get_tmp_recvbuffer(recv_sum* smpi_datatype_size(MPI_CURRENT_TYPE2));
extra->type = TRACING_GATHERV;
extra->send_size = send_size;
extra->recvcounts= xbt_new(int,comm_size);
- for(i=0; i< comm_size; i++)//copy data to avoid bad free
+ for(int i=0; i< comm_size; i++)//copy data to avoid bad free
extra->recvcounts[i] = recvcounts[i];
extra->root = root;
extra->num_processes = comm_size;
3) The last value corresponds to the datatype, see decode_datatype().
*/
double clock = smpi_process_simulated_elapsed();
- int comm_size = smpi_comm_size(MPI_COMM_WORLD);
+ 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];
if(action[4] && action[5]) {
MPI_CURRENT_TYPE = decode_datatype(action[4]);
MPI_CURRENT_TYPE2 = decode_datatype(action[5]);
- } else {
+ } else
MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
- }
+
void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* smpi_datatype_size(MPI_CURRENT_TYPE));
void *recvbuf = smpi_get_tmp_recvbuffer(recvcount* smpi_datatype_size(MPI_CURRENT_TYPE2));
extra->recv_size= recvcount;
extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, nullptr);
- extra->num_processes = smpi_comm_size(MPI_COMM_WORLD);
+ extra->num_processes = MPI_COMM_WORLD->size();
TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
*/
double clock = smpi_process_simulated_elapsed();
- int comm_size = smpi_comm_size(MPI_COMM_WORLD);
+ int comm_size = MPI_COMM_WORLD->size();
CHECK_ACTION_PARAMS(action, comm_size+1, 2)
int sendcount=atoi(action[2]);
int recvcounts[comm_size];
- int disps[comm_size] = { 0 };
+ int disps[comm_size];
int recv_sum=0;
MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
if(action[3+comm_size] && action[4+comm_size]) {
MPI_CURRENT_TYPE = decode_datatype(action[3+comm_size]);
MPI_CURRENT_TYPE2 = decode_datatype(action[4+comm_size]);
- } else {
+ } else
MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
- }
+
void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* smpi_datatype_size(MPI_CURRENT_TYPE));
for(int i=0;i<comm_size;i++) {
recvcounts[i] = atoi(action[i+3]);
recv_sum=recv_sum+recvcounts[i];
+ disps[i] = 0;
}
void *recvbuf = smpi_get_tmp_recvbuffer(recv_sum* smpi_datatype_size(MPI_CURRENT_TYPE2));
*/
double clock = smpi_process_simulated_elapsed();
- int comm_size = smpi_comm_size(MPI_COMM_WORLD);
+ int comm_size = MPI_COMM_WORLD->size();
CHECK_ACTION_PARAMS(action, 2*comm_size+2, 2)
int sendcounts[comm_size];
int recvcounts[comm_size];
- int senddisps[comm_size] = { 0 };
- int recvdisps[comm_size] = { 0 };
+ int senddisps[comm_size];
+ int recvdisps[comm_size];
MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
MPI_CURRENT_TYPE=decode_datatype(action[4+2*comm_size]);
MPI_CURRENT_TYPE2=decode_datatype(action[5+2*comm_size]);
}
- else{
+ else
MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
- }
void *sendbuf = smpi_get_tmp_sendbuffer(send_buf_size* smpi_datatype_size(MPI_CURRENT_TYPE));
void *recvbuf = smpi_get_tmp_recvbuffer(recv_buf_size* smpi_datatype_size(MPI_CURRENT_TYPE2));
for(int i=0;i<comm_size;i++) {
sendcounts[i] = atoi(action[i+3]);
recvcounts[i] = atoi(action[i+4+comm_size]);
+ senddisps[i] = 0;
+ recvdisps[i] = 0;
}
int rank = smpi_process_index();
}
smpi_mpi_waitall(count_requests, requests, status);
}
+ delete get_reqq_self();
active_processes--;
if(active_processes==0){