void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t buff_size)
{
- void* tmpbuff=buff;
+
simgrid::kernel::activity::Comm *comm = dynamic_cast<simgrid::kernel::activity::Comm*>(synchro);
XBT_DEBUG("Copy the data over");
}else if(smpi_is_shared((char*)comm->dst_buff)){
XBT_DEBUG("Receiver %p is shared. Let's ignore it.", (char*)comm->dst_buff);
}else{
-
+ void* tmpbuff=buff;
if((smpi_privatize_global_variables) && (static_cast<char*>(buff) >= smpi_start_data_exe)
&& (static_cast<char*>(buff) < smpi_start_data_exe + smpi_size_data_exe )
){
XBT_DEBUG("Copying %zu bytes from %p to %p", buff_size, tmpbuff,comm->dst_buff);
memcpy(comm->dst_buff, tmpbuff, buff_size);
- }
- if (comm->detached) {
- // if this is a detached send, the source buffer was duplicated by SMPI
- // sender to make the original buffer available to the application ASAP
- xbt_free(buff);
- //It seems that the request is used after the call there this should be free somewhere else but where???
- //xbt_free(comm->comm.src_data);// inside SMPI the request is kept inside the user data and should be free
- comm->src_buff = nullptr;
+
+ if (comm->detached) {
+ // if this is a detached send, the source buffer was duplicated by SMPI
+ // sender to make the original buffer available to the application ASAP
+ xbt_free(buff);
+ //It seems that the request is used after the call there this should be free somewhere else but where???
+ //xbt_free(comm->comm.src_data);// inside SMPI the request is kept inside the user data and should be free
+ comm->src_buff = nullptr;
+ }
+ if(tmpbuff!=buff)xbt_free(tmpbuff);
}
- if(tmpbuff!=buff)xbt_free(tmpbuff);
}
void smpi_comm_null_copy_buffer_callback(smx_activity_t comm, void *buff, size_t buff_size)
void smpi_global_init()
{
- int i;
MPI_Group group;
- int smpirun=0;
if (!MC_is_active()) {
global_timer = xbt_os_timer_new();
}
}
#endif
+
+ int smpirun = 0;
if (process_count == 0){
process_count = SIMIX_process_count();
smpirun=1;
}
smpi_universe_size = process_count;
process_data = new simgrid::smpi::Process*[process_count];
- for (i = 0; i < process_count; i++) {
- process_data[i] = new simgrid::smpi::Process(i);
+ for (int i = 0; i < process_count; i++) {
+ process_data[i] = new simgrid::smpi::Process(i);
}
//if the process was launched through smpirun script we generate a global mpi_comm_world
//if not, we let MPI_COMM_NULL, and the comm world will be private to each mpi instance
- if(smpirun){
+ if (smpirun) {
group = new simgrid::smpi::Group(process_count);
MPI_COMM_WORLD = new simgrid::smpi::Comm(group, nullptr);
MPI_Attr_put(MPI_COMM_WORLD, MPI_UNIVERSE_SIZE, reinterpret_cast<void *>(process_count));
msg_bar_t bar = MSG_barrier_init(process_count);
- for (i = 0; i < process_count; i++) {
+ for (int i = 0; i < process_count; i++) {
group->set_mapping(i, i);
process_data[i]->set_finalization_barrier(bar);
}