Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix issue with surf.h included in simix.h
authorPaul Bédaride <paul.bedaride@gmail.com>
Thu, 28 Nov 2013 10:31:30 +0000 (11:31 +0100)
committerPaul Bédaride <paul.bedaride@gmail.com>
Thu, 28 Nov 2013 10:31:30 +0000 (11:31 +0100)
include/simgrid/datatypes.h [new file with mode: 0644]
include/simgrid/simix.h
src/include/surf/surf.h
src/surf/network_smpi.cpp
src/surf/network_smpi.hpp

diff --git a/include/simgrid/datatypes.h b/include/simgrid/datatypes.h
new file mode 100644 (file)
index 0000000..fb3974e
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * datatypes.h
+ *
+ *  Created on: Nov 28, 2013
+ *      Author: bedaride
+ */
+
+#ifndef SIMGRID_DATATYPES_H_
+#define SIMGRID_DATATYPES_H_
+
+typedef struct ws_params {
+  int ncpus;
+  sg_size_t ramsize;
+  int overcommit;
+
+  /* The size of other states than memory pages, which is out-of-scope of dirty
+   * page tracking. */
+  long devsize;
+  int skip_stage1;
+  int skip_stage2;
+  double max_downtime;
+
+  double dp_rate;
+  double dp_cap; /* bytes per 1 flop execution */
+
+  double xfer_cpu_overhead;
+  double dpt_cpu_overhead;
+
+  /* set migration speed */
+  double mig_speed;
+} s_ws_params_t, *ws_params_t;
+
+#endif /* SIMGRID_DATATYPES_H_ */
index 911605b..62df978 100644 (file)
@@ -14,7 +14,7 @@
 #include "xbt/parmap.h"
 #include "xbt/swag.h"
 #include "simgrid/platf.h"
-#include "surf/surf.h"
+#include "simgrid/datatypes.h"
 
 SG_BEGIN_DECL()
 
@@ -52,7 +52,6 @@ typedef enum {
 } e_smx_state_t;
 /** @} */
 
-
 typedef struct s_smx_timer* smx_timer_t;
 
 /* ******************************** Synchro ************************************ */
index 07bda08..dfcc808 100644 (file)
@@ -18,6 +18,7 @@
 #include "xbt/lib.h"
 #include "surf/surf_routing.h"
 #include "simgrid/platf_interface.h"
+#include "simgrid/datatypes.h"
 
 SG_BEGIN_DECL()
 /* Actions and models are highly connected structures... */
@@ -183,28 +184,6 @@ typedef enum {
 
 } e_surf_vm_state_t;
 
-typedef struct ws_params {
-  int ncpus;
-  sg_size_t ramsize;
-  int overcommit;
-
-  /* The size of other states than memory pages, which is out-of-scope of dirty
-   * page tracking. */
-  long devsize;
-  int skip_stage1;
-  int skip_stage2;
-  double max_downtime;
-
-  double dp_rate;
-  double dp_cap; /* bytes per 1 flop execution */
-
-  double xfer_cpu_overhead;
-  double dpt_cpu_overhead;
-
-  /* set migration speed */
-  double mig_speed;
-} s_ws_params_t, *ws_params_t;
-
 /***************************/
 /* Generic model object */
 /***************************/
index f0be52e..64dc992 100644 (file)
@@ -80,6 +80,17 @@ void surf_network_model_init_SMPI(void)
   xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775);
 }
 
+NetworkSmpiModel::NetworkSmpiModel()
+ : NetworkCm02Model() {
+       m_haveGap=true;
+}
+
+NetworkSmpiModel::~NetworkSmpiModel(){
+  if (gap_lookup) {
+    xbt_dict_free(&gap_lookup);
+  }
+}
+
 void NetworkSmpiModel::gapAppend(double size, const NetworkCm02LinkLmmPtr link, NetworkCm02ActionLmmPtr action)
 {
   const char *src = link->m_name;
@@ -173,12 +184,13 @@ double NetworkSmpiModel::latencyFactor(double size)
   xbt_dynar_foreach(smpi_lat_factor, iter, fact) {
     if (size <= fact.factor) {
       XBT_DEBUG("%f <= %ld return %f", size, fact.factor, current);
+      xbt_dynar_free(&smpi_lat_factor);
       return current;
     }else
       current=fact.value;
   }
   XBT_DEBUG("%f > %ld return %f", size, fact.factor, current);
-
+  xbt_dynar_free(&smpi_lat_factor);
   return current;
 }
 
index f5d38fa..54b2b9b 100644 (file)
@@ -17,7 +17,9 @@ typedef NetworkSmpiModel *NetworkSmpiModelPtr;
 
 class NetworkSmpiModel : public NetworkCm02Model {
 public:
-  NetworkSmpiModel() : NetworkCm02Model() {m_haveGap=true;};
+  NetworkSmpiModel();
+  ~NetworkSmpiModel();
+
   void gapAppend(double size, const NetworkCm02LinkLmmPtr link, NetworkCm02ActionLmmPtr action);
   void gapRemove(ActionLmmPtr action);
   double latencyFactor(double size);