language: cpp
compiler:
- gcc
-# - clang # boost 1.48 raises an error on clang:
-# /usr/include/boost/signals2/detail/auto_buffer.hpp:565:57: error:
-# reference to non-static member function must be called
-# std::uninitialized_fill( buffer_, buffer_ + size, init_value );
-# ^~~~
-#
+# - clang
addons:
apt:
packages:
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
set(SIMGRID_VERSION_MAJOR "3")
-set(SIMGRID_VERSION_MINOR "19")
-set(SIMGRID_VERSION_PATCH "0")
+set(SIMGRID_VERSION_MINOR "18")
+set(SIMGRID_VERSION_PATCH "90")
set(SIMGRID_VERSION_EXTRA "-DEVEL") # Extra words to add to version string (e.g. -rc1)
-set(SIMGRID_VERSION_DATE "2017") # Year for copyright information
+set(SIMGRID_VERSION_DATE "2018") # Year for copyright information
if(${SIMGRID_VERSION_PATCH} EQUAL "0")
set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}")
MSG
- Fix MSG_task_get_remaining_work_ratio() to return 1.0 for tasks that have
not started.
+ - Remove parameter of MSG_process_killall().
+ Resetting the PID was bogus anyway (several actors could have the same PID).
Documentation
- Use a graphical TOC to make it easier to find the documentation you need
TRACING
- Remove unused run-time parameter "tracing/onelink-only".
+ Fixed bugs:
+ - #254: Something seems wrong with s4u::Actor::kill(aid_t)
+
SimGrid (3.18) Released December 24 2017
The "Ho Ho Ho! SimGrid 4 beta is coming to town" release.
-foreach (example actor-create actor-daemon actor-join actor-kill actor-kill-pid
+foreach (example actor-create actor-daemon actor-join actor-kill
actor-lifetime actor-migration actor-suspend actor-yield
app-chainsend app-masterworker app-pingpong app-token-ring
async-wait async-waitany async-waitall
${CMAKE_CURRENT_SOURCE_DIR}/replay-storage/s4u-replay-storage.txt
${CMAKE_CURRENT_SOURCE_DIR}/README.doc PARENT_SCOPE)
-foreach(example actor-create actor-daemon actor-join actor-kill actor-kill-pid
+foreach(example actor-create actor-daemon actor-join actor-kill
actor-lifetime actor-migration actor-suspend actor-yield
app-bittorrent app-chainsend app-masterworker app-pingpong app-token-ring
async-wait async-waitall async-waitany
+++ /dev/null
-/* Copyright (c) 2017-2018 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. */
-
-#include <simgrid/s4u.hpp>
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor_kill_pid, "Messages specific for this s4u example");
-
-static int on_exit(void*, void*)
-{
- XBT_INFO("I have been killed!");
- return 0;
-}
-
-static void victimA_fun()
-{
- simgrid::s4u::this_actor::onExit(on_exit, nullptr);
- XBT_INFO("Hello!");
- XBT_INFO("Suspending myself");
- simgrid::s4u::this_actor::suspend(); /* - Start by suspending itself */
- XBT_INFO("OK, OK. Let's work"); /* - Then is resumed and start to execute a task */
- simgrid::s4u::this_actor::execute(1e9);
- XBT_INFO("Bye!"); /* - But will never reach the end of it */
-}
-
-static void victimB_fun()
-{
- XBT_INFO("Terminate before being killed");
-}
-
-static void killer()
-{
- XBT_INFO("Hello!"); /* - First start a victim process */
- simgrid::s4u::ActorPtr victimA =
- simgrid::s4u::Actor::createActor("victim A", simgrid::s4u::Host::by_name("Fafard"), victimA_fun);
- simgrid::s4u::ActorPtr victimB =
- simgrid::s4u::Actor::createActor("victim B", simgrid::s4u::Host::by_name("Jupiter"), victimB_fun);
- simgrid::s4u::this_actor::sleep_for(10); /* - Wait for 10 seconds */
-
- XBT_INFO("Resume the victim A"); /* - Resume it from its suspended state */
- victimA->resume();
- simgrid::s4u::this_actor::sleep_for(2);
-
- aid_t pidA = victimA->getPid();
- XBT_INFO("Kill the victim A (pid=%lu)", pidA); /* - and then kill it */
- simgrid::s4u::Actor::kill(pidA);
-
- aid_t pidB = victimB->getPid();
- XBT_INFO("Kill victimB (pid=%lu), even if it's already dead", pidB); /* that's a no-op, there is no zombies in SimGrid */
- try
- {
- simgrid::s4u::Actor::kill(pidB);
- } catch (const std::runtime_error& e) {
- XBT_DEBUG("Caught exception: %s", e.what());
- }
- simgrid::s4u::this_actor::sleep_for(1);
-
- XBT_INFO("Killing everybody but myself");
- simgrid::s4u::Actor::killAll();
-
- aid_t pidMe = simgrid::s4u::this_actor::getPid();
- XBT_INFO("OK, goodbye now. I commit a suicide (pid=%lu).", pidMe);
- simgrid::s4u::Actor::kill(pidMe);
-
- XBT_INFO("This line will never get displayed: I'm already dead since the previous line.");
-}
-
-int main(int argc, char* argv[])
-{
- simgrid::s4u::Engine e(&argc, argv);
- xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
-
- e.loadPlatform(argv[1]); /* - Load the platform description */
- /* - Create and deploy killer process, that will create the victim actors */
- simgrid::s4u::Actor::createActor("killer", simgrid::s4u::Host::by_name("Tremblay"), killer);
-
- e.run(); /* - Run the simulation */
-
- XBT_INFO("Simulation time %g", e.getClock());
-
- return 0;
-}
+++ /dev/null
-#!/usr/bin/env tesh
-
-$ $SG_TEST_EXENV ${bindir:=.}/s4u-actor-kill-pid ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
->[ 0.000000] (killer@Tremblay) Hello!
->[ 0.000000] (victim A@Fafard) Hello!
->[ 0.000000] (victim A@Fafard) Suspending myself
->[ 0.000000] (victim B@Jupiter) Terminate before being killed
->[ 10.000000] (killer@Tremblay) Resume the victim A
->[ 10.000000] (victim A@Fafard) OK, OK. Let's work
->[ 12.000000] (killer@Tremblay) Kill the victim A (pid=2)
->[ 12.000000] (killer@Tremblay) Kill victimB (pid=3), even if it's already dead
->[ 13.000000] (killer@Tremblay) Killing everybody but myself
->[ 13.000000] (victim A@Fafard) I have been killed!
->[ 13.000000] (killer@Tremblay) OK, goodbye now. I commit a suicide (pid=1).
->[ 13.000000] (maestro@) Simulation time 13
simgrid::s4u::this_actor::sleep_for(2);
XBT_INFO("Kill the victim A"); /* - and then kill it */
- victimA->kill();
+ simgrid::s4u::Actor::kill(victimA->getPid()); // Kill by PID is legit
+
+ simgrid::s4u::this_actor::sleep_for(1);
XBT_INFO("Kill victimB, even if it's already dead"); /* that's a no-op, there is no zombies in SimGrid */
- victimB->kill();
+ victimB->kill(); // the actor is automatically garbage-collected after this last reference
+
simgrid::s4u::this_actor::sleep_for(1);
XBT_INFO("Killing everybody but myself");
> [ 10.000000] (victim A@Fafard) OK, OK. Let's work
> [ 12.000000] (killer@Tremblay) Kill the victim A
> [ 12.000000] (victim A@Fafard) I have been killed!
-> [ 12.000000] (killer@Tremblay) Kill victimB, even if it's already dead
-> [ 13.000000] (killer@Tremblay) Killing everybody but myself
-> [ 13.000000] (killer@Tremblay) OK, goodbye now. I commit a suicide.
-> [ 13.000000] (maestro@) Simulation time 13
+> [ 13.000000] (killer@Tremblay) Kill victimB, even if it's already dead
+> [ 14.000000] (killer@Tremblay) Killing everybody but myself
+> [ 14.000000] (killer@Tremblay) OK, goodbye now. I commit a suicide.
+> [ 14.000000] (maestro@) Simulation time 14
*/
typedef long long sg_offset_t;
-typedef unsigned long aid_t;
+typedef long aid_t;
#endif /* SIMGRID_TYPES_H */
XBT_PUBLIC(void) MSG_process_detach();
XBT_PUBLIC(void) MSG_process_kill(msg_process_t process);
-XBT_PUBLIC(int) MSG_process_killall(int reset_PIDs);
+XBT_PUBLIC(int) MSG_process_killall();
XBT_PUBLIC(msg_error_t) MSG_process_migrate(msg_process_t process, msg_host_t host);
XBT_PUBLIC(void) MSG_process_yield();
std::map<std::string, std::string>* properties);
#endif
-XBT_PUBLIC(void) simcall_process_killall(int reset_pid);
+XBT_PUBLIC(void) simcall_process_killall();
XBT_PUBLIC(void) SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char *msg);
MSG_process_daemonize(process);
}
-JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv * env, jclass cls, jint jresetPID)
+JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv* env, jclass cls)
{
- return (jint) MSG_process_killall((int) jresetPID);
+ return (jint)MSG_process_killall();
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID(JNIEnv * env, jclass cls, jint pid)
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject jprocess_arg, jobject jhostname);
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_daemonize(JNIEnv* env, jobject jprocess);
-JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv* env, jclass cls, jint jresetPID);
+JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv* env, jclass cls);
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID(JNIEnv* env, jclass cls, jint pid);
JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_nativeGetPID(JNIEnv* env, jobject jprocess);
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getProperty(JNIEnv* env, jobject jprocess, jobject jname);
/**
* This method kills all running process of the simulation.
*
- * @param resetPID Should we reset the PID numbers. A negative number means no reset
- * and a positive number will be used to set the PID of the next newly
- * created process.
- *
* @return The function returns the PID of the next created process.
*
*/
- public static native int killAll(int resetPID);
+ public static native int killAll();
/** Simply kills the receiving process.
*
static bool trace_display_sizes = false;
static bool trace_disable_link;
static bool trace_disable_power;
-static int trace_precision;
static bool trace_configured = false;
static bool trace_active = false;
trace_display_sizes = xbt_cfg_get_boolean(OPT_TRACING_DISPLAY_SIZES);
trace_disable_link = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_LINK);
trace_disable_power = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_POWER);
- trace_precision = xbt_cfg_get_int(OPT_TRACING_PRECISION);
}
int TRACE_start()
XBT_PRIVATE void TRACE_smpi_computing_init(int rank);
XBT_PRIVATE void TRACE_smpi_computing_out(int rank);
XBT_PRIVATE void TRACE_smpi_computing_in(int rank, double amount);
-XBT_PRIVATE void TRACE_smpi_sleeping_init(int rank);
XBT_PRIVATE void TRACE_smpi_sleeping_out(int rank);
XBT_PRIVATE void TRACE_smpi_sleeping_in(int rank, double duration);
XBT_PRIVATE void TRACE_smpi_testing_out(int rank);
/* If the mutex is not owned by the issuer, that's not good */
if (issuer != this->owner)
- THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%lu), not by you.",
+ THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%ld), not by you.",
this->owner->getCname(), this->owner->pid);
if (not this->sleeping.empty()) {
} else
xbt_die("Unexpected call_type %i", (int) call_type);
- XBT_DEBUG("Insert incomplete comm pattern %p for process %lu", pattern.get(), issuer->pid);
+ XBT_DEBUG("Insert incomplete comm pattern %p for process %ld", pattern.get(), issuer->pid);
xbt_dynar_t dynar = xbt_dynar_get_as(incomplete_communications_pattern, issuer->pid, xbt_dynar_t);
simgrid::mc::PatternCommunication* pattern2 = pattern.release();
xbt_dynar_push(dynar, &pattern2);
} else {
const smx_actor_t previous_issuer = MC_smx_simcall_get_issuer(&prev_state->internal_req);
- XBT_DEBUG("Simcall %d, process %lu (state %d) and simcall %d, process %lu (state %d) are independent",
+ XBT_DEBUG("Simcall %d, process %ld (state %d) and simcall %d, process %ld (state %d) are independent",
req->call, issuer->pid, state->num,
prev_state->internal_req.call,
previous_issuer->pid,
char* p = pointer_to_string(simcall_comm_isend__get__src_buff(req));
char* bs = buff_size_to_string(simcall_comm_isend__get__src_buff_size(req));
if (issuer->host)
- args = bprintf("src=(%lu)%s (%s), buff=%s, size=%s", issuer->pid, MC_smx_actor_get_host_name(issuer),
+ args = bprintf("src=(%ld)%s (%s), buff=%s, size=%s", issuer->pid, MC_smx_actor_get_host_name(issuer),
MC_smx_actor_get_name(issuer), p, bs);
else
- args = bprintf("src=(%lu)%s, buff=%s, size=%s", issuer->pid, MC_smx_actor_get_name(issuer), p, bs);
+ args = bprintf("src=(%ld)%s, buff=%s, size=%s", issuer->pid, MC_smx_actor_get_name(issuer), p, bs);
xbt_free(bs);
xbt_free(p);
break;
char* p = pointer_to_string(simcall_comm_irecv__get__dst_buff(req));
char* bs = buff_size_to_string(size);
if (issuer->host)
- args = bprintf("dst=(%lu)%s (%s), buff=%s, size=%s", issuer->pid, MC_smx_actor_get_host_name(issuer),
+ args = bprintf("dst=(%ld)%s (%s), buff=%s, size=%s", issuer->pid, MC_smx_actor_get_host_name(issuer),
MC_smx_actor_get_name(issuer), p, bs);
else
- args = bprintf("dst=(%lu)%s, buff=%s, size=%s", issuer->pid, MC_smx_actor_get_name(issuer), p, bs);
+ args = bprintf("dst=(%ld)%s, buff=%s, size=%s", issuer->pid, MC_smx_actor_get_name(issuer), p, bs);
xbt_free(bs);
xbt_free(p);
break;
smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_proc));
smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_proc));
args =
- bprintf("comm=%s [(%lu)%s (%s)-> (%lu)%s (%s)]", p, src_proc ? src_proc->pid : 0,
+ bprintf("comm=%s [(%ld)%s (%s)-> (%ld)%s (%s)]", p, src_proc ? src_proc->pid : 0,
src_proc ? MC_smx_actor_get_host_name(src_proc) : "", src_proc ? MC_smx_actor_get_name(src_proc) : "",
dst_proc ? dst_proc->pid : 0, dst_proc ? MC_smx_actor_get_host_name(dst_proc) : "",
dst_proc ? MC_smx_actor_get_name(dst_proc) : "");
smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_proc));
smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_proc));
- args = bprintf("comm=%s [(%lu)%s (%s) -> (%lu)%s (%s)]", p, src_proc->pid, MC_smx_actor_get_name(src_proc),
+ args = bprintf("comm=%s [(%ld)%s (%s) -> (%ld)%s (%s)]", p, src_proc->pid, MC_smx_actor_get_name(src_proc),
MC_smx_actor_get_host_name(src_proc), dst_proc->pid, MC_smx_actor_get_name(dst_proc),
MC_smx_actor_get_host_name(dst_proc));
}
std::string str;
if (args != nullptr)
- str = simgrid::xbt::string_printf("[(%lu)%s (%s)] %s(%s)", issuer->pid, MC_smx_actor_get_host_name(issuer),
+ str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s(%s)", issuer->pid, MC_smx_actor_get_host_name(issuer),
MC_smx_actor_get_name(issuer), type, args);
else
- str = simgrid::xbt::string_printf("[(%lu)%s (%s)] %s ", issuer->pid, MC_smx_actor_get_host_name(issuer),
+ str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s ", issuer->pid, MC_smx_actor_get_host_name(issuer),
MC_smx_actor_get_name(issuer), type);
xbt_free(args);
return str;
switch (req->call) {
case SIMCALL_COMM_ISEND:
if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] iSend", issuer->pid, MC_smx_actor_get_host_name(issuer));
+ label = simgrid::xbt::string_printf("[(%ld)%s] iSend", issuer->pid, MC_smx_actor_get_host_name(issuer));
else
- label = bprintf("[(%lu)] iSend", issuer->pid);
+ label = bprintf("[(%ld)] iSend", issuer->pid);
break;
case SIMCALL_COMM_IRECV:
if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] iRecv", issuer->pid, MC_smx_actor_get_host_name(issuer));
+ label = simgrid::xbt::string_printf("[(%ld)%s] iRecv", issuer->pid, MC_smx_actor_get_host_name(issuer));
else
- label = simgrid::xbt::string_printf("[(%lu)] iRecv", issuer->pid);
+ label = simgrid::xbt::string_printf("[(%ld)] iRecv", issuer->pid);
break;
case SIMCALL_COMM_WAIT:
if (value == -1) {
if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] WaitTimeout", issuer->pid, MC_smx_actor_get_host_name(issuer));
+ label = simgrid::xbt::string_printf("[(%ld)%s] WaitTimeout", issuer->pid, MC_smx_actor_get_host_name(issuer));
else
- label = simgrid::xbt::string_printf("[(%lu)] WaitTimeout", issuer->pid);
+ label = simgrid::xbt::string_printf("[(%ld)] WaitTimeout", issuer->pid);
} else {
simgrid::kernel::activity::ActivityImpl* remote_act = simcall_comm_wait__getraw__comm(req);
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_proc));
smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc));
if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] Wait [(%lu)->(%lu)]", issuer->pid,
+ label = simgrid::xbt::string_printf("[(%ld)%s] Wait [(%ld)->(%ld)]", issuer->pid,
MC_smx_actor_get_host_name(issuer), src_proc ? src_proc->pid : 0,
dst_proc ? dst_proc->pid : 0);
else
- label = simgrid::xbt::string_printf("[(%lu)] Wait [(%lu)->(%lu)]",
+ label = simgrid::xbt::string_printf("[(%ld)] Wait [(%ld)->(%ld)]",
issuer->pid,
src_proc ? src_proc->pid : 0,
dst_proc ? dst_proc->pid : 0);
simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
if (comm->src_proc == nullptr || comm->dst_proc == nullptr) {
if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] Test FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer));
+ label = simgrid::xbt::string_printf("[(%ld)%s] Test FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer));
else
- label = bprintf("[(%lu)] Test FALSE", issuer->pid);
+ label = bprintf("[(%ld)] Test FALSE", issuer->pid);
} else {
if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] Test TRUE", issuer->pid, MC_smx_actor_get_host_name(issuer));
+ label = simgrid::xbt::string_printf("[(%ld)%s] Test TRUE", issuer->pid, MC_smx_actor_get_host_name(issuer));
else
- label = simgrid::xbt::string_printf("[(%lu)] Test TRUE", issuer->pid);
+ label = simgrid::xbt::string_printf("[(%ld)] Test TRUE", issuer->pid);
}
break;
}
unsigned long comms_size = read_length(
mc_model_checker->process(), remote(simcall_comm_waitany__get__comms(req)));
if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] WaitAny [%d of %lu]", issuer->pid,
+ label = simgrid::xbt::string_printf("[(%ld)%s] WaitAny [%d of %lu]", issuer->pid,
MC_smx_actor_get_host_name(issuer), value + 1, comms_size);
else
- label = simgrid::xbt::string_printf("[(%lu)] WaitAny [%d of %lu]",
+ label = simgrid::xbt::string_printf("[(%ld)] WaitAny [%d of %lu]",
issuer->pid, value + 1, comms_size);
break;
}
case SIMCALL_COMM_TESTANY:
if (value == -1) {
if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] TestAny FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer));
+ label = simgrid::xbt::string_printf("[(%ld)%s] TestAny FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer));
else
- label = simgrid::xbt::string_printf("[(%lu)] TestAny FALSE", issuer->pid);
+ label = simgrid::xbt::string_printf("[(%ld)] TestAny FALSE", issuer->pid);
} else {
if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] TestAny TRUE [%d of %lu]", issuer->pid,
+ label = simgrid::xbt::string_printf("[(%ld)%s] TestAny TRUE [%d of %lu]", issuer->pid,
MC_smx_actor_get_host_name(issuer), value + 1,
simcall_comm_testany__get__count(req));
else
- label = simgrid::xbt::string_printf("[(%lu)] TestAny TRUE [%d of %lu]",
+ label = simgrid::xbt::string_printf("[(%ld)] TestAny TRUE [%d of %lu]",
issuer->pid,
value + 1,
simcall_comm_testany__get__count(req));
break;
case SIMCALL_MUTEX_TRYLOCK:
- label = simgrid::xbt::string_printf("[(%lu)] Mutex TRYLOCK", issuer->pid);
+ label = simgrid::xbt::string_printf("[(%ld)] Mutex TRYLOCK", issuer->pid);
break;
case SIMCALL_MUTEX_LOCK:
- label = simgrid::xbt::string_printf("[(%lu)] Mutex LOCK", issuer->pid);
+ label = simgrid::xbt::string_printf("[(%ld)] Mutex LOCK", issuer->pid);
break;
case SIMCALL_MC_RANDOM:
if (issuer->host)
- label = simgrid::xbt::string_printf("[(%lu)%s] MC_RANDOM (%d)", issuer->pid, MC_smx_actor_get_host_name(issuer),
+ label = simgrid::xbt::string_printf("[(%ld)%s] MC_RANDOM (%d)", issuer->pid, MC_smx_actor_get_host_name(issuer),
value);
else
- label = simgrid::xbt::string_printf("[(%lu)] MC_RANDOM (%d)", issuer->pid, value);
+ label = simgrid::xbt::string_printf("[(%ld)] MC_RANDOM (%d)", issuer->pid, value);
break;
default:
/** \ingroup msg_simulation
* \brief Kill all running process
- * \param reset_PIDs should we reset the PID numbers. A negative
- * number means no reset and a positive number will be used to set the PID
- * of the next newly created process.
*/
-int MSG_process_killall(int reset_PIDs)
+int MSG_process_killall()
{
- simcall_process_killall(reset_PIDs);
+ simcall_process_killall();
return 0;
}
void Actor::kill(aid_t pid)
{
+ smx_actor_t killer = SIMIX_process_self();
smx_actor_t process = SIMIX_process_from_PID(pid);
if(process != nullptr) {
- simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); });
+ simgrid::simix::kernelImmediate([killer, process] { SIMIX_process_kill(process, killer); });
} else {
std::ostringstream oss;
- oss << "kill: ("<< pid <<") - No such process" << std::endl;
+ oss << "kill: (" << pid << ") - No such actor" << std::endl;
throw std::runtime_error(oss.str());
}
}
-smx_actor_t Actor::getImpl() {
- return pimpl_;
-}
-
void Actor::kill() {
smx_actor_t process = SIMIX_process_self();
simgrid::simix::kernelImmediate(
[this, process] { SIMIX_process_kill(pimpl_, (pimpl_ == simix_global->maestro_process) ? pimpl_ : process); });
}
+smx_actor_t Actor::getImpl()
+{
+ return pimpl_;
+}
+
// ***** Static functions *****
ActorPtr Actor::byPid(aid_t pid)
void Actor::killAll()
{
- simcall_process_killall(1);
-}
-
-void Actor::killAll(int resetPid)
-{
- simcall_process_killall(resetPid);
+ simcall_process_killall();
}
std::map<std::string, std::string>* Actor::getProperties()
return;
}
- XBT_DEBUG("Killing process %s@%s", process->getCname(), process->host->getCname());
+ XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", issuer->getCname(), issuer->host->getCname(), process->getCname(),
+ process->host->getCname());
process->context->iwannadie = 1;
process->blocked = 0;
}
-void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid) {
- SIMIX_process_killall(simcall->issuer, reset_pid);
+void simcall_HANDLER_process_killall(smx_simcall_t simcall)
+{
+ SIMIX_process_killall(simcall->issuer);
}
/**
* \brief Kills all running processes.
* \param issuer this one will not be killed
*/
-void SIMIX_process_killall(smx_actor_t issuer, int reset_pid)
+void SIMIX_process_killall(smx_actor_t issuer)
{
for (auto const& kv : simix_global->process_list)
if (kv.second != issuer)
SIMIX_process_kill(kv.second, issuer);
-
- if (reset_pid > 0)
- simix_process_maxpid = reset_pid;
}
void SIMIX_process_change_host(smx_actor_t actor, sg_host_t dest)
XBT_PRIVATE void SIMIX_process_runall();
XBT_PRIVATE void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer);
-XBT_PRIVATE void SIMIX_process_killall(smx_actor_t issuer, int reset_pid);
+XBT_PRIVATE void SIMIX_process_killall(smx_actor_t issuer);
XBT_PRIVATE void SIMIX_process_cleanup(smx_actor_t arg);
XBT_PRIVATE void SIMIX_process_empty_trash();
XBT_PRIVATE void SIMIX_process_yield(smx_actor_t self);
* \ingroup simix_process_management
* \brief Kills all SIMIX processes.
*/
-void simcall_process_killall(int reset_pid)
+void simcall_process_killall()
{
- simcall_BODY_process_killall(reset_pid);
+ simcall_BODY_process_killall();
}
/**
*/
#include "src/simix/popping_private.hpp"
-static inline int simcall_process_killall__get__reset_pid(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<int>(simcall->args[0]);
-}
-static inline int simcall_process_killall__getraw__reset_pid(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<int>(simcall->args[0]);
-}
-static inline void simcall_process_killall__set__reset_pid(smx_simcall_t simcall, int arg)
-{
- simgrid::simix::marshal<int>(simcall->args[0], arg);
-}
-
static inline smx_actor_t simcall_process_cleanup__get__process(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
/* The prototype of all simcall handlers, automatically generated for you */
-XBT_PRIVATE void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid);
+XBT_PRIVATE void simcall_HANDLER_process_killall(smx_simcall_t simcall);
XBT_PRIVATE void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t process);
XBT_PRIVATE void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout);
XBT_PRIVATE void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration);
return simgrid::simix::unmarshal<R>(self->simcall.result);
}
-inline static void simcall_BODY_process_killall(int reset_pid)
+inline static void simcall_BODY_process_killall()
{
if (0) /* Go to that function to follow the code flow through the simcall barrier */
- simcall_HANDLER_process_killall(&SIMIX_process_self()->simcall, reset_pid);
- return simcall<void, int>(SIMCALL_PROCESS_KILLALL, reset_pid);
+ simcall_HANDLER_process_killall(&SIMIX_process_self()->simcall);
+ return simcall<void>(SIMCALL_PROCESS_KILLALL);
}
inline static void simcall_BODY_process_cleanup(smx_actor_t process)
return;
switch (simcall->call) {
case SIMCALL_PROCESS_KILLALL:
- simcall_HANDLER_process_killall(simcall, simgrid::simix::unmarshal<int>(simcall->args[0]));
+ simcall_HANDLER_process_killall(simcall);
SIMIX_simcall_answer(simcall);
break;
# Last but not the least, you should declare the new simix call in
# ./include/simgrid/simix.h (otherwise you will get a warning at compile time)
-void process_killall(int reset_pid);
+void process_killall();
void process_cleanup(smx_actor_t process) [[nohandler]];
void process_suspend(smx_actor_t process) [[block]];
int process_join(smx_actor_t process, double timeout) [[block]];
#endif
/* Kill all processes (but maestro) */
- SIMIX_process_killall(simix_global->maestro_process, 1);
+ SIMIX_process_killall(simix_global->maestro_process);
SIMIX_context_runall();
SIMIX_process_empty_trash();
/** Wake up all processes waiting for a Surf action to finish */
static void SIMIX_wake_processes()
{
- simgrid::kernel::resource::Action* action;
-
for (auto const& model : *all_existing_models) {
+ simgrid::kernel::resource::Action* action;
+
XBT_DEBUG("Handling the processes whose action failed (if any)");
while ((action = surf_model_extract_failed_action_set(model))) {
XBT_DEBUG(" Handling Action %p",action);
if (boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(process->waiting_synchro) != nullptr)
synchro_description = "I/O";
- XBT_INFO("Process %lu (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid,
+ XBT_INFO("Process %ld (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid,
process->getCname(), process->host->getCname(), synchro_description, process->waiting_synchro.get(),
process->waiting_synchro->name.c_str(), (int)process->waiting_synchro->state);
}
else {
- XBT_INFO("Process %lu (%s@%s)", process->pid, process->getCname(), process->host->getCname());
+ XBT_INFO("Process %ld (%s@%s)", process->pid, process->getCname(), process->host->getCname());
}
}
}
smpi_container(rank)->getState("MPI_STATE")->popEvent();
}
-void TRACE_smpi_sleeping_init(int rank) // FIXME: this function is never called
-{
- //first use, initialize the color in the trace
- if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
- smpi_container(rank)->getState("MPI_STATE")->addEntityValue("sleeping", instr_find_color("sleeping"));
-}
-
void TRACE_smpi_sleeping_in(int rank, double duration)
{
if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
argv_ = argv;
// set the process attached to the mailbox
mailbox_small_->setReceiver(process_);
- XBT_DEBUG("<%lu> SMPI process has been initialized: %p", process_->getPid(), process_.get());
+ XBT_DEBUG("<%ld> SMPI process has been initialized: %p", process_->getPid(), process_.get());
}
/** @brief Prepares the current process for termination. */
void Process::finalize()
{
state_ = SMPI_FINALIZED;
- XBT_DEBUG("<%lu> Process left the game", process_->getPid());
+ XBT_DEBUG("<%ld> Process left the game", process_->getPid());
// This leads to an explosion of the search graph which cannot be reduced:
if(MC_is_active() || MC_record_replay_is_active())
"to allow big allocations.\n",
size >> 20);
if(use_huge_page)
- mem = (void*)ALIGN_UP((uint64_t)allocated_ptr, HUGE_PAGE_SIZE);
+ mem = (void*)ALIGN_UP((int64_t)allocated_ptr, HUGE_PAGE_SIZE);
else
mem = allocated_ptr;
if(i_block < nb_shared_blocks-1)
xbt_assert(stop_offset < shared_block_offsets[2*i_block+2],
"stop_offset (%zu) should be lower than its successor start offset (%zu)", stop_offset, shared_block_offsets[2*i_block+2]);
- size_t start_block_offset = ALIGN_UP(start_offset, smpi_shared_malloc_blocksize);
- size_t stop_block_offset = ALIGN_DOWN(stop_offset, smpi_shared_malloc_blocksize);
+ size_t start_block_offset = ALIGN_UP((int64_t)start_offset, smpi_shared_malloc_blocksize);
+ size_t stop_block_offset = ALIGN_DOWN((int64_t)stop_offset, smpi_shared_malloc_blocksize);
for (size_t offset = start_block_offset; offset < stop_block_offset; offset += smpi_shared_malloc_blocksize) {
XBT_DEBUG("\t\tglobal shared allocation, mmap block offset %zx", offset);
void* pos = (void*)((unsigned long)mem + offset);
"and that the directory you are passing is mounted correctly (mount /path/to/huge -t hugetlbfs -o rw,mode=0777).",
strerror(errno));
}
- size_t low_page_start_offset = ALIGN_UP(start_offset, PAGE_SIZE);
- size_t low_page_stop_offset = start_block_offset < ALIGN_DOWN(stop_offset, PAGE_SIZE) ? start_block_offset : ALIGN_DOWN(stop_offset, PAGE_SIZE);
+ size_t low_page_start_offset = ALIGN_UP((int64_t)start_offset, PAGE_SIZE);
+ size_t low_page_stop_offset = (int64_t)start_block_offset < ALIGN_DOWN((int64_t)stop_offset, PAGE_SIZE) ? start_block_offset : ALIGN_DOWN((int64_t)stop_offset, (int64_t)PAGE_SIZE);
if(low_page_start_offset < low_page_stop_offset) {
XBT_DEBUG("\t\tglobal shared allocation, mmap block start");
void* pos = (void*)((unsigned long)mem + low_page_start_offset);
}
if(low_page_stop_offset <= stop_block_offset) {
XBT_DEBUG("\t\tglobal shared allocation, mmap block stop");
- size_t high_page_stop_offset = stop_offset == size ? size : ALIGN_DOWN(stop_offset, PAGE_SIZE);
+ size_t high_page_stop_offset = stop_offset == size ? size : ALIGN_DOWN((int64_t)stop_offset, PAGE_SIZE);
if(high_page_stop_offset > stop_block_offset) {
void* pos = (void*)((unsigned long)mem + stop_block_offset);
void* res = mmap(pos, high_page_stop_offset-stop_block_offset, PROT_READ | PROT_WRITE, mmap_base_flag, // not a full huge page
}
char* F2C::get_key_id(char* key, int id) {
- std::snprintf(key, KEY_SIZE, "%x_%lu", static_cast<unsigned>(id), simgrid::s4u::Actor::self()->getPid());
+ std::snprintf(key, KEY_SIZE, "%x_%ld", static_cast<unsigned>(id), simgrid::s4u::Actor::self()->getPid());
return key;
}
{
MPI_Request requests[2];
MPI_Status stats[2];
- unsigned int myid = simgrid::s4u::Actor::self()->getPid();
+ int myid = simgrid::s4u::Actor::self()->getPid();
if ((comm->group()->actor(dst)->getPid() == myid) && (comm->group()->actor(src)->getPid() == myid)){
Datatype::copy(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype);
if(status !=MPI_STATUS_IGNORE){
* @param requestedCores The desired amount of cores. Must be >= 1
* @return The CpuAction corresponding to the processing
*/
- virtual simgrid::kernel::resource::Action* execution_start(double size, int requestedCores)
- {
- THROW_UNIMPLEMENTED;
- return nullptr;
- }
+ virtual simgrid::kernel::resource::Action* execution_start(double size, int requestedCores) = 0;
/**
* @brief Make a process sleep for duration (in seconds)
bool isUsed() override;
CpuAction *execution_start(double size) override;
+ simgrid::kernel::resource::Action* execution_start(double size, int requestedCores) override
+ {
+ THROW_UNIMPLEMENTED;
+ return nullptr;
+ }
CpuAction *sleep(double duration) override;
double getAvailableSpeed() override;
bool isUsed() override;
void apply_event(tmgr_trace_event_t event, double value) override;
kernel::resource::Action* execution_start(double size) override;
+ simgrid::kernel::resource::Action* execution_start(double size, int requestedCores) override
+ {
+ THROW_UNIMPLEMENTED;
+ return nullptr;
+ }
kernel::resource::Action* sleep(double duration) override;
protected:
}
THROWF(not_found_error, 0, "Element %p not part of dynar %p", elem, dynar);
- return -1; // Won't happen, just to please eclipse
+ return 0; // Won't happen, just to please eclipse
}
/** @brief Returns the position of the element in the dynar (or -1 if not found)
static void worker()
{
simgrid::s4u::this_actor::sleep_for(.5);
- XBT_INFO("Worker started (PID:%lu, PPID:%lu)", simgrid::s4u::this_actor::getPid(),
+ XBT_INFO("Worker started (PID:%ld, PPID:%ld)", simgrid::s4u::this_actor::getPid(),
simgrid::s4u::this_actor::getPpid());
while (1) {
XBT_INFO("Plop i am %ssuspended", simgrid::s4u::this_actor::isSuspended() ? "" : "not ");
simgrid::s4u::this_actor::getHost()->actorList(actor_list);
for (auto const& actor : *actor_list) {
- XBT_INFO("Actor (pid=%lu, ppid=%lu, name=%s)", actor->getPid(), actor->getPpid(), actor->getCname());
+ XBT_INFO("Actor (pid=%ld, ppid=%ld, name=%s)", actor->getPid(), actor->getPpid(), actor->getCname());
if (simgrid::s4u::this_actor::getPid() != actor->getPid())
actor->kill();
}
simgrid::s4u::Actor::createActor("worker from master", simgrid::s4u::this_actor::getHost(), worker);
simgrid::s4u::this_actor::sleep_for(2);
- XBT_INFO("Suspend Actor (pid=%lu)", actor->getPid());
+ XBT_INFO("Suspend Actor (pid=%ld)", actor->getPid());
actor->suspend();
- XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not ");
+ XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not ");
simgrid::s4u::this_actor::sleep_for(2);
- XBT_INFO("Resume Actor (pid=%lu)", actor->getPid());
+ XBT_INFO("Resume Actor (pid=%ld)", actor->getPid());
actor->resume();
- XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not ");
+ XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not ");
simgrid::s4u::this_actor::sleep_for(2);
actor->kill();
simgrid::s4u::Engine e(&argc, argv);
e.loadPlatform(argv[1]);
- if (argc > 2)
- simgrid::s4u::Actor::killAll(atoi(argv[2]));
- else
- simgrid::s4u::Actor::killAll();
+ simgrid::s4u::Actor::killAll();
simgrid::s4u::Actor::createActor("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid);
simgrid::s4u::Actor::createActor("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid);
> [ 0.001206] (sendpid@Tremblay) Send of pid "3" done.
> [ 0.001206] (killall@Tremblay) Killing process "3".
> [ 0.001206] (sendpid@Tremblay) Process "3" killed.
-
-$ ./pid ${platfdir}/small_platform.xml 2 "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
-> [ 0.000000] (sendpid@Tremblay) Sending pid of "2".
-> [ 0.000000] (sendpid@Tremblay) Sending pid of "3".
-> [ 0.000000] (sendpid@Tremblay) Sending pid of "4".
-> [ 0.000402] (killall@Tremblay) Killing process "2".
-> [ 0.000402] (sendpid@Tremblay) Send of pid "2" done.
-> [ 0.000402] (sendpid@Tremblay) Process "2" killed.
-> [ 0.000804] (sendpid@Tremblay) Send of pid "3" done.
-> [ 0.000804] (killall@Tremblay) Killing process "3".
-> [ 0.000804] (sendpid@Tremblay) Process "3" killed.
-> [ 0.001206] (sendpid@Tremblay) Send of pid "4" done.
-> [ 0.001206] (killall@Tremblay) Killing process "4".
-> [ 0.001206] (sendpid@Tremblay) Process "4" killed.
#define ERROR_MARGIN 0.5
-static int verbose = 0;
-
int main(int argc, char *argv[])
{
char *sbuf, *rbuf;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
- if (getenv("MPITEST_VERBOSE"))
- verbose = 1;
-
/* Allocate memory regions to communicate */
sbuf = (char *) malloc(SIZE);
rbuf = (char *) malloc(size * SIZE);
#endif
#include "mpi.h"
-static int verbose = 0;
-
int main(int argc, char *argv[]);
int parse_args(int argc, char **argv);
* {
* switch (ret) {
* case 'v':
- * verbose = 1;
+ * verbose = 1; <-- never used, thus removed
* break;
* }
* }
*/
- if (argc > 1 && strcmp(argv[1], "-v") == 0)
- verbose = 1;
return 0;
}
if(CMAKE_COMPILER_IS_GNUCC)
set(warnCFLAGS "${warnCFLAGS} -Wclobbered -Wno-error=clobbered -Wno-unused-local-typedefs -Wno-error=attributes")
endif()
+ if (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+ # ignore remark #1418: external function definition with no prior declaration
+ # 3179: deprecated conversion of string literal to char* (should be const char*)
+ # 191: type qualifier is meaningless on cast type
+ set(warnCFLAGS "${warnCFLAGS} -wd1418 -wd191 -wd3179")
+ endif()
set(warnCXXFLAGS "${warnCFLAGS} -Wall -Wextra -Wunused -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing")
if(CMAKE_COMPILER_IS_GNUCXX AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0")))