Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename SIMIX_host_self() into sg_host_self(), and make it public
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 1 Jul 2017 21:12:27 +0000 (23:12 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 1 Jul 2017 21:12:27 +0000 (23:12 +0200)
include/simgrid/host.h
include/simgrid/simix.h
src/simix/smx_host.cpp
src/smpi/instr_smpi.cpp
src/smpi/smpi_comm.cpp
src/smpi/smpi_dvfs.cpp
src/smpi/smpi_pmpi.cpp
src/xbt/xbt_log_layout_format.c
src/xbt/xbt_log_layout_simple.c

index eac85bf..1c418b2 100644 (file)
@@ -39,6 +39,8 @@ XBT_PUBLIC(xbt_dynar_t) sg_host_get_attached_storage_list(sg_host_t host);
 XBT_PUBLIC(double) sg_host_speed(sg_host_t host);
 XBT_PUBLIC(double) sg_host_get_available_speed(sg_host_t host);
 
+XBT_PUBLIC(sg_host_t) sg_host_self();
+XBT_PUBLIC(const char*) sg_host_self_get_name();
 XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host);
 XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host);
 XBT_PUBLIC(void) sg_host_set_pstate(sg_host_t host,int pstate);
index b464cf1..f134c43 100644 (file)
@@ -184,8 +184,6 @@ XBT_PUBLIC(smx_actor_t) SIMIX_process_attach(
 XBT_PUBLIC(void) SIMIX_process_detach();
 
 /*********************************** Host *************************************/
-XBT_PUBLIC(sg_host_t) SIMIX_host_self();
-XBT_PUBLIC(const char*) SIMIX_host_self_get_name();
 XBT_PUBLIC(void) SIMIX_host_off(sg_host_t host, smx_actor_t issuer);
 XBT_PUBLIC(void) SIMIX_host_self_set_data(void *data);
 XBT_PUBLIC(void*) SIMIX_host_self_get_data();
@@ -227,7 +225,6 @@ XBT_PUBLIC(void) simcall_call(smx_actor_t process);
 
 /******************************* Host simcalls ********************************/
 XBT_PUBLIC(void) simcall_host_set_data(sg_host_t host, void *data);
-
 XBT_PUBLIC(smx_activity_t) simcall_execution_start(const char *name,
                                                 double flops_amount,
                                                 double priority, double bound);
index 2ac7f7d..69054e2 100644 (file)
@@ -92,16 +92,16 @@ void SIMIX_host_off(sg_host_t h, smx_actor_t issuer)
   }
 }
 
-sg_host_t SIMIX_host_self()
+sg_host_t sg_host_self()
 {
   smx_actor_t process = SIMIX_process_self();
   return (process == nullptr) ? nullptr : process->host;
 }
 
 /* needs to be public and without simcall for exceptions and logging events */
-const char* SIMIX_host_self_get_name()
+const char* sg_host_self_get_name()
 {
-  sg_host_t host = SIMIX_host_self();
+  sg_host_t host = sg_host_self();
   if (host == nullptr || SIMIX_process_self() == simix_global->maestro_process)
     return "";
 
index d0f4c4d..eb3b141 100644 (file)
@@ -197,7 +197,7 @@ void TRACE_smpi_init(int rank)
 
   container_t father;
   if (TRACE_smpi_is_grouped()){
-    father = PJ_container_get (SIMIX_host_self_get_name());
+    father = PJ_container_get(sg_host_self_get_name());
   }else{
     father = PJ_container_get_root ();
   }
index f128f59..d5ac71c 100644 (file)
@@ -333,19 +333,20 @@ void Comm::init_smp(){
    }
   //identify neighbours in comm
   //get the indexes of all processes sharing the same simix host
-  xbt_swag_t process_list = SIMIX_host_self()->extension<simgrid::simix::Host>()->process_list;
-  int intra_comm_size     = 0;
-  int min_index           = INT_MAX;//the minimum index will be the leader
-  smx_actor_t actor       = nullptr;
-  xbt_swag_foreach(actor, process_list) {
-    int index = actor->pid -1;
-
-    if(this->group()->rank(index)!=MPI_UNDEFINED){
-      intra_comm_size++;
-      //the process is in the comm
-      if(index < min_index)
-        min_index=index;
-    }
+   xbt_swag_t process_list = sg_host_self()->extension<simgrid::simix::Host>()->process_list;
+   int intra_comm_size     = 0;
+   int min_index           = INT_MAX; // the minimum index will be the leader
+   smx_actor_t actor       = nullptr;
+   xbt_swag_foreach(actor, process_list)
+   {
+     int index = actor->pid - 1;
+
+     if (this->group()->rank(index) != MPI_UNDEFINED) {
+       intra_comm_size++;
+       // the process is in the comm
+       if (index < min_index)
+         min_index = index;
+     }
   }
   XBT_DEBUG("number of processes deployed on my node : %d", intra_comm_size);
   MPI_Group group_intra = new  Group(intra_comm_size);
index bc9d903..c19e14e 100644 (file)
@@ -24,7 +24,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi, "Logging specific to SMPI (expe
  */
 double smpi_get_host_power_peak_at(int pstate_index)
 {
-  return SIMIX_host_self()->getPstateSpeed(pstate_index);
+  return sg_host_self()->getPstateSpeed(pstate_index);
 }
 
 /**
@@ -34,7 +34,7 @@ double smpi_get_host_power_peak_at(int pstate_index)
  */
 double smpi_get_host_current_power_peak()
 {
-  return SIMIX_host_self()->speed();
+  return sg_host_self()->speed();
 }
 
 /**
@@ -42,7 +42,7 @@ double smpi_get_host_current_power_peak()
  */
 int smpi_get_host_nb_pstates()
 {
-  return sg_host_get_nb_pstates(SIMIX_host_self());
+  return sg_host_get_nb_pstates(sg_host_self());
 }
 
 /**
@@ -52,11 +52,11 @@ int smpi_get_host_nb_pstates()
  */
 void smpi_set_host_pstate(int pstate_index)
 {
-  sg_host_set_pstate(SIMIX_host_self(), pstate_index);
+  sg_host_set_pstate(sg_host_self(), pstate_index);
 }
 /** @brief Gets the pstate at which the processor currently running */
 int smpi_get_host_pstate() {
-  return sg_host_get_pstate(SIMIX_host_self());
+  return sg_host_get_pstate(sg_host_self());
 }
 
 /**
@@ -65,7 +65,7 @@ int smpi_get_host_pstate() {
  * \return Returns the consumed energy
  */
 double smpi_get_host_consumed_energy() {
-  return sg_host_get_consumed_energy(SIMIX_host_self());
+  return sg_host_get_consumed_energy(sg_host_self());
 }
 
 #if SMPI_FORTRAN
index 4c68e80..6a1b4d3 100644 (file)
@@ -2153,9 +2153,9 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
 
 int PMPI_Get_processor_name(char *name, int *resultlen)
 {
-  strncpy(name, SIMIX_host_self()->cname(), strlen(SIMIX_host_self()->cname()) < MPI_MAX_PROCESSOR_NAME - 1
-                                                ? strlen(SIMIX_host_self()->cname()) + 1
-                                                : MPI_MAX_PROCESSOR_NAME - 1);
+  strncpy(name, sg_host_self()->cname(), strlen(sg_host_self()->cname()) < MPI_MAX_PROCESSOR_NAME - 1
+                                             ? strlen(sg_host_self()->cname()) + 1
+                                             : MPI_MAX_PROCESSOR_NAME - 1);
   *resultlen = strlen(name) > MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
 
   return MPI_SUCCESS;
index 3407ff7..9ac550d 100644 (file)
@@ -5,10 +5,11 @@
 /* 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 "xbt/sysdep.h"
+#include "simgrid/host.h"
+#include "simgrid/simix.h" /* SIMIX_host_self_get_name */
 #include "src/xbt/log_private.h"
-#include "simgrid/simix.h"      /* SIMIX_host_self_get_name */
 #include "surf/surf.h"
+#include "xbt/sysdep.h"
 #include <stdio.h>
 
 extern const char *xbt_log_priority_names[8];
@@ -119,7 +120,7 @@ static int xbt_log_layout_format_doit(xbt_log_layout_t l, xbt_log_event_t ev, co
         show_string(xbt_log_priority_names[ev->priority]);
         break;
       case 'h':                 /* host name; SimGrid extension */
-        show_string(SIMIX_host_self_get_name());
+        show_string(sg_host_self_get_name());
         break;
       case 't':                 /* thread name; LOG4J compliant */
         show_string(SIMIX_process_self_get_name());
index 8d77b3e..a7f9052 100644 (file)
@@ -36,12 +36,12 @@ static int xbt_log_layout_simple_doit(xbt_log_layout_t l, xbt_log_event_t ev, co
   /* Display the proc info if available */
   procname = xbt_procname();
   if (procname && strcmp(procname,"maestro")) {
-    len = snprintf(p, rem_size, "%s:%s:(%d) ", SIMIX_host_self_get_name(), procname, xbt_getpid());
+    len = snprintf(p, rem_size, "%s:%s:(%d) ", sg_host_self_get_name(), procname, xbt_getpid());
     check_overflow(len);
   }
   else if (!procname)  {
-  len = snprintf(p, rem_size, "%s::(%d) ", SIMIX_host_self_get_name(), xbt_getpid());
-  check_overflow(len);
+    len = snprintf(p, rem_size, "%s::(%d) ", sg_host_self_get_name(), xbt_getpid());
+    check_overflow(len);
   }
 
   /* Display the date */