X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8d51848cefcf39dbe0072eacd5fc50765b8b4e37..9086c78d060e42312987d34efb10d3dd03d103b3:/src/smpi/internals/smpi_global.cpp diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 990a646807..c28af0c90c 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -3,16 +3,16 @@ /* 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 "smpi_host.hpp" #include "mc/mc.h" #include "simgrid/s4u/Engine.hpp" #include "smpi_coll.hpp" #include "smpi_f2c.hpp" -#include "src/msg/msg_private.hpp" +#include "smpi_host.hpp" +#include "src/kernel/activity/CommImpl.hpp" #include "src/simix/smx_private.hpp" +#include "src/smpi/include/smpi_actor.hpp" #include "xbt/config.hpp" -#include "src/smpi/include/smpi_actor.hpp" #include /* DBL_MAX */ #include #include @@ -99,10 +99,11 @@ int smpi_process_count() simgrid::smpi::ActorExt* smpi_process() { ActorPtr me = Actor::self(); + if (me == nullptr) // This happens sometimes (eg, when linking against NS3 because it pulls openMPI...) return nullptr; - simgrid::msg::ActorExt* msgExt = static_cast(me->get_impl()->get_user_data()); - return static_cast(msgExt->data); + + return process_data.at(me); } simgrid::smpi::ActorExt* smpi_process_remote(ActorPtr actor) @@ -123,11 +124,11 @@ int smpi_process_index(){ } void * smpi_process_get_user_data(){ - return smpi_process()->get_user_data(); + return Actor::self()->get_impl()->get_user_data(); } void smpi_process_set_user_data(void *data){ - return smpi_process()->set_user_data(data); + Actor::self()->get_impl()->set_user_data(data); } @@ -626,20 +627,18 @@ int smpi_main(const char* executable, int argc, char* argv[]) } TRACE_global_init(); - SIMIX_global_init(&argc, argv); - MSG_init(&argc, argv); // FIXME Remove this MSG call. Once it's removed, we can remove the msg header include as well SMPI_switch_data_segment = &smpi_switch_data_segment; // TODO This will not be executed in the case where smpi_main is not called, // e.g., not for smpi_msg_masterslave. This should be moved to another location - // that is always called -- maybe close to Actor::onCreation? + // that is always called -- maybe close to Actor::on_creation? simgrid::s4u::Host::on_creation.connect( [](simgrid::s4u::Host& host) { host.extension_set(new simgrid::smpi::Host(&host)); }); // parse the platform file: get the host list - SIMIX_create_environment(argv[1]); + simgrid::s4u::Engine::get_instance()->load_platform(argv[1]); SIMIX_comm_set_copy_data_callback(smpi_comm_copy_buffer_callback); smpi_init_options(); @@ -649,7 +648,7 @@ int smpi_main(const char* executable, int argc, char* argv[]) smpi_init_privatization_no_dlopen(executable); SMPI_init(); - SIMIX_launch_application(argv[2]); + simgrid::s4u::Engine::get_instance()->load_deployment(argv[2]); SMPI_app_instance_register(smpi_default_instance_name.c_str(), nullptr, process_data.size()); // This call has a side effect on process_count... MPI_COMM_WORLD = *smpi_deployment_comm_world(smpi_default_instance_name);