# Lua
#- choco install lua53
# We need python v3
-- cmd: SET PATH=C:\Python35-x64;%PATH% # We need python v3
+- cmd: SET PATH=C:\Python37-x64;%PATH% # We need python v3
# Use the mingw-w64 provided by Appveyor (must be placed before Perl in the path)
- cmd: SET PATH=C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin\;%PATH%
# Work around a bug on appveyor where the default sh is not the one I expect
- rename "C:\Program Files\Git\usr\bin\sh.exe" "sh-ignored.exe"
+# We need pybind11. SimGrid will pick it automatically if the subdir is here
+- cmd: git clone --depth=1 https://github.com/pybind/pybind11.git
build_script:
- cmake -G "MinGW Makefiles" -Denable_lua=OFF -Denable_documentation=OFF -Denable_java=ON -Denable_smpi=OFF -Denable_mallocators=OFF -Denable_lto=OFF .
-- mingw32-make.exe VERBOSE=1 java-all # Only the Java parts
-- ctest --output-on-failure -R java
+- mingw32-make.exe VERBOSE=1 java-all python-bindings # Only the Java and Python parts
+- ctest --output-on-failure -R java python
artifacts:
- path: simgrid.jar
# Python binding (with pybind11)
################
-
# Our usage of pybind11::overload_cast mandates C++14
get_property(known_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
-if ("cxx_std_14" IN_LIST known_features)
- find_package(pybind11 2.2.0)
+
+if("cxx_std_14" IN_LIST known_features)
+
+ if(EXISTS ${CMAKE_HOME_DIRECTORY}/pybind11) # Try to use a local copy of pybind11, if any
+ message(STATUS "Use the internal copy of pybind11 (using C++14).")
+ add_subdirectory(${CMAKE_HOME_DIRECTORY}/pybind11)
+ set(pybind11_FOUND ON)
+
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_HOME_DIRECTORY}/pybind11/tools/)
+ set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4)
+ find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED)
+
+ else()
+ find_package(pybind11 2.2.0)
+ endif()
+
if(NOT PYTHONLIBS_FOUND)
+ message(STATUS "Python libs not found. Turn pybind11 off.")
+
set(pybind11_FOUND OFF)
endif()
+
else()
message(STATUS "No support for C++14 detected, don't even search for pybind11.")
set(pybind11_FOUND OFF)
/* 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. */
+#ifdef _WIN32
+#warning Try to work around https://bugs.python.org/issue11566
+#include <cmath>
+#define hypot _hypot // Must come before pybind11 when compiling with MinGW32-64 (https://bugs.python.org/issue11566)
+#endif
+
#include <pybind11/functional.h>
-#include <pybind11/pybind11.h> // Must be first
+#include <pybind11/pybind11.h> // Must come before our own stuff
#include <pybind11/stl.h>
#include "src/kernel/context/Context.hpp"
#include "mc/mc.h"
+#include "simgrid/s4u/Host.hpp"
#include "src/kernel/context/Context.hpp"
#include "src/simix/smx_private.hpp"
+#include "src/surf/surf_interface.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
void Context::stop()
{
+ actor_->finished_ = true;
+
+ if (actor_->auto_restart_ && actor_->host_->is_off()) {
+ XBT_DEBUG("Insert host %s to watched_hosts because it's off and %s needs to restart", actor_->host_->get_cname(),
+ actor_->get_cname());
+ watched_hosts.insert(actor_->host_->get_cname());
+ }
+
if (this->cleanup_func_)
this->cleanup_func_(this->actor_);
- this->actor_->suspended_ = false;
- this->iwannadie = false;
+ this->iwannadie = false; // don't let the yield call ourself -- Context::stop()
simgrid::simix::simcall([this] { SIMIX_process_cleanup(this->actor_); });
this->iwannadie = true;
}
XBT_DEBUG("Control returned to me: '%s'", self->get_cname());
if (self->context_->iwannadie) {
- XBT_DEBUG("I wanna die!");
- self->finished_ = true;
- /* execute the on_exit functions */
- SIMIX_process_on_exit_runall(self);
-
- if (self->auto_restart_ && self->host_->is_off() &&
- watched_hosts.find(self->host_->get_cname()) == watched_hosts.end()) {
- XBT_DEBUG("Push host %s to watched_hosts because it's off and %s needs to restart", self->host_->get_cname(),
- self->get_cname());
- watched_hosts.insert(self->host_->get_cname());
- }
XBT_DEBUG("Process %s@%s is dead", self->get_cname(), self->host_->get_cname());
self->context_->stop();
- xbt_backtrace_display_current();
- xbt_die("I should be dead by now.");
+ THROW_IMPOSSIBLE;
}
if (self->suspended_) {
simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name("mailbox");
int pid = simgrid::s4u::this_actor::get_pid();
double comm_size = 100000;
- simgrid::s4u::this_actor::on_exit([](int, void* pid) { XBT_INFO("Process \"%d\" killed.", *(int*)pid); }, &pid);
+ simgrid::s4u::this_actor::on_exit([pid](int, void*) { XBT_INFO("Process \"%d\" killed.", pid); }, nullptr);
XBT_INFO("Sending pid of \"%d\".", pid);
mailbox->put(&pid, comm_size);