Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 4 Mar 2016 20:00:14 +0000 (21:00 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 4 Mar 2016 20:00:14 +0000 (21:00 +0100)
15 files changed:
ChangeLog.SimGrid-java
examples/java/cloud/migration/XVM.java
examples/msg/cloud/bound.c
examples/msg/cloud/multicore.c
examples/msg/properties/msg_prop.c
include/simgrid/msg.h
src/bindings/java/jmsg_host.cpp
src/bindings/java/jmsg_vm.cpp
src/bindings/java/jmsg_vm.h
src/bindings/java/org/simgrid/msg/VM.java
src/msg/msg_host.cpp
src/msg/msg_vm.cpp
src/simix/BoostContext.cpp
src/simix/BoostContext.hpp
src/simix/RawContext.cpp

index d66e6b7..5500d4f 100644 (file)
@@ -1,5 +1,11 @@
 ChangeLog for SimGrid-java, before its integration into the main source tree.
 
+SimGrid (3.13) UNRELEASED; urgency=low
+
+ Backwards Compatibility breaks
+   - VM.setBound(int load) is now VM.setBound(double bound) to meet the MSG semantics. Use VM.getSpeed()*load/100 for the legacy behavior.
+
+
 SimGrid-java (3.9) stable; urgency=low
 
  -- 2013-01-30 Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
index f34da08..b62529e 100644 (file)
@@ -32,7 +32,7 @@ public class XVM extends VM {
 
   public void setLoad(int load){  
     if (load >0) {
-      this.setBound(load);
+      this.setBound(this.getSpeed()*load/100);
       //    this.getDaemon().setLoad(load);
       daemon.resume();
     } else{
index 06a059b..ffb7387 100644 (file)
@@ -96,7 +96,7 @@ static void test_dynamic_change(void)
   double task1_remain_prev = MSG_task_get_flops_amount(task1);
 
   {
-    const double cpu_speed = MSG_get_host_speed(pm0);
+    const double cpu_speed = MSG_host_get_speed(pm0);
     int i = 0;
     for (i = 0; i < 10; i++) {
       double new_bound = (cpu_speed / 10) * i;
@@ -129,7 +129,7 @@ static void test_dynamic_change(void)
 
 static void test_one_task(msg_host_t hostA)
 {
-  const double cpu_speed = MSG_get_host_speed(hostA);
+  const double cpu_speed = MSG_host_get_speed(hostA);
   const double computation_amount = cpu_speed * 10;
   const char *hostA_name = MSG_host_get_name(hostA);
 
@@ -174,8 +174,8 @@ static void test_one_task(msg_host_t hostA)
 
 static void test_two_tasks(msg_host_t hostA, msg_host_t hostB)
 {
-  const double cpu_speed = MSG_get_host_speed(hostA);
-  xbt_assert(cpu_speed == MSG_get_host_speed(hostB));
+  const double cpu_speed = MSG_host_get_speed(hostA);
+  xbt_assert(cpu_speed == MSG_host_get_speed(hostB));
   const double computation_amount = cpu_speed * 10;
   const char *hostA_name = MSG_host_get_name(hostA);
   const char *hostB_name = MSG_host_get_name(hostB);
@@ -288,7 +288,7 @@ static int master_main(int argc, char *argv[])
 
   {
     msg_host_t vm0 = MSG_vm_create_core(pm0, "VM0");
-    const double cpu_speed = MSG_get_host_speed(pm0);
+    const double cpu_speed = MSG_host_get_speed(pm0);
     MSG_vm_set_bound(vm0, cpu_speed / 10);
     MSG_vm_start(vm0);
 
@@ -317,7 +317,7 @@ static int master_main(int argc, char *argv[])
     MSG_host_set_params(vm0, &params);
     MSG_vm_start(vm0);
 
-    const double cpu_speed = MSG_get_host_speed(pm0);
+    const double cpu_speed = MSG_host_get_speed(pm0);
     MSG_vm_start(vm0);
 
     XBT_INFO("# 10. Test migration");
index 32229cf..c8ad9f6 100644 (file)
@@ -335,11 +335,11 @@ int main(int argc, char *argv[])
   msg_host_t pm2 = xbt_dynar_get_as(hosts_dynar, 2, msg_host_t);
 
   XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm0), MSG_host_get_core_number(pm0),
-           MSG_get_host_speed(pm0));
+           MSG_host_get_speed(pm0));
   XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm1), MSG_host_get_core_number(pm1),
-           MSG_get_host_speed(pm1));
+           MSG_host_get_speed(pm1));
   XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm2), MSG_host_get_core_number(pm2),
-           MSG_get_host_speed(pm2));
+           MSG_host_get_speed(pm2));
 
   MSG_process_create("master", master_main, NULL, pm0);
 
index 8e05705..caae47f 100644 (file)
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
   hosts = MSG_hosts_as_dynar();
 
   xbt_dynar_foreach(hosts, i, host){
-    XBT_INFO("Host '%s' runs at %.0f flops/s",MSG_host_get_name(host), MSG_get_host_speed(host));
+    XBT_INFO("Host '%s' runs at %.0f flops/s",MSG_host_get_name(host), MSG_host_get_speed(host));
   }
 
   MSG_launch_application(argv[2]);
index c1a2cf3..562f659 100644 (file)
@@ -284,12 +284,16 @@ XBT_PUBLIC(void *) MSG_host_get_data(msg_host_t host);
 XBT_PUBLIC(void) MSG_host_on(msg_host_t host);
 XBT_PUBLIC(void) MSG_host_off(msg_host_t host);
 XBT_PUBLIC(msg_host_t) MSG_host_self(void);
-XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h);
+XBT_PUBLIC(double) MSG_host_get_speed(msg_host_t h);
 XBT_PUBLIC(int) MSG_host_get_core_number(msg_host_t h);
 XBT_PUBLIC(xbt_swag_t) MSG_host_get_process_list(msg_host_t h);
 XBT_PUBLIC(int) MSG_host_is_on(msg_host_t h);
 XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h);
 
+// deprecated
+XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h);
+
+
 XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate);
 XBT_PUBLIC(double) MSG_host_get_current_power_peak(msg_host_t h);
 XBT_PUBLIC(int)    MSG_host_get_nb_pstates(msg_host_t h);
index dba26b2..98e5094 100644 (file)
@@ -186,7 +186,7 @@ Java_org_simgrid_msg_Host_getSpeed(JNIEnv * env,
     return -1;
   }
 
-  return (jdouble) MSG_get_host_speed(host);
+  return (jdouble) MSG_host_get_speed(host);
 }
 
 JNIEXPORT jdouble JNICALL
index 3eb6c15..60c6609 100644 (file)
@@ -77,11 +77,10 @@ Java_org_simgrid_msg_VM_isRestoring(JNIEnv * env, jobject jvm) {
 }
 
 JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_setBound(JNIEnv *env, jobject jvm, jint load) { 
+Java_org_simgrid_msg_VM_setBound(JNIEnv *env, jobject jvm, jdouble bound) { 
 
   msg_vm_t vm = jvm_get_native(env,jvm);
-  double bound = MSG_get_host_speed(vm) * load / 100;
-  MSG_vm_set_bound(vm, bound); 
+  MSG_vm_set_bound(vm, bound);
 }
 
 JNIEXPORT void JNICALL
@@ -158,46 +157,3 @@ Java_org_simgrid_msg_VM_restore(JNIEnv *env, jobject jvm) {
   msg_vm_t vm = jvm_get_native(env,jvm);
   MSG_vm_restore(vm);
 }
-
-
-
-JNIEXPORT jobject JNICALL
-Java_org_simgrid_msg_VM_get_pm(JNIEnv *env, jobject jvm) {
-  jobject jhost;
-  msg_vm_t vm = jvm_get_native(env,jvm);
-  msg_host_t host = MSG_vm_get_pm(vm);
-
-  if (!host->extension(JAVA_HOST_LEVEL)) {
-    THROW_DEADCODE;
-    /* the native host not yet associated with the java host instance */
-
-    /* instanciate a new java host instance */
-    jhost = jhost_new_instance(env);
-
-    if (!jhost) {
-      jxbt_throw_jni(env, "java host instantiation failed");
-      return NULL;
-    }
-
-    /* get a global reference to the newly created host */
-    jhost = jhost_ref(env, jhost);
-
-    if (!jhost) {
-      jxbt_throw_jni(env, "global ref allocation failed");
-      return NULL;
-    }
-    /* Sets the host name */
-    const char *name = MSG_host_get_name(host);
-    jobject jname = env->NewStringUTF(name);
-    env->SetObjectField(jhost, jxbt_get_jfield(env,
-      env->FindClass("org/simgrid/msg/Host"), "name", "Ljava/lang/String;"),
-      jname);
-    /* Bind & store it */
-    jhost_bind(jhost, host, env);
-    host->extension_set(JAVA_HOST_LEVEL, (void *) jhost);
-  } else {
-    jhost = (jobject) host->extension(JAVA_HOST_LEVEL);
-  }
-
-  return jhost;
-}
index 1ed5e3b..12de5fd 100644 (file)
@@ -84,10 +84,10 @@ Java_org_simgrid_msg_VM_isRestoring(JNIEnv *env, jobject jvm);
 /**
  * Class      org_simgrid_msg_VM
  * Method      setBound
- * Signature  ()B
+ * Signature  (D)B
  */
 JNIEXPORT void JNICALL
-Java_org_simgrid_msg_VM_setBound(JNIEnv *env, jobject jvm, jint load); 
+Java_org_simgrid_msg_VM_setBound(JNIEnv *env, jobject jvm, jdouble bound); 
 
 /**
  * Class            org_simgrid_msg_VM
@@ -149,15 +149,12 @@ JNIEXPORT void JNICALL
 Java_org_simgrid_msg_VM_save(JNIEnv *env, jobject jvm);
 /**
  * Class            org_simgrid_msg_VM
- * Method           save
+ * Method           restore
  * Signature    ()V
  */
 JNIEXPORT void JNICALL
 Java_org_simgrid_msg_VM_restore(JNIEnv *env, jobject jvm);
 
-JNIEXPORT jobject JNICALL
-Java_org_simgrid_msg_VM_get_pm(JNIEnv *env, jobject jvm);
-
 SG_END_DECL()
 
 #endif
index 77cdaee..6752b0b 100644 (file)
@@ -131,10 +131,10 @@ public class VM extends Host{
 
 
        /**
-        * Bound the VM to a certain % of its vcpu capability (e.g. 75% of vm.getSpeed())
-        * @param load percentage (between [0,100]
+        * Set a CPU bound for a given VM.
+        * @param bound in flops/s
         */
-       public native void setBound(int load);
+       public native void setBound(double bound);
 
        /**
         * start the VM
index feb4f97..c5e8a47 100644 (file)
@@ -146,10 +146,20 @@ xbt_dynar_t MSG_hosts_as_dynar(void) {
 /** \ingroup m_host_management
  * \brief Return the speed of the processor (in flop/s), regardless of the current load on the machine.
  */
-double MSG_get_host_speed(msg_host_t host) {
+double MSG_host_get_speed(msg_host_t host) {
   return host->speed();
 }
 
+/** \ingroup m_host_management
+ * \brief Return the speed of the processor (in flop/s), regardless of the current load on the machine.
+ * Deprecated: use MSG_host_get_speed
+ */
+double MSG_get_host_speed(msg_host_t host) {
+  XBT_WARN("MSG_get_host_speed is deprecated: use MSG_host_get_speed");
+  return MSG_host_get_speed(host);
+}
+
+
 /** \ingroup m_host_management
  * \brief Return the number of cores.
  *
index dd1747e..2e11d89 100644 (file)
@@ -180,7 +180,7 @@ msg_vm_t MSG_vm_create(msg_host_t pm, const char *name,
 {
   /* For the moment, intensity_rate is the percentage against the migration
    * bandwidth */
-  double host_speed = MSG_get_host_speed(pm);
+  double host_speed = MSG_host_get_speed(pm);
   double update_speed = ((double)dp_intensity/100) * mig_netspeed;
 
   msg_vm_t vm = MSG_vm_create_core(pm, name);
index 9972e78..3a7ea34 100644 (file)
@@ -55,7 +55,7 @@ public:
 
 bool                BoostContext::parallel_        = false;
 xbt_parmap_t        BoostContext::parmap_          = nullptr;
-uintptr_t       BoostContext::threads_working_ = 0;
+uintptr_t           BoostContext::threads_working_ = 0;
 xbt_os_thread_key_t BoostContext::worker_id_key_;
 unsigned long       BoostContext::process_index_   = 0;
 BoostContext*       BoostContext::maestro_context_ = nullptr;
index 62b6066..032e116 100644 (file)
@@ -31,7 +31,7 @@ protected: // static
   static bool parallel_;
   static xbt_parmap_t parmap_;
   static std::vector<BoostContext*> workers_context_;
-  static unsigned long threads_working_;
+  static uintptr_t threads_working_;
   static xbt_os_thread_key_t worker_id_key_;
   static unsigned long process_index_;
   static BoostContext* maestro_context_;
index 83c3c75..bb1af0a 100644 (file)
@@ -473,7 +473,7 @@ void RawContext::resume_parallel()
   xbt_os_thread_set_specific(raw_worker_id_key, (void*) worker_id);
   RawContext* worker_context = (RawContext*) SIMIX_context_self();
   raw_workers_context[worker_id] = worker_context;
-  XBT_DEBUG("Saving worker stack %lu", worker_id);
+  XBT_DEBUG("Saving worker stack %zu", worker_id);
   SIMIX_context_set_current(this);
   raw_swapcontext(&worker_context->stack_top_, this->stack_top_);
 #else