Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Making a surf workstation model using csdp. How simple isn't it ? :)
authorvelho <velho@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 14 Feb 2007 17:00:47 +0000 (17:00 +0000)
committervelho <velho@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 14 Feb 2007 17:00:47 +0000 (17:00 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3151 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/surf/surf.h
src/surf/surf.c
src/surf/surf_private.h
src/surf/workstation_KCCFLN05.c

index 81f5299..824bdce 100644 (file)
@@ -340,6 +340,7 @@ void surf_workstation_resource_init_CLM03(const char *filename);
  *  \see surf_workstation_resource_init_CLM03()
  */
 void surf_workstation_resource_init_KCCFLN05(const char *filename);
+void surf_workstation_resource_init_KCCFLN05_proportionnal(const char *filename);
 
 /** \brief The network links
  *  \ingroup SURF_resources
index 83f6614..f4eac31 100644 (file)
@@ -11,6 +11,7 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf,
                                "Logging specific to SURF (kernel)");
 
+int use_sdp_solver=0;
 
 /* Additional declarations for Windows potability. */
 
@@ -139,7 +140,15 @@ double generic_maxmin_share_resources2(xbt_swag_t running_actions,
   double value = -1;
 #define VARIABLE(action) (*((lmm_variable_t*)(((char *) (action)) + (offset))))
 
-  lmm_solve(sys);
+  if(!use_sdp_solver)
+    lmm_solve(sys);
+  else {
+#ifdef HAVE_SDP
+    sdp_solve(sys);
+#else
+    xbt_assert0(0, "No CSDP found! You cannot use this model!");
+#endif
+  }
 
   xbt_swag_foreach(action, running_actions) {
     value = lmm_variable_getvalue(VARIABLE(action));
index c77e664..9b27052 100644 (file)
@@ -44,6 +44,8 @@ typedef struct surf_resource_private {
 /* #define pub2priv(r) ((surf_resource_private_t) ((char *)(r) -(sizeof(struct surf_resource_private_part)))) */
 /* #define priv2pub(r) ((void *) ((char *)(r) +(sizeof(struct surf_resource_private_part)))) */
 
+extern int use_sdp_solver;
+
 double generic_maxmin_share_resources(xbt_swag_t running_actions,
                                      size_t offset);
 double generic_maxmin_share_resources2(xbt_swag_t running_actions,
index 8695b1b..2669c58 100644 (file)
@@ -1042,3 +1042,15 @@ void surf_workstation_resource_init_KCCFLN05(const char *filename)
 
   xbt_dynar_push(resource_list, &surf_workstation_resource);
 }
+
+void surf_workstation_resource_init_KCCFLN05_proportionnal(const char *filename)
+{
+  xbt_assert0(!surf_cpu_resource, "CPU resource type already defined");
+  xbt_assert0(!surf_network_resource, "network resource type already defined");
+  resource_init_internal();
+  parse_file(filename);
+
+  surf_workstation_resource->common_public->name = "Workstation KCCFLN05 (proportionnal)";
+  use_sdp_solver=1;
+  xbt_dynar_push(resource_list, &surf_workstation_resource);
+}