Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add MSG's parallel_contexts example.
authorcristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 27 Jan 2011 11:00:18 +0000 (11:00 +0000)
committercristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 27 Jan 2011 11:00:18 +0000 (11:00 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9516 48e7efb5-ca39-0410-a469-dd3cf9ba447f

buildtools/Cmake/MakeExe.cmake
examples/msg/parallel_contexts/CMakeLists.txt [new file with mode: 0644]
examples/msg/parallel_contexts/deployment_pcontexts_2.xml [new file with mode: 0644]
examples/msg/parallel_contexts/deployment_pcontexts_4.xml [new file with mode: 0644]
examples/msg/parallel_contexts/pcontexts.c [new file with mode: 0644]
examples/msg/parallel_contexts/pcontexts_platform.xml [new file with mode: 0644]

index 864e231..ecf5d2e 100644 (file)
@@ -55,6 +55,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/trace)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/tracing)\r
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/icomms)\r
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/chord)\r
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/parallel_contexts)\r
 \r
 if(HAVE_MC)\r
        add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/mc)\r
diff --git a/examples/msg/parallel_contexts/CMakeLists.txt b/examples/msg/parallel_contexts/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b66dfb4
--- /dev/null
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 2.6)
+
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+
+add_executable(pcontexts "pcontexts.c")
+
+### Add definitions for compile
+if(WIN32)
+target_link_libraries(pcontexts simgrid )
+else(WIN32)
+target_link_libraries(pcontexts simgrid m )
+endif(WIN32)
diff --git a/examples/msg/parallel_contexts/deployment_pcontexts_2.xml b/examples/msg/parallel_contexts/deployment_pcontexts_2.xml
new file mode 100644 (file)
index 0000000..61e4653
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+  <process host="Tremblay" function="node">
+  </process>
+  <process host="Jupiter" function="node">
+  </process>
+</platform>
diff --git a/examples/msg/parallel_contexts/deployment_pcontexts_4.xml b/examples/msg/parallel_contexts/deployment_pcontexts_4.xml
new file mode 100644 (file)
index 0000000..3fc1233
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+  <process host="Tremblay" function="node">
+  </process>
+  <process host="Jupiter" function="node">
+  </process>
+  <process host="Fafard" function="node">
+  </process>
+  <process host="Ginette" function="node">
+  </process>
+</platform>
diff --git a/examples/msg/parallel_contexts/pcontexts.c b/examples/msg/parallel_contexts/pcontexts.c
new file mode 100644 (file)
index 0000000..39fef0c
--- /dev/null
@@ -0,0 +1,72 @@
+#include <msg/msg.h>
+/* Create a log channel to have nice outputs. */
+#include "xbt/log.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
+#define MAX_ITER 200000
+#define WORK 100000
+
+int node(int argc, char **argv);
+MSG_error_t test_all(const char *, const char *);
+int main(int argc, char *argv[]);
+
+int node(int argc, char** argv)
+{
+  int i,j;
+  m_task_t task;
+
+  for(i=0; i < MAX_ITER; i++){
+    task = MSG_task_create("test", 100000000, 1, NULL);
+
+    for(j=0; j < WORK; j++);
+
+    MSG_task_execute(task);
+    INFO0("Task successfully executed");
+    MSG_task_destroy(task);
+  }
+
+  return 0;
+}
+
+/** Test function */
+MSG_error_t test_all(const char *platform_file,
+                     const char *application_file)
+{
+  MSG_error_t res = MSG_OK;
+
+  /* MSG_config("workstation/model","KCCFLN05"); */
+  {                             /*  Simulation setting */
+    MSG_set_channel_number(0);
+    MSG_create_environment(platform_file);
+  }
+  {                             /*   Application deployment */
+    MSG_function_register("node", node);
+    MSG_launch_application(application_file);
+  }
+  res = MSG_main();
+
+  INFO1("Simulation time %g", MSG_get_clock());
+  return res;
+}                               /* end_of_test_all */
+
+
+/** Main function */
+int main(int argc, char *argv[])
+{
+  MSG_error_t res = MSG_OK;
+
+  MSG_global_init(&argc, argv);
+  if (argc < 3) {
+    printf("Usage: %s platform_file deployment_file\n", argv[0]);
+    printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
+    exit(1);
+  }
+  res = test_all(argv[1], argv[2]);
+  MSG_clean();
+
+  if (res == MSG_OK)
+    return 0;
+  else
+    return 1;
+}                               /* end_of_main */
diff --git a/examples/msg/parallel_contexts/pcontexts_platform.xml b/examples/msg/parallel_contexts/pcontexts_platform.xml
new file mode 100644 (file)
index 0000000..0e5118c
--- /dev/null
@@ -0,0 +1,91 @@
+<?xml version='1.0'?>
+ <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+ <platform version="3">
+ <AS  id="AS0"  routing="Full">
+   <!-- ljlkj -->
+   <host id="Tremblay" power="98095000"/>
+   <host id="Jupiter" power="98095000"/>
+   <host id="Fafard" power="98095000"/>
+   <host id="Ginette" power="98095000"/>
+   <host id="Bourassa" power="98095000"/>
+   <link id="6" bandwidth="41279125" latency="5.9904e-05"/>
+   <link id="11" bandwidth="252750" latency="0.00570455"/>
+   <link id="3" bandwidth="34285625" latency="0.000514433"/>
+   <link id="7" bandwidth="11618875" latency="0.00018998"/>
+   <link id="9" bandwidth="7209750" latency="0.001461517"/>
+   <link id="12" bandwidth="1792625" latency="0.007877863"/>
+   <link id="2" bandwidth="118682500" latency="0.000136931"/>
+   <link id="8" bandwidth="8158000" latency="0.000270544"/>
+   <link id="1" bandwidth="34285625" latency="0.000514433"/>
+   <link id="4" bandwidth="10099625" latency="0.00047978"/>
+   <link id="0" bandwidth="41279125" latency="5.9904e-05"/>
+   <link id="10" bandwidth="4679750" latency="0.000848712"/>
+   <link id="5" bandwidth="27946250" latency="0.000278066"/>
+   <link id="loopback" bandwidth="498000000" latency="0.000015" sharing_policy="FATPIPE"/>
+   <route src="Tremblay" dst="Tremblay"><link_ctn id="loopback"/></route>
+   <route src="Jupiter" dst="Jupiter"><link_ctn id="loopback"/></route>
+   <route src="Fafard" dst="Fafard"><link_ctn id="loopback"/></route>
+   <route src="Ginette" dst="Ginette"><link_ctn id="loopback"/></route>
+   <route src="Bourassa" dst="Bourassa"><link_ctn id="loopback"/></route>
+   <route src="Tremblay" dst="Jupiter">
+     <link_ctn id="9"/>
+   </route>
+   <route src="Tremblay" dst="Fafard">
+     <link_ctn id="4"/><link_ctn id="3"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="8"/>
+   </route>
+   <route src="Tremblay" dst="Ginette">
+     <link_ctn id="4"/><link_ctn id="3"/><link_ctn id="5"/>
+   </route>
+   <route src="Tremblay" dst="Bourassa">
+     <link_ctn id="4"/><link_ctn id="3"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="6"/><link_ctn id="7"/>
+   </route>
+   <route src="Jupiter" dst="Tremblay">
+     <link_ctn id="9"/>
+   </route>
+   <route src="Jupiter" dst="Fafard">
+     <link_ctn id="9"/><link_ctn id="4"/><link_ctn id="3"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="8"/>
+   </route>
+   <route src="Jupiter" dst="Ginette">
+     <link_ctn id="9"/><link_ctn id="4"/><link_ctn id="3"/><link_ctn id="5"/>
+   </route>
+   <route src="Jupiter" dst="Bourassa">
+     <link_ctn id="9"/><link_ctn id="4"/><link_ctn id="3"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="6"/><link_ctn id="7"/>
+   </route>
+   <route src="Fafard" dst="Tremblay">
+     <link_ctn id="8"/><link_ctn id="1"/><link_ctn id="0"/><link_ctn id="2"/><link_ctn id="3"/><link_ctn id="4"/>
+   </route>
+   <route src="Fafard" dst="Jupiter">
+     <link_ctn id="8"/><link_ctn id="1"/><link_ctn id="0"/><link_ctn id="2"/><link_ctn id="3"/><link_ctn id="4"/><link_ctn id="9"/>
+   </route>
+   <route src="Fafard" dst="Ginette">
+     <link_ctn id="8"/><link_ctn id="1"/><link_ctn id="0"/><link_ctn id="2"/><link_ctn id="5"/>
+   </route>
+   <route src="Fafard" dst="Bourassa">
+     <link_ctn id="8"/><link_ctn id="6"/><link_ctn id="7"/>
+   </route>
+   <route src="Ginette" dst="Tremblay">
+     <link_ctn id="5"/><link_ctn id="3"/><link_ctn id="4"/>
+   </route>
+   <route src="Ginette" dst="Jupiter">
+     <link_ctn id="5"/><link_ctn id="3"/><link_ctn id="4"/><link_ctn id="9"/>
+   </route>
+   <route src="Ginette" dst="Fafard">
+     <link_ctn id="5"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="8"/>
+   </route>
+   <route src="Ginette" dst="Bourassa">
+     <link_ctn id="5"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="6"/><link_ctn id="7"/>
+   </route>
+   <route src="Bourassa" dst="Tremblay">
+     <link_ctn id="7"/><link_ctn id="6"/><link_ctn id="1"/><link_ctn id="0"/><link_ctn id="2"/><link_ctn id="3"/><link_ctn id="4"/>
+   </route>
+   <route src="Bourassa" dst="Jupiter">
+     <link_ctn id="7"/><link_ctn id="6"/><link_ctn id="1"/><link_ctn id="0"/><link_ctn id="2"/><link_ctn id="3"/><link_ctn id="4"/><link_ctn id="9"/>
+   </route>
+   <route src="Bourassa" dst="Fafard">
+     <link_ctn id="7"/><link_ctn id="6"/><link_ctn id="8"/>
+   </route>
+   <route src="Bourassa" dst="Ginette">
+     <link_ctn id="7"/><link_ctn id="6"/><link_ctn id="1"/><link_ctn id="0"/><link_ctn id="2"/><link_ctn id="5"/>
+   </route>
+ </AS>
+ </platform>