- int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
- int i=0;
- int size = smpi_comm_size(comm);
- instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
- extra->type = TRACING_ALLTOALLV;
- extra->send_size = 0;
- extra->recv_size = 0;
- extra->recvcounts= xbt_new(int, size);
- extra->sendcounts= xbt_new(int, size);
- int known=0;
- int dt_size_recv = 1;
- extra->datatype2 = encode_datatype(recvtype, &known);
- dt_size_recv = smpi_datatype_size(recvtype);
-
- void* sendtmpbuf = static_cast<char*>(sendbuf);
- int * sendtmpcounts = sendcounts;
- int *sendtmpdisps = senddisps;
- MPI_Datatype sendtmptype = sendtype;
- int maxsize=0;
- for(i=0; i< size; i++){//copy data to avoid bad free
- extra->recv_size += recvcounts[i]*dt_size_recv;
- extra->recvcounts[i] = recvcounts[i]*dt_size_recv;
- if (((recvdisps[i]+recvcounts[i])*dt_size_recv) > maxsize)
- maxsize=(recvdisps[i]+recvcounts[i])*dt_size_recv;
- }
-
- if( sendbuf == MPI_IN_PLACE ) {
- sendtmpbuf = static_cast<void*>(xbt_malloc(maxsize));
- memcpy(sendtmpbuf,recvbuf, maxsize);
- sendtmpcounts= static_cast<int*>(xbt_malloc(size*sizeof(int)));
- memcpy(sendtmpcounts,recvcounts, size*sizeof(int));
- sendtmpdisps= static_cast<int*>(xbt_malloc(size*sizeof(int)));
- memcpy(sendtmpdisps,recvdisps, size*sizeof(int));
- sendtmptype=recvtype;
- }
-
- extra->datatype1 = encode_datatype(sendtmptype, &known);
- int dt_size_send = 1;
- dt_size_send = smpi_datatype_size(sendtmptype);
+ int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+ int i = 0;
+ int size = smpi_comm_size(comm);
+ instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
+ extra->type = TRACING_ALLTOALLV;
+ extra->send_size = 0;
+ extra->recv_size = 0;
+ extra->recvcounts = xbt_new(int, size);
+ extra->sendcounts = xbt_new(int, size);
+ int known = 0;
+ int dt_size_recv = 1;
+ extra->datatype2 = encode_datatype(recvtype, &known);
+ dt_size_recv = smpi_datatype_size(recvtype);