Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
tidying and cosmetics
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 26 Jan 2016 23:20:45 +0000 (00:20 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 26 Jan 2016 23:20:45 +0000 (00:20 +0100)
examples/simdag/properties/sd_prop.c
examples/simdag/properties/test_prop.tesh
include/simgrid/host.h
include/simgrid/simdag.h
src/simdag/sd_workstation.cpp
src/simgrid/host.cpp
src/xbt/log.c

index 4af031c..ad340f4 100644 (file)
@@ -44,7 +44,7 @@ int main(int argc, char **argv)
 
   /* The host properties can be retrieved from all interfaces */
 
-  XBT_INFO("Property list for workstation %s", name1);
+  XBT_INFO("Property list for host %s", name1);
   /* Get the property list of the workstation 1 */
   props = sg_host_get_properties(w1);
 
@@ -63,7 +63,7 @@ int main(int argc, char **argv)
   XBT_INFO("\tProperty: %s has value: %s", noexist, value?value:"Undefined (NULL)");
 
 
-  XBT_INFO("Property list for workstation %s", name2);
+  XBT_INFO("Property list for host %s", name2);
   /* Get the property list of the workstation 2 */
   props = sg_host_get_properties(w2);
   cursor = NULL;
index 0748d8d..bb27cf8 100755 (executable)
@@ -4,18 +4,18 @@ p Simple test of simdag with properties
 
 $ $SG_TEST_EXENV properties/sd_prop ${srcdir:=.}/../platforms/prop.xml
 > [0.000000] [xbt_cfg/INFO] Switching to the L07 model to handle parallel tasks.
-> [0.000000] [test/INFO] Property list for workstation host1
+> [0.000000] [test/INFO] Property list for host host1
 > [0.000000] [test/INFO]       Property: mem has value: 4
 > [0.000000] [test/INFO]       Property: NewProp has value: newValue
 > [0.000000] [test/INFO]       Property: Hdd has value: 180
 > [0.000000] [test/INFO]       Property: NoProp has value: Undefined (NULL)
-> [0.000000] [test/INFO] Property list for workstation host2
+> [0.000000] [test/INFO] Property list for host host2
 > [0.000000] [test/INFO]       Property: Hdd on host: 120
 > [0.000000] [test/INFO] Modify an existing property
 > [0.000000] [test/INFO]       Property: Hdd old value: 120
 > [0.000000] [test/INFO]       Property: Hdd new value: 250
-> [0.000000] [sd_workstation/INFO] Displaying workstation host2
-> [0.000000] [sd_workstation/INFO]   - speed: 1000000000
-> [0.000000] [sd_workstation/INFO]   - available speed: 1.00
-> [0.000000] [sd_workstation/INFO]   - properties:
-> [0.000000] [sd_workstation/INFO]     Hdd->250
+> [0.000000] [sg_host/INFO] Displaying host host2
+> [0.000000] [sg_host/INFO]   - speed: 1000000000
+> [0.000000] [sg_host/INFO]   - available speed: 1.00
+> [0.000000] [sg_host/INFO]   - properties:
+> [0.000000] [sg_host/INFO]     Hdd->250
index 2e2ee13..410091f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2015. The SimGrid Team.
+/* Copyright (c) 2013-2016. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -21,6 +21,8 @@
 SG_BEGIN_DECL()
 
 XBT_PUBLIC(size_t) sg_host_count();
+XBT_PUBLIC(const sg_host_t *) sg_host_list(void);
+
 XBT_PUBLIC(size_t) sg_host_extension_create(void(*deleter)(void*));
 XBT_PUBLIC(void*) sg_host_extension_get(sg_host_t host, size_t rank);
 XBT_PUBLIC(sg_host_t) sg_host_by_name(const char *name);
@@ -47,8 +49,13 @@ XBT_PUBLIC(void) sg_host_simix_destroy(sg_host_t host);
 // Module initializer. Won't survive the conversion to C++. Hopefully.
 XBT_PUBLIC(void) sg_host_init(void);
 
+// ========= storage related functions ============
+XBT_PUBLIC(xbt_dict_t) sg_host_get_mounted_storage_list(sg_host_t host);
+XBT_PUBLIC(xbt_dynar_t) sg_host_get_attached_storage_list(sg_host_t host);
 // =========== user-level functions ===============
+XBT_PUBLIC(double) sg_host_speed(sg_host_t host);
 XBT_PUBLIC(double) sg_host_get_available_speed(sg_host_t host);
+XBT_PUBLIC(int) sg_host_core_count(sg_host_t host);
 XBT_PUBLIC(int) sg_host_is_on(sg_host_t host);
 
 XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host);
@@ -57,6 +64,7 @@ XBT_PUBLIC(void) sg_host_set_pstate(sg_host_t host,int pstate);
 XBT_PUBLIC(xbt_dict_t) sg_host_get_properties(sg_host_t host);
 XBT_PUBLIC(const char *) sg_host_get_property_value(sg_host_t host,
                                                      const char *name);
+XBT_PUBLIC(void) sg_host_dump(sg_host_t ws);
 SG_END_DECL()
 
 #endif /* SIMGRID_HOST_H_ */
index 0e149b0..8fd4c49 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2010, 2012-2015. The SimGrid Team.
+/* Copyright (c) 2006-2010, 2012-2016. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -75,41 +75,29 @@ typedef xbt_dictelm_t SD_storage_t;
 
 /************************** Workstation handling ****************************/
 
-/** @defgroup sg_host_management Workstations
- *  @brief Functions for managing the workstations
+/** @defgroup sg_host_management Hosts
+ *  @brief Functions for managing the Hosts
  *
- *  This section describes the functions for managing the workstations.
+ *  This section describes the functions for managing the hosts.
  *
- *  A workstation is a place where a task can be executed.
- *  A workstation is represented as a <em>physical
- *  resource with computing capabilities</em> and has a <em>name</em>.
+ *  A host is a place where a task can be executed.
+ *  A host is represented as a <em>physical resource with computing
+ *  capabilities</em> and has a <em>name</em>.
  *
- *  The workstations are created when you call the function SD_create_environment.
+ *  The hosts are created when you call the function SD_create_environment.
  *
  *  @see sg_host_t
  *  @{
  */
-XBT_PUBLIC(const sg_host_t *) sg_host_list(void);
-
-XBT_PUBLIC(void) sg_host_dump(sg_host_t ws);
-XBT_PUBLIC(double) sg_host_speed(sg_host_t workstation);
-XBT_PUBLIC(int) sg_host_core_count(sg_host_t workstation);
-XBT_PUBLIC(double) sg_host_computation_time(sg_host_t workstation,
-                                                       double flops_amount);
-XBT_PUBLIC(xbt_dict_t)
-    sg_host_get_mounted_storage_list(sg_host_t workstation);
-XBT_PUBLIC(xbt_dynar_t)
-    sg_host_get_attached_storage_list(sg_host_t workstation);
+XBT_PUBLIC(double) sg_host_computation_time(sg_host_t host,
+                                            double flops_amount);
 
 XBT_PUBLIC(const SD_link_t *) SD_route_get_list(sg_host_t src,
                                                 sg_host_t dst);
-XBT_PUBLIC(int) SD_route_get_size(sg_host_t src,
-                                  sg_host_t dst);
+XBT_PUBLIC(int) SD_route_get_size(sg_host_t src, sg_host_t dst);
 
-XBT_PUBLIC(double) SD_route_get_latency(sg_host_t src,
-                                                sg_host_t dst);
-XBT_PUBLIC(double) SD_route_get_bandwidth(sg_host_t src,
-                                                  sg_host_t dst);
+XBT_PUBLIC(double) SD_route_get_latency(sg_host_t src, sg_host_t dst);
+XBT_PUBLIC(double) SD_route_get_bandwidth(sg_host_t src, sg_host_t dst);
 XBT_PUBLIC(double) SD_route_get_communication_time(sg_host_t src,
                                                    sg_host_t dst,
                                                    double bytes_amount);
index 838f731..1413ad3 100644 (file)
@@ -14,9 +14,6 @@
 #include "xbt/sysdep.h"
 #include "surf/surf.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_workstation, sd,
-                                "Logging specific to SimDag (workstation)");
-
 /* Creates a storage and registers it in SD.
  */
 SD_storage_t __SD_storage_create(void *surf_storage, void *data)
@@ -43,43 +40,11 @@ void __SD_storage_destroy(void *storage)
   xbt_free(s);
 }
 
-/**
- * \brief Returns the workstation list
- *
- * Use sg_host_count() to know the array size.
- * 
- * \return an array of \ref sg_host_t containing all workstations
- * \remark The workstation order in the returned array is generally different from the workstation creation/declaration order in the XML platform (we use a hash table internally).
- * \see sg_host_count()
- */
-const sg_host_t *sg_host_list(void) {
-  xbt_assert(sg_host_count() > 0, "There is no workstation!");
-
-  if (sd_global->host_list == NULL)     /* this is the first time the function is called */
-    sd_global->host_list = (sg_host_t*)xbt_dynar_to_array(sg_hosts_as_dynar());
-
-  return sd_global->host_list;
-}
-
-/** @brief Displays debugging informations about a workstation */
-void sg_host_dump(sg_host_t ws)
+double sg_host_computation_time(sg_host_t host, double flops_amount)
 {
-  xbt_dict_t props;
-  xbt_dict_cursor_t cursor=NULL;
-  char *key,*data;
-
-  XBT_INFO("Displaying workstation %s", sg_host_get_name(ws));
-  XBT_INFO("  - speed: %.0f", ws->speed());
-  XBT_INFO("  - available speed: %.2f", sg_host_get_available_speed(ws));
-  props = sg_host_get_properties(ws);
-  
-  if (!xbt_dict_is_empty(props)){
-    XBT_INFO("  - properties:");
-
-    xbt_dict_foreach(props,cursor,key,data) {
-      XBT_INFO("    %s->%s",key,data);
-    }
-  }
+  xbt_assert(flops_amount >= 0,
+              "flops_amount must be greater than or equal to zero");
+  return flops_amount / sg_host_speed(host);
 }
 
 /**
@@ -92,31 +57,6 @@ void sg_host_dump(sg_host_t ws)
  * \return a new array of \ref SD_link_t representing the route between these two workstations
  * \see SD_route_get_size(), SD_link_t
  */
-double sg_host_speed(sg_host_t workstation)
-{
-  return workstation->speed();
-}
-int sg_host_core_count(sg_host_t workstation) {
-  return workstation->core_count();
-}
-
-
-double sg_host_computation_time(sg_host_t workstation,
-                                           double flops_amount)
-{
-  xbt_assert(flops_amount >= 0,
-              "flops_amount must be greater than or equal to zero");
-  return flops_amount / workstation->speed();
-}
-
-xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t workstation){
-  return workstation->extension<simgrid::surf::Host>()->getMountedStorageList();
-}
-
-xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t workstation){
-  return surf_host_get_attached_storage_list(workstation);
-}
-
 const SD_link_t *SD_route_get_list(sg_host_t src,
                                    sg_host_t dst)
 {
@@ -151,19 +91,6 @@ int SD_route_get_size(sg_host_t src, sg_host_t dst)
                    (surf_host_model_t)surf_host_model, src, dst));
 }
 
-/**
- * \brief Returns the total speed of a workstation
- *
- * \param workstation a workstation
- * \return the total speed of this workstation
- * \see sg_host_get_available_speed()
- */
-/**
- * \brief Returns the amount of cores of a workstation
- *
- * \param workstation a workstation
- * \return the amount of cores of this workstation
- */
 /**
  * \brief Returns an approximative estimated time for the given computation amount on a workstation
  *
index b11ac9c..94def06 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-201. The SimGrid Team.
+/* Copyright (c) 2013-2016. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
 #include "src/simix/smx_private.hpp"
 #include "src/surf/host_interface.hpp"
 
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts");
+
 size_t sg_host_count()
 {
   return xbt_dict_length(host_list);
 }
+/** @brief Returns the host list
+ *
+ * Uses sg_host_count() to know the array size.
+ *
+ * \return an array of \ref sg_host_t containing all the hosts in the platform.
+ * \remark The host order in this array is generally different from the
+ * creation/declaration order in the XML platform (we use a hash table
+ * internally).
+ * \see sg_host_count()
+ */
+const sg_host_t *sg_host_list(void) {
+  xbt_assert(sg_host_count() > 0, "There is no host!");
+  return (sg_host_t*)xbt_dynar_to_array(sg_hosts_as_dynar());
+}
 
 const char *sg_host_get_name(sg_host_t host)
 {
@@ -108,17 +124,40 @@ void sg_host_simix_destroy(sg_host_t host) {
   host->extension_set(SIMIX_HOST_LEVEL, nullptr);
 }
 
+// ========= storage related functions ============
+xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host){
+  return host->extension<simgrid::surf::Host>()->getMountedStorageList();
+}
+
+xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host){
+  return host->extension<simgrid::surf::Host>()->getAttachedStorageList();
+}
+
+
 // =========== user-level functions ===============
 // ================================================
 
+/** @brief Returns the total speed of a host
+ */
+double sg_host_speed(sg_host_t host)
+{
+  return host->speed();
+}
+
 double sg_host_get_available_speed(sg_host_t host){
   return surf_host_get_available_speed(host);
 }
+/** @brief Returns the number of cores of a host
+*/
+int sg_host_core_count(sg_host_t host) {
+  return host->core_count();
+}
+
 /** @brief Returns the state of a host.
  *  @return 1 if the host is active or 0 if it has crashed.
  */
 int sg_host_is_on(sg_host_t host) {
-       return host->is_on();
+  return host->is_on();
 }
 
 /** @brief Returns the number of power states for a host.
@@ -149,7 +188,6 @@ xbt_dict_t sg_host_get_properties(sg_host_t host) {
   return host->properties();
 }
 
-
 /** \ingroup m_host_management
  * \brief Returns the value of a given host property
  *
@@ -162,3 +200,23 @@ const char *sg_host_get_property_value(sg_host_t host, const char *name)
   return (const char*) xbt_dict_get_or_null(sg_host_get_properties(host), name);
 }
 
+/** @brief Displays debugging informations about a host */
+void sg_host_dump(sg_host_t host)
+{
+  xbt_dict_t props;
+  xbt_dict_cursor_t cursor=NULL;
+  char *key,*data;
+
+  XBT_INFO("Displaying host %s", sg_host_get_name(host));
+  XBT_INFO("  - speed: %.0f", sg_host_speed(host));
+  XBT_INFO("  - available speed: %.2f", sg_host_get_available_speed(host));
+  props = sg_host_get_properties(host);
+
+  if (!xbt_dict_is_empty(props)){
+    XBT_INFO("  - properties:");
+
+    xbt_dict_foreach(props,cursor,key,data) {
+      XBT_INFO("    %s->%s",key,data);
+    }
+  }
+}
index 85e33d3..6592d41 100644 (file)
@@ -663,7 +663,10 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(msg_synchro);
   XBT_LOG_CONNECT(msg_task);
   XBT_LOG_CONNECT(msg_vm);
-   
+
+  /* sg */
+  XBT_LOG_CONNECT(sg_host);
+
   /* simdag */
   XBT_LOG_CONNECT(sd);
   XBT_LOG_CONNECT(sd_daxparse);
@@ -672,7 +675,6 @@ static void xbt_log_connect_categories(void)
 #endif
   XBT_LOG_CONNECT(sd_kernel);
   XBT_LOG_CONNECT(sd_task);
-  XBT_LOG_CONNECT(sd_workstation);
 
   /* simix */
   XBT_LOG_CONNECT(simix);