}
void * smpi_process_get_user_data(){
- return simgrid::s4u::Actor::self()->get_impl()->get_user_data();
+ return simgrid::s4u::Actor::self()->get_data();
}
void smpi_process_set_user_data(void *data){
- simgrid::s4u::Actor::self()->get_impl()->set_user_data(data);
+ simgrid::s4u::Actor::self()->set_data(data);
}
void smpi_comm_set_copy_data_callback(void (*callback) (smx_activity_t, void*, size_t))
xbt_assert(block.first <= block.second && block.second <= buff_size, "Oops, bug in shared malloc.");
}
+static void smpi_cleanup_comm_after_copy(simgrid::kernel::activity::CommImpl* comm, void* buff){
+ 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;
+ }
+}
+
void smpi_comm_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, void* buff, size_t buff_size)
{
size_t src_offset = 0;
std::vector<std::pair<size_t, size_t>> dst_private_blocks;
XBT_DEBUG("Copy the data over");
if(smpi_is_shared(buff, src_private_blocks, &src_offset)) {
- XBT_DEBUG("Sender %p is shared. Let's ignore it.", buff);
src_private_blocks = shift_and_frame_private_blocks(src_private_blocks, src_offset, buff_size);
+ if (src_private_blocks.size()==1 && (src_private_blocks[0].second - src_private_blocks[0].first)==buff_size){//simple shared malloc ... return.
+ XBT_VERB("Sender is shared. Let's ignore it.");
+ smpi_cleanup_comm_after_copy(comm, buff);
+ return;
+ }
}
else {
src_private_blocks.clear();
src_private_blocks.push_back(std::make_pair(0, buff_size));
}
if (smpi_is_shared((char*)comm->dst_buff_, dst_private_blocks, &dst_offset)) {
- XBT_DEBUG("Receiver %p is shared. Let's ignore it.", (char*)comm->dst_buff_);
dst_private_blocks = shift_and_frame_private_blocks(dst_private_blocks, dst_offset, buff_size);
+ if (src_private_blocks.size()==1 && (src_private_blocks[0].second - src_private_blocks[0].first)==buff_size){//simple shared malloc ... return.
+ XBT_VERB("Receiver is shared. Let's ignore it.");
+ smpi_cleanup_comm_after_copy(comm, buff);
+ return;
+ }
}
else {
dst_private_blocks.clear();
XBT_DEBUG("Copying %zu bytes from %p to %p", buff_size, tmpbuff, comm->dst_buff_);
memcpy_private(comm->dst_buff_, tmpbuff, private_blocks);
- 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;
- }
+ smpi_cleanup_comm_after_copy(comm,buff);
if (tmpbuff != buff)
xbt_free(tmpbuff);
}
// return if already called
if (smpi_cpu_threshold > -1)
return;
- simgrid::smpi::Colls::set_collectives();
- simgrid::smpi::Colls::smpi_coll_cleanup_callback = nullptr;
+ simgrid::smpi::colls::set_collectives();
+ simgrid::smpi::colls::smpi_coll_cleanup_callback = nullptr;
smpi_cpu_threshold = simgrid::config::get_value<double>("smpi/cpu-threshold");
if (smpi_cpu_threshold < 0)
smpi_cpu_threshold = DBL_MAX;
});
simgrid::s4u::Host::on_creation.connect(
[](simgrid::s4u::Host& host) { host.extension_set(new simgrid::smpi::Host(&host)); });
+ for (auto const& host : simgrid::s4u::Engine::get_instance()->get_all_hosts())
+ host->extension_set(new simgrid::smpi::Host(host));
smpi_init_options();
if (not MC_is_active()) {
smpi_shared_destroy();
smpi_deployment_cleanup_instances();
- if (simgrid::smpi::Colls::smpi_coll_cleanup_callback != nullptr)
- simgrid::smpi::Colls::smpi_coll_cleanup_callback();
+ if (simgrid::smpi::colls::smpi_coll_cleanup_callback != nullptr)
+ simgrid::smpi::colls::smpi_coll_cleanup_callback();
MPI_COMM_WORLD = MPI_COMM_NULL;