From: Martin Quinson Date: Wed, 22 Nov 2017 00:39:06 +0000 (+0100) Subject: Merge branch 'master' of github.com:simgrid/simgrid X-Git-Tag: v3.18~265 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f733ac8e268fb0f6a8afbd44e889ac7e27d16047?hp=1bd1bbd35034c2e93a030a676dc244ad2cf74c70 Merge branch 'master' of github.com:simgrid/simgrid --- diff --git a/ChangeLog b/ChangeLog index 41299260ce..eb74d9a9a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,14 @@ SimGrid (3.18) NOT RELEASED YET (target: December 24 2017) - Storage::getName() changed to return a std::string, use intead Storage::getCname() to get a char*. + MSG + - Deprecate MSG_task_get_flops_amount(). Its semantic was weird: + before the start it returned the total amount of flops; + after it returned the ratio of remaining work. Split it: + MSG_task_get_initial_flops_amount() for first behavior + MSG_task_get_remaining_work_ratio() for the second one. + This fixes GitHub's #223 using PR #237. Thanks Michael Mercier. + XBT - Define class simgrid::xbt::Path to manage file names. - Removed unused functions: @@ -15,6 +23,9 @@ SimGrid (3.18) NOT RELEASED YET (target: December 24 2017) - xbt/str.h: xbt_str_join() - xbt/heap.h: use std::priority_queue or boost::heap instead + PLUGINS: + - New link_energy plugin for the consumption of the links. + XML - Remove the undocumented/untested tag diff --git a/examples/msg/energy-consumption/energy-consumption.c b/examples/msg/energy-consumption/energy-consumption.c index cf5c6384e6..19b93a6ca2 100644 --- a/examples/msg/energy-consumption/energy-consumption.c +++ b/examples/msg/energy-consumption/energy-consumption.c @@ -26,7 +26,7 @@ static int dvfs(int argc, char *argv[]) // Run a task start = MSG_get_clock(); msg_task_t task1 = MSG_task_create ("t1", 100E6, 0, NULL); - XBT_INFO("Run a task of %.0E flops",MSG_task_get_flops_amount(task1)); + XBT_INFO("Run a task of %.0E flops", MSG_task_get_initial_flops_amount(task1)); MSG_task_execute (task1); MSG_task_destroy(task1); XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW" @@ -43,7 +43,7 @@ static int dvfs(int argc, char *argv[]) // Run a second task start = MSG_get_clock(); task1 = MSG_task_create ("t2", 100E6, 0, NULL); - XBT_INFO("Run a task of %.0E flops",MSG_task_get_flops_amount(task1)); + XBT_INFO("Run a task of %.0E flops", MSG_task_get_initial_flops_amount(task1)); MSG_task_execute (task1); MSG_task_destroy(task1); XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", diff --git a/examples/msg/trace-masterworker/trace-masterworker.c b/examples/msg/trace-masterworker/trace-masterworker.c index 2ebf78d686..56cb7a3051 100644 --- a/examples/msg/trace-masterworker/trace-masterworker.c +++ b/examples/msg/trace-masterworker/trace-masterworker.c @@ -53,9 +53,9 @@ static int worker(int argc, char *argv[]) MSG_task_destroy(task); break; } - //adding the value returned by MSG_task_get_compute_duration(task) - //to the variable "task_computation" - TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()), "task_computation", MSG_task_get_flops_amount(task)); + // adding the value returned by MSG_task_get_compute_duration(task) to the variable "task_computation" + TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()), "task_computation", + MSG_task_get_initial_flops_amount(task)); MSG_task_execute(task); MSG_task_destroy(task); task = NULL; diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 9fd43cb381..b3284ad436 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -379,16 +379,10 @@ XBT_PUBLIC(msg_error_t) MSG_process_join(msg_process_t process, double timeout); XBT_PUBLIC(msg_error_t) MSG_process_sleep(double nb_sec); XBT_PUBLIC(void) MSG_task_set_flops_amount(msg_task_t task, double flops_amount); -/* Unable to compile that without -Werror=deprecated-declarations -XBT_ATTRIB_DEPRECATED_v321( "Use MSG_task_get_initial_flops_amount if you want to get initial amounts of flops, or " - "Use MSG_task_get_remaining_work_ratio to get task progress (in order " - "to compute progress in flops)") static inline double MSG_task_get_flops_amount(msg_task_t task) -{ - return MSG_task_get_flops_amount(task); -} -*/ - -XBT_PUBLIC(double) MSG_task_get_flops_amount(msg_task_t task); +XBT_ATTRIB_DEPRECATED_v321("Use MSG_task_get_initial_flops_amount if you want to get initial amounts of flops, or " + "Use MSG_task_get_remaining_work_ratio to get task progress (in order " + "to compute progress in flops)") XBT_PUBLIC(double) + MSG_task_get_flops_amount(msg_task_t task); XBT_PUBLIC(double) MSG_task_get_initial_flops_amount(msg_task_t task); XBT_PUBLIC(double) MSG_task_get_remaining_work_ratio(msg_task_t task); XBT_PUBLIC(void) MSG_task_set_bytes_amount(msg_task_t task, double bytes_amount); diff --git a/src/bindings/java/jmsg_process.cpp b/src/bindings/java/jmsg_process.cpp index ad3f399432..1d4b58eadf 100644 --- a/src/bindings/java/jmsg_process.cpp +++ b/src/bindings/java/jmsg_process.cpp @@ -91,6 +91,18 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject env->SetIntField(jprocess, jprocess_field_Process_ppid, (jint) MSG_process_get_PPID(process)); } +JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_daemonize(JNIEnv* env, jobject jprocess) +{ + msg_process_t process = jprocess_to_native(jprocess, env); + + if (not process) { + jxbt_throw_notbound(env, "process", jprocess); + return; + } + + MSG_process_daemonize(process); +} + JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv * env, jclass cls, jint jresetPID) { return (jint) MSG_process_killall((int) jresetPID); diff --git a/src/bindings/java/jmsg_process.h b/src/bindings/java/jmsg_process.h index f77182435a..597f5b270d 100644 --- a/src/bindings/java/jmsg_process.h +++ b/src/bindings/java/jmsg_process.h @@ -47,6 +47,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_nativeInit(JNIEnv *env, jcla /* Implement the Java API */ 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 jobject JNICALL Java_org_simgrid_msg_Process_fromPID(JNIEnv* env, jclass cls, jint pid); JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getProperty(JNIEnv* env, jobject jprocess, jobject jname); diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index b6675690d7..8af7ea5e86 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -507,7 +507,7 @@ XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process) { */ XBT_PUBLIC(void) MSG_process_daemonize(msg_process_t process) { - simgrid::simix::kernelImmediate([process]() { process->getImpl()->daemonize(); }); + process->daemonize(); } /** @ingroup m_process_management diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 4e485ba3b1..15c3c47005 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -367,7 +367,7 @@ static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug for (auto const& elm : vm->pimpl_vm_->dp_objs) { const std::string& key = elm.first; dirty_page_t dp = elm.second; - double remaining = MSG_task_get_flops_amount(dp->task); + double remaining = MSG_task_get_remaining_work_ratio(dp->task); double clock = MSG_get_clock(); @@ -396,7 +396,7 @@ void MSG_host_add_task(msg_host_t host, msg_task_t task) if (vm == nullptr) return; - double remaining = MSG_task_get_flops_amount(task); + double remaining = MSG_task_get_remaining_work_ratio(task); std::string key = simgrid::xbt::string_printf("%s-%p", task->name, task); dirty_page_t dp = new s_dirty_page; @@ -426,7 +426,7 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task) /* If we are in the middle of dirty page tracking, we record how much computation has been done until now, and keep * the information for the lookup_() function that will called soon. */ if (vm->pimpl_vm_->dp_enabled) { - double remaining = MSG_task_get_flops_amount(task); + double remaining = MSG_task_get_remaining_work_ratio(task); double clock = MSG_get_clock(); double updated = get_computed(key, vm, dp, remaining, clock); // was host instead of vm diff --git a/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.cpp b/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.cpp index 5c22018489..0326f56963 100644 --- a/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.cpp +++ b/teshsuite/msg/task_destroy_cancel/task_destroy_cancel.cpp @@ -98,7 +98,7 @@ static int worker(int /*argc*/, char* /*argv*/ []) MSG_task_execute(task); double end = MSG_get_clock(); XBT_INFO("Task \"%s\" done in %f (amount %f)", MSG_task_get_name(task), end - start, - MSG_task_get_flops_amount(task)); + MSG_task_get_remaining_work_ratio(task)); MSG_task_destroy(task); }