Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Minor changes for fixing dp_intensity at java level - Lucas, don't waste your time...
authoralebre <adrien.lebre@inria.fr>
Tue, 2 Jul 2013 16:52:04 +0000 (18:52 +0200)
committeralebre <adrien.lebre@inria.fr>
Tue, 2 Jul 2013 16:52:04 +0000 (18:52 +0200)
include/msg/msg.h
src/bindings/java/jmsg_vm.c
src/bindings/java/jmsg_vm.h
src/bindings/java/org/simgrid/msg/VM.java
src/msg/msg_vm.c
src/surf/surf.c

index 1c9f81e..73123a7 100644 (file)
@@ -404,7 +404,7 @@ XBT_PUBLIC(const char*) MSG_vm_get_name(msg_vm_t);
 // TODO add VDI later
 XBT_PUBLIC(msg_vm_t) MSG_vm_create_core(msg_host_t location, const char *name);
 XBT_PUBLIC(msg_vm_t) MSG_vm_create(msg_host_t ind_pm, const char *name,
 // TODO add VDI later
 XBT_PUBLIC(msg_vm_t) MSG_vm_create_core(msg_host_t location, const char *name);
 XBT_PUBLIC(msg_vm_t) MSG_vm_create(msg_host_t ind_pm, const char *name,
-    int core_nb, long mem_cap, long net_cap, char *disk_path, long disk_size, long dp_rate, long mig_netspeed);
+    int core_nb, int mem_cap, int net_cap, char *disk_path, int disk_size, int mig_netspeed, int dp_intensity);
 
 XBT_PUBLIC(void) MSG_vm_destroy(msg_vm_t vm);
 
 
 XBT_PUBLIC(void) MSG_vm_destroy(msg_vm_t vm);
 
index b19223a..b5f23f2 100644 (file)
@@ -72,7 +72,7 @@ Java_org_simgrid_msg_VM_isRestoring(JNIEnv * env, jobject jvm) {
 }
 JNIEXPORT void JNICALL
 Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring jname,
 }
 JNIEXPORT void JNICALL
 Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring jname,
-                              jint jncore, jlong jramsize, jlong jnetcap, jstring jdiskpath, jlong jdisksize, jlong jdprate, jlong jmig_netspeed) {
+                              jint jncore, jint jramsize, jint jnetcap, jstring jdiskpath, jint jdisksize, jint jmig_netspeed, jint jdp_intensity) {
 
   msg_host_t host = jhost_get_native(env, jhost);
 
 
   msg_host_t host = jhost_get_native(env, jhost);
 
@@ -85,8 +85,8 @@ Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring
   // disk_path = (*env)->GetStringUTFChars(env, jdiskpath, 0);
   // disk_path = xbt_strdup(disk_path);
 
   // disk_path = (*env)->GetStringUTFChars(env, jdiskpath, 0);
   // disk_path = xbt_strdup(disk_path);
 
-  msg_vm_t vm = MSG_vm_create(host, name, (int) jncore, (long) jramsize,
-                 (long) jnetcap, NULL, (long) jdisksize, (long) jdprate, (long) jmig_netspeed);
+  msg_vm_t vm = MSG_vm_create(host, name, (int) jncore, (int) jramsize,
+                 (int) jnetcap, NULL, (int) jdisksize, (int) jmig_netspeed, (int) jdp_intensity);
 
   jvm_bind(env,jvm,vm);
 }
 
   jvm_bind(env,jvm,vm);
 }
index 7a0ae66..e8f9190 100644 (file)
@@ -87,7 +87,7 @@ Java_org_simgrid_msg_VM_isRestoring(JNIEnv *env, jobject jvm);
  */
 JNIEXPORT void JNICALL
 Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring jname,
  */
 JNIEXPORT void JNICALL
 Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring jname,
-                              jint jncore, jlong jramsize, jlong jnetcap, jstring jdiskpath, jlong jdisksize, jlong dprate, jlong mig_netspeed);
+                              jint jncore, jint jramsize, jint jnetcap, jstring jdiskpath, jint jdisksize, jint dprate, jint mig_netspeed);
 
 /**
  * Class            org_simgrid_msg_VM
 
 /**
  * Class            org_simgrid_msg_VM
index 7083889..538a9ec 100644 (file)
@@ -41,16 +41,16 @@ public class VM extends Host{
         * @param netCap (not used for the moment)
         * @param diskPath (not used for the moment)
         * @param diskSize (not used for the moment)
         * @param netCap (not used for the moment)
         * @param diskPath (not used for the moment)
         * @param diskSize (not used for the moment)
-        * @param dpRate (dirty page rate MB/flop, if you don't know put zero ;))
         * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;))
         * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;))
+        * @param dpIntensity (dirty page percentage according to migNetSpeed, [0-100], if you don't know put zero ;))
         */
        
         */
        
-       public VM(Host host, String name, int nCore,  long ramSize, 
-                       long netCap, String diskPath, long diskSize, long  dpRate,long migNetSpeed){
+       public VM(Host host, String name, int nCore,  int ramSize, 
+                       int netCap, String diskPath, int diskSize, int migNetSpeed, int dpIntensity){
                super();
                super.name = name; 
                this.currentHost = host; 
                super();
                super.name = name; 
                this.currentHost = host; 
-               create(host, name, nCore, ramSize, netCap, diskPath, diskSize, dpRate, migNetSpeed);
+               create(host, name, nCore, ramSize, netCap, diskPath, diskSize, migNetSpeed, dpIntensity);
                VM.addVM(this);
        }
 
                VM.addVM(this);
        }
 
@@ -121,11 +121,11 @@ public class VM extends Host{
         * @param netCap (not used for the moment)
         * @param diskPath (not used for the moment)
         * @param diskSize (not used for the moment)
         * @param netCap (not used for the moment)
         * @param diskPath (not used for the moment)
         * @param diskSize (not used for the moment)
-        * @param dpRate (dirty page rate in MB/flop, if you don't know put zero ;))
         * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;))
         * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;))
+        * @param dpIntensity (dirty page intensity, a percentage of migNetSpeed [0-100],  if you don't know put zero ;))
         */
         */
-       private native void create(Host host, String name, int nCore, long ramSize, 
-                        long netCap, String diskPath, long diskSize, long dpRate, long migNetSpeed);
+       private native void create(Host host, String name, int nCore, int ramSize, 
+                        int netCap, String diskPath, int diskSize, int migNetSpeed, int dpIntensity);
        
        /**
         * start the VM
        
        /**
         * start the VM
index 0c99ccf..4c474e6 100644 (file)
@@ -169,10 +169,14 @@ int MSG_vm_is_restoring(msg_vm_t vm)
  *  All parameters are in MBytes
  *
  */
  *  All parameters are in MBytes
  *
  */
-msg_vm_t MSG_vm_create(msg_host_t ind_pm, const char *name, int ncpus, long ramsize,
-                                            long net_cap, char *disk_path, long disksize,
-                                                long dp_rate, long mig_netspeed)
+msg_vm_t MSG_vm_create(msg_host_t ind_pm, const char *name, int ncpus, int ramsize,
+                                            int net_cap, char *disk_path, int disksize,
+                                                int mig_netspeed, int dp_intensity)
 {
 {
+       /* For the moment, intensity_rate is the percentage against the migration bandwidth */
+       double host_speed = MSG_get_host_speed(ind_pm);
+       double update_speed = ((double)dp_intensity/100) * mig_netspeed;
+       
        msg_vm_t vm = MSG_vm_create_core(ind_pm, name);
        s_ws_params_t params;
        memset(&params, 0, sizeof(params));
        msg_vm_t vm = MSG_vm_create_core(ind_pm, name);
        s_ws_params_t params;
        memset(&params, 0, sizeof(params));
@@ -181,10 +185,11 @@ msg_vm_t MSG_vm_create(msg_host_t ind_pm, const char *name, int ncpus, long rams
        params.devsize = 0;
        params.skip_stage2 = 0;
        params.max_downtime = 0.03;
        params.devsize = 0;
        params.skip_stage2 = 0;
        params.max_downtime = 0.03;
-       params.dp_rate = 1L * 1024 * 1024 * dp_rate;
+       params.dp_rate = (update_speed * 1L * 1024 * 1024 ) / host_speed; 
        params.dp_cap = params.ramsize / 0.9; // working set memory is 90%
        params.mig_speed = 1L * 1024 * 1024 * mig_netspeed; // mig_speed
 
        params.dp_cap = params.ramsize / 0.9; // working set memory is 90%
        params.mig_speed = 1L * 1024 * 1024 * mig_netspeed; // mig_speed
 
+   //XBT_INFO("dp rate %f migspeed : %f intensity mem : %d, updatespeed %f, hostspeed %f",params.dp_rate, params.mig_speed, dp_intensity, update_speed, host_speed);
        simcall_host_set_params(vm, &params);
 
        return vm;
        simcall_host_set_params(vm, &params);
 
        return vm;
@@ -1219,5 +1224,5 @@ msg_host_t MSG_vm_get_pm(msg_vm_t vm)
  */
 void MSG_vm_set_bound(msg_vm_t vm, double bound)
 {
  */
 void MSG_vm_set_bound(msg_vm_t vm, double bound)
 {
-  return simcall_vm_set_bound(vm, bound);
+       return simcall_vm_set_bound(vm, bound);
 }
 }
index 19b3039..157cbe2 100644 (file)
@@ -568,17 +568,9 @@ double surf_solve(double max_date)
   surf_min_index = 0;
 
   /* sequential version */
   surf_min_index = 0;
 
   /* sequential version */
-  struct timeval bla;
-  gettimeofday(&bla, NULL);
-  //unsigned int t = end.tv_usec - begin.tv_usec;
-  XBT_INFO("Surf_solve : bla.before iteration:%lu/%lu",bla.tv_sec, bla.tv_usec);
   xbt_dynar_foreach(model_list_invoke, iter, model) {
   xbt_dynar_foreach(model_list_invoke, iter, model) {
-       gettimeofday(&bla, NULL);
-        XBT_INFO("Surf_solve : iteration:%lu/%lu",bla.tv_sec, bla.tv_usec);
     surf_share_resources(model);
   }
     surf_share_resources(model);
   }
-  gettimeofday(&bla, NULL);
-  XBT_INFO("Surf_solve : end before iteration:%lu/%lu",bla.tv_sec, bla.tv_usec);
   unsigned i;
   for (i = 0; i < xbt_dynar_length(model_list_invoke); i++) {
     if ((min < 0.0 || surf_mins[i] < min)
   unsigned i;
   for (i = 0; i < xbt_dynar_length(model_list_invoke); i++) {
     if ((min < 0.0 || surf_mins[i] < min)