Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorSamuel Lepetit <samuel.lepetit@inria.fr>
Thu, 3 May 2012 12:18:57 +0000 (14:18 +0200)
committerSamuel Lepetit <samuel.lepetit@inria.fr>
Thu, 3 May 2012 12:18:57 +0000 (14:18 +0200)
examples/msg/gpu/test_MSG_gpu_task_create.c
examples/msg/masterslave/masterslave_cpu_ti_crosstraffic.tesh
include/simgrid/simix.h
src/mc/mc_liveness.c
src/mc/mc_private.h
src/msg/msg_host.c
src/simix/smx_process.c
src/xbt/mmalloc/mm_diff.c

index 883f035..a490f15 100644 (file)
@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
 
   mytask = MSG_gpu_task_create("testTask", 2000.0, 20.0, 20.0);
 
-
+  XBT_INFO("GPU task %p was created", mytask);
 
   MSG_clean();
 
index e53cd18..4a46cf7 100644 (file)
@@ -370,7 +370,6 @@ p Testing the bypassing of the flexml parser
 $ $SG_TEST_EXENV ${bindir:=.}/masterslave_bypass --log=no_loc --cfg=cpu/optim:TI "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (0:@) Configuration change: Set 'cpu/optim' to 'TI'
 > [  0.000000] (0:@) Bypassing the XML parser since surf_parse_open received a NULL pointer. If it is not what you want, go fix your code.
-> [  0.000000] (2:slave@host B) I'm a slave
 > [  0.000000] (1:master@host A) Got 1 slave(s) :
 > [  0.000000] (1:master@host A)        host B
 > [  0.000000] (1:master@host A) Got 20 task to process :
@@ -395,6 +394,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/masterslave_bypass --log=no_loc --cfg=cpu/optim:TI
 > [  0.000000] (1:master@host A)       "Task_18"
 > [  0.000000] (1:master@host A)       "Task_19"
 > [  0.000000] (1:master@host A) Sending "Task_0" to "host B"
+> [  0.000000] (2:slave@host B) I'm a slave
 > [  4.602000] (2:slave@host B) Received "Task_0" 
 > [  4.602000] (2:slave@host B) Processing "Task_0" 
 > [  4.602000] (1:master@host A) Send completed
index dec17ec..b99a048 100644 (file)
@@ -240,6 +240,8 @@ XBT_PUBLIC(const char*) SIMIX_host_self_get_name(void);
 XBT_PUBLIC(const char*) SIMIX_host_get_name(smx_host_t host); /* FIXME: make private: only the name of SIMIX_host_self() should be public without request */
 XBT_PUBLIC(void) SIMIX_host_self_set_data(void *data);
 XBT_PUBLIC(void*) SIMIX_host_self_get_data(void);
+XBT_PUBLIC(void*) SIMIX_host_get_data(smx_host_t host);
+XBT_PUBLIC(void) SIMIX_host_set_data(smx_host_t host, void *data);
 
 /********************************* Process ************************************/
 XBT_PUBLIC(int) SIMIX_process_count(void);
index c7b280f..221b879 100644 (file)
@@ -33,6 +33,46 @@ unsigned int hash_region(char *str, int str_len){
 
 }
 
+int data_program_region_compare(void *d1, void *d2, size_t size){
+  int distance = 0;
+  int pointer_align;
+  int i;
+  
+  for(i=0; i<size; i++){
+    if(memcmp(((char *)d1) + i, ((char *)d2) + i, 1) != 0){
+      fprintf(stderr,"Different byte (offset=%d) (%p - %p) in data program region\n", i, (char *)d1 + i, (char *)d2 + i);
+      distance++;
+      pointer_align = (i /sizeof(void *)) * sizeof(void *);
+      fprintf(stderr, "Pointer address : %p - %p\n", (char *)d1 + pointer_align, (char *)d2 + pointer_align);
+      fprintf(stderr, "Pointed address : %p - %p\n", *((void **)((char *)d1 + pointer_align)), *((void **)((char *)d2 + pointer_align)));
+    }
+  }
+  
+  fprintf(stderr, "Hamming distance between data program regions : %d", distance);
+
+  return distance;
+}
+
+int data_libsimgrid_region_compare(void *d1, void *d2, size_t size){
+  int distance = 0;
+  int pointer_align;
+  int i;
+  
+  for(i=0; i<size; i++){
+    if(memcmp(((char *)d1) + i, ((char *)d2) + i, 1) != 0){
+      fprintf(stderr, "Different byte (offset=%d) (%p - %p) in data libsimgrid region", i, (char *)d1 + i, (char *)d2 + i);
+      distance++;
+      pointer_align = (i /sizeof(void *)) * sizeof(void *);
+      fprintf(stderr, "Pointer address : %p - %p\n", (char *)d1 + pointer_align, (char *)d2 + pointer_align);
+      fprintf(stderr, "Pointed address : %p - %p\n", *((void **)((char *)d1 + pointer_align)), *((void **)((char *)d2 + pointer_align)));
+    }
+  }
+  
+  fprintf(stderr, "Hamming distance between data libsimgrid regions : %d", distance);
+  
+  return distance;
+}
+
 int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2){
 
   
@@ -82,7 +122,7 @@ int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2){
        }
       }
       break;
-      /*case 1 :
+    case 1 :
       if(s1->regions[i]->size != s2->regions[i]->size){
        if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
          XBT_DEBUG("Different size of libsimgrid (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
@@ -99,16 +139,41 @@ int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2){
          return 1;
        }
       }
-      if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
+      if(data_program_region_compare(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
+       if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
+         XBT_DEBUG("Different memcmp for data in libsimgrid");
+         errors++;
+       }else{
+         return 1;
+       }
+      }
+      break;
+    case 2 :
+      if(s1->regions[i]->size != s2->regions[i]->size){
+       if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
+         XBT_DEBUG("Different size of data program (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
+         errors++;
+       }else{
+         return 1;
+       }
+      }
+      if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
+       if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
+         XBT_DEBUG("Different start addr of data program (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
+         errors++;
+       }else{
+         return 1;
+       }
+      }
+      if(data_libsimgrid_region_compare(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
        if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
          XBT_DEBUG("Different memcmp for data in libsimgrid");
-         XBT_DEBUG("Size : %zu", s1->regions[i]->size);
          errors++;
        }else{
          return 1;
        }
       }
-      break;*/
+      break;
     default:
       break;
     }
@@ -116,7 +181,6 @@ int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2){
 
   return (errors > 0);
   
-  
 }
 
 int reached(xbt_state_t st){
@@ -645,16 +709,16 @@ int visited_hash(xbt_state_t st, int sc){
              MC_UNSET_RAW_MEM;
              return 1;
            }else{
-             XBT_DEBUG("Different snapshot");
+             //XBT_DEBUG("Different snapshot");
            }
          }else{
-           XBT_DEBUG("Different values of propositional symbols"); 
+           //XBT_DEBUG("Different values of propositional symbols"); 
          }
        }else{
-         XBT_DEBUG("Different automaton state");
+         //XBT_DEBUG("Different automaton state");
        }
       }else{
-       XBT_DEBUG("Different value of search_cycle");
+       //XBT_DEBUG("Different value of search_cycle");
       }
       
       region_diff = 0;
@@ -812,9 +876,13 @@ void MC_ddfs_init(void){
   XBT_DEBUG("Double-DFS init");
   XBT_DEBUG("**************************************************");
 
+  XBT_DEBUG("Std heap : %p", std_heap);
+  XBT_DEBUG("Raw heap : %p", raw_heap);
+
   mc_pair_stateless_t mc_initial_pair = NULL;
   mc_state_t initial_graph_state = NULL;
   smx_process_t process; 
+
  
   MC_wait_for_requests();
 
@@ -903,7 +971,7 @@ void MC_ddfs(int search_cycle){
  
   mc_stats_pair->visited_pairs++;
 
-  sleep(1);
+  //sleep(1);
 
   int value;
   mc_state_t next_graph_state = NULL;
index b37a075..09e8932 100644 (file)
@@ -253,6 +253,8 @@ void set_pair_reached(xbt_state_t st);
 int reached_hash(xbt_state_t st);
 void set_pair_reached_hash(xbt_state_t st);
 int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2);
+int data_program_region_compare(void *d1, void *d2, size_t size);
+int data_libsimgrid_region_compare(void *d1, void *d2, size_t size);
 void MC_pair_delete(mc_pair_t pair);
 void MC_exit_liveness(void);
 mc_state_t MC_state_pair_new(void);
index a683d42..dfa729e 100644 (file)
@@ -8,6 +8,7 @@
 #include "msg/msg_mailbox.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
+#include "simgrid/simix.h"
 
 /** @addtogroup m_host_management
  *     \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Hosts" --> \endhtmlonly
index eee6efd..31e46e6 100644 (file)
@@ -390,7 +390,7 @@ smx_action_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer)
       }
       return NULL;
     } else {
-      DIE_IMPOSSIBLE;
+      /* Suspension is delayed to when the process is rescheduled. */
       return NULL;
     }
   } else {
@@ -402,9 +402,12 @@ void SIMIX_process_resume(smx_process_t process, smx_process_t issuer)
 {
   xbt_assert((process != NULL), "Invalid parameters");
 
+  XBT_IN("process = %p, issuer = %p", process, issuer);
+
   if(process->context->iwannadie)
     return;
 
+  if(!process->suspended) return;
   process->suspended = 0;
 
   /* If we are resuming another process, resume the action it was waiting for
@@ -433,12 +436,10 @@ void SIMIX_process_resume(smx_process_t process, smx_process_t issuer)
               (int)process->waiting_action->type);
       }
     }
-    else {
-      DIE_IMPOSSIBLE;
-//      if(!xbt_dynar_member(simix_global->process_to_run, &(process)))
-//        xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process);
-    }
+    else
+      XBT_WARN("Strange. Process %p is trying to resume himself.", issuer);
   }
+  XBT_OUT();
 }
 
 int SIMIX_process_get_maxpid(void) {
@@ -630,6 +631,12 @@ void SIMIX_process_yield(smx_process_t self)
     SIMIX_context_stop(self->context);
   }
 
+  if(self->suspended) {
+    xbt_assert(!self->doexception, "Gloups! This exception may be lost by subsequent calls.");
+    self->suspended = 0;
+    SIMIX_process_suspend(self,self);
+  }
+
   if (self->doexception) {
     XBT_DEBUG("Wait, maestro left me an exception");
     self->doexception = 0;
index 1fdc5bd..96df860 100644 (file)
@@ -128,7 +128,7 @@ int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2){
 
   int errors = 0;
 
-  if(mdp1->headersize != mdp2->headersize){
+  /*if(mdp1->headersize != mdp2->headersize){
     fprintf(stderr, "Different size of the file header for the mapped files\n");
     return 1;
   }
@@ -191,7 +191,7 @@ int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2){
   if(mdp1->version != mdp2->version){
     fprintf(stderr,"Different version of the mmalloc package\n");
     return 1;
-  }
+    }*/
 
 
   size_t i, j;