include src/simix/simcalls.py
include src/simix/smx_context.cpp
include src/simix/smx_global.cpp
-include src/simix/smx_private.hpp
include src/smpi/bindings/smpi_f77.cpp
include src/smpi/bindings/smpi_f77_coll.cpp
include src/smpi/bindings/smpi_f77_comm.cpp
#define XBT_PARMAP_HPP
#include "src/internal_config.h" // HAVE_FUTEX_H
+#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/context/Context.hpp"
-#include "src/simix/smx_private.hpp" /* simix_global */
#include <boost/optional.hpp>
#include <condition_variable>
/** @brief Main function of a worker thread */
template <typename T> void Parmap<T>::worker_main(ThreadData* data)
{
+ auto engine = simgrid::kernel::EngineImpl::get_instance();
Parmap<T>& parmap = data->parmap;
unsigned round = 0;
- kernel::context::Context* context =
- simix_global->get_context_factory()->create_context(std::function<void()>(), nullptr);
+ kernel::context::Context* context = engine->get_context_factory()->create_context(std::function<void()>(), nullptr);
kernel::context::Context::set_current(context);
XBT_CDEBUG(xbt_parmap, "New worker thread created");
#include "src/kernel/resource/profile/Profile.hpp"
#include "src/mc/mc_record.hpp"
#include "src/mc/mc_replay.hpp"
-#include "src/simix/smx_private.hpp"
#include "src/smpi/include/smpi_actor.hpp"
#include "src/surf/network_interface.hpp"
#include "src/surf/xml/platf.hpp" // FIXME: KILLME. There must be a better way than mimicking XML here
if (already_cleaned_up)
return; // to avoid double cleaning by java and C
already_cleaned_up = true;
- if (not instance_) {
- simix_global->destroy_context_factory();
- return; // Nothing more to shutdown
- }
XBT_DEBUG("EngineImpl::shutdown() called. Simulation's over.");
if (instance_->has_actors_to_run() && simgrid_get_clock() <= 0.0) {
XBT_CRITICAL(" ");
instance_->destroy_maestro();
/* Finish context module and SURF */
- simix_global->destroy_context_factory();
+ instance_->destroy_context_factory();
while (not timer::kernel_timers().empty()) {
delete timer::kernel_timers().top().second;
tmgr_finalize();
sg_platf_exit();
- simix_global = nullptr;
delete instance_;
instance_ = nullptr;
}
*/
void EngineImpl::run_all_actors()
{
- simix_global->get_context_factory()->run_all();
+ instance_->get_context_factory()->run_all();
actors_to_run_.swap(actors_that_ran_);
actors_to_run_.clear();
std::mutex mutex_;
static EngineImpl* instance_;
actor::ActorImpl* maestro_ = nullptr;
+ context::ContextFactory* context_factory_ = nullptr;
std::unique_ptr<void, std::function<int(void*)>> platf_handle_; //!< handle for platform library
friend s4u::Engine;
delete maestro_;
maestro_ = nullptr;
}
+
+ context::ContextFactory* get_context_factory() const { return context_factory_; }
+ void set_context_factory(context::ContextFactory* factory) { context_factory_ = factory; }
+ bool has_context_factory() const { return context_factory_ != nullptr; }
+ void destroy_context_factory()
+ {
+ delete context_factory_;
+ context_factory_ = nullptr;
+ }
+
/**
* @brief Add a model to engine list
*
#include "src/kernel/activity/ActivityImpl.hpp"
#include "simgrid/modelchecker.h"
#include "src/kernel/activity/SynchroRaw.hpp"
+#include "src/kernel/actor/ActorImpl.hpp"
#include "src/kernel/actor/SimcallObserver.hpp"
#include "src/mc/mc_replay.hpp"
-#include "src/simix/smx_private.hpp"
#include <boost/range/algorithm.hpp>
#include <cmath> // isfinite()
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/Io.hpp"
+#include "src/kernel/actor/ActorImpl.hpp"
#include "src/kernel/actor/SimcallObserver.hpp"
+#include "src/kernel/context/Context.hpp"
#include "src/kernel/resource/DiskImpl.hpp"
#include "src/mc/mc_replay.hpp"
-#include "src/simix/smx_private.hpp"
#include "src/surf/cpu_interface.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix, "Logging specific to SIMIX (io)");
#include "simgrid/Exception.hpp"
#include "simgrid/kernel/resource/Action.hpp"
#include "simgrid/s4u/Host.hpp"
+#include "src/kernel/actor/ActorImpl.hpp"
#include "src/kernel/context/Context.hpp"
#include "src/simix/popping_private.hpp"
-#include "src/simix/smx_private.hpp"
#include "src/surf/cpu_interface.hpp"
#include "src/surf/surf_interface.hpp"
#include "src/kernel/activity/SynchroRaw.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/mc/remote/AppSide.hpp"
-#include "src/simix/smx_private.hpp"
#if HAVE_SMPI
#include "src/smpi/include/private.hpp"
#endif
ActorImpl::~ActorImpl()
{
- if (simix_global != nullptr && not EngineImpl::get_instance()->is_maestro(this))
+ if (not EngineImpl::get_instance()->is_maestro(this))
s4u::Actor::on_destruction(*get_ciface());
}
actor->code_ = nullptr;
XBT_VERB("Create context %s", actor->get_cname());
- xbt_assert(simix_global != nullptr, "simix is not initialized, please call MSG_init first");
- actor->context_.reset(simix_global->get_context_factory()->attach(actor));
+ actor->context_.reset(engine->get_context_factory()->attach(actor));
/* Add the actor to it's host actor list */
host->get_impl()->add_actor(actor);
this->code_ = code;
XBT_VERB("Create context %s", get_cname());
- context_.reset(simix_global->get_context_factory()->create_context(ActorCode(code), this));
+ context_.reset(engine->get_context_factory()->create_context(ActorCode(code), this));
XBT_DEBUG("Start context '%s'", get_cname());
void create_maestro(const std::function<void()>& code)
{
+ auto* engine = EngineImpl::get_instance();
/* Create maestro actor and initialize it */
auto* maestro = new ActorImpl(xbt::string(""), /*host*/ nullptr);
if (not code) {
- maestro->context_.reset(simix_global->get_context_factory()->create_context(ActorCode(), maestro));
+ maestro->context_.reset(engine->get_context_factory()->create_context(ActorCode(), maestro));
} else {
- maestro->context_.reset(simix_global->get_context_factory()->create_maestro(ActorCode(code), maestro));
+ maestro->context_.reset(engine->get_context_factory()->create_maestro(ActorCode(code), maestro));
}
maestro->simcall_.issuer_ = maestro;
#include "simgrid/s4u/Host.hpp"
#include "src/kernel/activity/CommImpl.hpp"
#include "src/kernel/context/Context.hpp"
-#include "src/simix/smx_private.hpp"
#include "src/surf/surf_interface.hpp"
#include <vector>
#include "ContextBoost.hpp"
#include "simgrid/Exception.hpp"
#include "src/internal_config.h"
-#include "src/simix/smx_private.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
#include "ContextRaw.hpp"
#include "mc/mc.h"
#include "simgrid/Exception.hpp"
-#include "src/simix/smx_private.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
#include "src/internal_config.h"
#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/actor/ActorImpl.hpp"
-#include "src/simix/smx_private.hpp"
#include "xbt/parmap.hpp"
#include "src/kernel/context/ContextSwapped.hpp"
#include "simgrid/Exception.hpp"
#include "src/internal_config.h" /* loads context system definitions */
#include "src/kernel/EngineImpl.hpp"
-#include "src/simix/smx_private.hpp"
#include "xbt/function_types.h"
#include "xbt/xbt_modinter.h" /* prototype of os thread module's init/exit in XBT */
#include "simgrid/Exception.hpp"
#include "src/kernel/actor/ActorImpl.hpp"
#include "src/mc/mc_ignore.hpp"
-#include "src/simix/smx_private.hpp"
#include "ContextUnix.hpp"
#include "xbt/log.h"
#include "xbt/system_error.hpp"
+#include "signal.h"
#include <array>
#include <memory>
#include <string>
#include "src/kernel/actor/SimcallObserver.hpp"
#include "src/mc/mc_config.hpp"
#include "src/mc/mc_replay.hpp"
-#include "src/simix/smx_private.hpp"
#include "xbt/random.hpp"
#ifndef SIMGRID_MC_REMOTE_PTR_HPP
#define SIMGRID_MC_REMOTE_PTR_HPP
-#include "src/simix/smx_private.hpp"
+#include "src/kernel/actor/ActorImpl.hpp"
namespace simgrid {
namespace mc {
*/
smx_mutex_t simcall_mutex_init() // XBT_ATTRIB_DEPRECATED_v330
{
- if (simix_global == nullptr) {
- fprintf(stderr, "You must initialize the SimGrid engine before using it\n"); // We can't use xbt_die since we may
- // get there before the initialization
- xbt_abort();
- }
return simgrid::kernel::actor::simcall([] { return new simgrid::kernel::activity::MutexImpl(); });
}
/* 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 "smx_private.hpp"
+#include "src/simix/popping_private.hpp"
+#include "xbt/log.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_popping, simix,
"Popping part of SIMIX (transmuting from user request into kernel handlers)");
* That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
*/
-#include "smx_private.hpp"
#include "src/kernel/EngineImpl.hpp"
#include "src/mc/mc_forward.hpp"
#include "xbt/ex.h"
* That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
*/
-#include "smx_private.hpp"
#include <simgrid/host.h>
#include <xbt/base.h>
#if SIMGRID_HAVE_MC
#endif
#include "src/kernel/activity/ConditionVariableImpl.hpp"
#include "src/kernel/actor/SimcallObserver.hpp"
+#include "src/kernel/context/Context.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
fd = header("popping_generated.cpp")
- fd.write('#include "smx_private.hpp"\n')
fd.write('#include <simgrid/host.h>\n')
fd.write('#include <xbt/base.h>\n')
fd.write('#if SIMGRID_HAVE_MC\n')
fd.write('#endif\n')
fd.write('#include "src/kernel/activity/ConditionVariableImpl.hpp"\n')
fd.write('#include "src/kernel/actor/SimcallObserver.hpp"\n')
+ fd.write('#include "src/kernel/context/Context.hpp"\n')
fd.write('\n')
fd.write('XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);\n\n')
# popping_bodies.cpp
#
fd = header('popping_bodies.cpp')
- fd.write('#include "smx_private.hpp"\n')
fd.write('#include "src/mc/mc_forward.hpp"\n')
fd.write('#include "src/kernel/EngineImpl.hpp"\n')
fd.write('#include "xbt/ex.h"\n')
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/internal_config.h"
-#include "src/simix/smx_private.hpp"
+#include "src/kernel/EngineImpl.hpp"
#include "src/smpi/include/private.hpp"
#include "xbt/config.hpp"
*/
void SIMIX_context_mod_init()
{
- xbt_assert(not simix_global->has_context_factory());
+ auto* engine = simgrid::kernel::EngineImpl::get_instance();
+ xbt_assert(not engine->has_context_factory());
#if HAVE_SMPI && (defined(__APPLE__) || defined(__NetBSD__))
smpi_init_options_internal(false);
/* select the context factory to use to create the contexts */
if (simgrid::kernel::context::factory_initializer != nullptr) { // Give Java a chance to hijack the factory mechanism
- simix_global->set_context_factory(simgrid::kernel::context::factory_initializer());
+ engine->set_context_factory(simgrid::kernel::context::factory_initializer());
return;
}
/* use the factory specified by --cfg=contexts/factory:value */
for (auto const& factory : context_factories)
if (context_factory_name == factory.first) {
- simix_global->set_context_factory(factory.second());
+ engine->set_context_factory(factory.second());
break;
}
- if (not simix_global->has_context_factory()) {
+ if (not engine->has_context_factory()) {
XBT_ERROR("Invalid context factory specified. Valid factories on this machine:");
#if HAVE_RAW_CONTEXTS
XBT_ERROR(" raw: high performance context factory implemented specifically for SimGrid");
#include "src/kernel/EngineImpl.hpp"
#include "src/mc/mc_record.hpp"
#include "src/mc/mc_replay.hpp"
-#include "src/simix/smx_private.hpp"
#include "src/surf/xml/platf.hpp"
#include "simgrid/kernel/resource/Model.hpp"
XBT_LOG_NEW_CATEGORY(simix, "All SIMIX categories");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_kernel, simix, "Logging specific to SIMIX (kernel)");
-std::unique_ptr<simgrid::simix::Global> simix_global;
-
namespace simgrid {
namespace simix {
void SIMIX_global_init(int* argc, char** argv)
{
- if (simix_global != nullptr)
- return;
-
- simix_global = std::make_unique<simgrid::simix::Global>();
SIMIX_context_mod_init();
int SIMIX_is_maestro()
{
- if (simix_global == nullptr) // SimDag
- return true;
const simgrid::kernel::actor::ActorImpl* self = SIMIX_process_self();
return self == nullptr || simgrid::kernel::EngineImpl::get_instance()->is_maestro(self);
}
+++ /dev/null
-/* Copyright (c) 2007-2021. 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. */
-
-#ifndef SIMIX_PRIVATE_HPP
-#define SIMIX_PRIVATE_HPP
-
-#include "simgrid/s4u/Actor.hpp"
-#include "src/kernel/actor/ActorImpl.hpp"
-#include "src/kernel/context/Context.hpp"
-
-/********************************** Simix Global ******************************/
-
-namespace simgrid {
-namespace simix {
-
-class Global {
- kernel::context::ContextFactory* context_factory_ = nullptr;
-
-public:
- kernel::context::ContextFactory* get_context_factory() const { return context_factory_; }
- void set_context_factory(kernel::context::ContextFactory* factory) { context_factory_ = factory; }
- bool has_context_factory() const { return context_factory_ != nullptr; }
- void destroy_context_factory()
- {
- delete context_factory_;
- context_factory_ = nullptr;
- }
-};
-}
-}
-
-XBT_PUBLIC_DATA std::unique_ptr<simgrid::simix::Global> simix_global;
-
-#endif
#include "smpi_comm.hpp"
#include "smpi_info.hpp"
#include "src/mc/mc_replay.hpp"
-#include "src/simix/smx_private.hpp"
#if HAVE_PAPI
#include "papi.h"
#include "mc/mc.h"
#include "private.hpp"
#include "smpi_coll.hpp"
-#include "src/simix/smx_private.hpp"
#include "xbt/parse_units.hpp"
#include <cfloat> /* DBL_MAX */
#include "smpi_host.hpp"
#include "src/kernel/EngineImpl.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 "xbt/file.hpp"
#include "xbt/file.hpp"
#include <boost/tokenizer.hpp>
#include "smpi_config.hpp"
-#include "src/simix/smx_private.hpp"
#include <algorithm>
#include "private.hpp"
#include "smpi_status.hpp"
#include "private.hpp"
#include "smpi_datatype.hpp"
-#include "src/simix/smx_private.hpp"
namespace simgrid{
namespace smpi{
#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/resource/DiskImpl.hpp"
#include "src/kernel/resource/profile/Profile.hpp"
-#include "src/simix/smx_private.hpp"
#include "src/surf/HostImpl.hpp"
#include "src/surf/xml/platf_private.hpp"
src/simix/popping_generated.cpp
src/simix/popping_enum.hpp
src/simix/popping_accessors.hpp
- src/simix/smx_private.hpp
src/smpi/colls/coll_tuned_topo.hpp
src/smpi/colls/colls_private.hpp
src/smpi/colls/smpi_mvapich2_selector_stampede.hpp