Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
priority -> task/priority (and task-priority)
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 1 Apr 2016 07:13:33 +0000 (09:13 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 1 Apr 2016 07:13:33 +0000 (09:13 +0200)
 + fix discrepancy between C and Java

15 files changed:
.gitignore
examples/java/CMakeLists.txt
examples/java/priority/CMakeLists.txt [deleted file]
examples/java/priority/priority.tesh [deleted file]
examples/java/priority/priorityDeployment.xml [deleted file]
examples/java/task/priority/Main.java [moved from examples/java/priority/Priority.java with 95% similarity]
examples/java/task/priority/Test.java [moved from examples/java/priority/Test.java with 97% similarity]
examples/java/task/priority/priority.xml [new file with mode: 0644]
examples/java/task/priority/task_priority.tesh [new file with mode: 0644]
examples/msg/CMakeLists.txt
examples/msg/priority/priority_d.xml [deleted file]
examples/msg/task-priority/task-priority.c [moved from examples/msg/priority/priority.c with 77% similarity]
examples/msg/task-priority/task-priority.tesh [moved from examples/msg/priority/priority.tesh with 68% similarity]
examples/msg/task-priority/task-priority_d.xml [new file with mode: 0644]
tools/cmake/DefinePackages.cmake

index 842f801..a578a27 100644 (file)
@@ -167,7 +167,7 @@ examples/msg/process-migration/process-migration
 examples/msg/ms.trace
 examples/msg/ns3/ns3
 examples/msg/pmm/pmm
 examples/msg/ms.trace
 examples/msg/ns3/ns3
 examples/msg/pmm/pmm
-examples/msg/priority/priority
+examples/msg/task-priority/task-priority
 examples/msg/procmig.trace
 examples/msg/properties/properties
 examples/msg/synchro/synchro
 examples/msg/procmig.trace
 examples/msg/properties/properties
 examples/msg/synchro/synchro
@@ -986,8 +986,8 @@ examples/java/process/kill/java_process_kill_compiled
 examples/java/process/migration/java_process_migration_compiled
 examples/java/process/suspend/java_process_suspend_compiled
 examples/java/pingPong/java_pingPong_compiled
 examples/java/process/migration/java_process_migration_compiled
 examples/java/process/suspend/java_process_suspend_compiled
 examples/java/pingPong/java_pingPong_compiled
-examples/java/priority/java_priority_compiled
 examples/java/process/startkilltime/java_process_startkilltime_compiled
 examples/java/process/startkilltime/java_process_startkilltime_compiled
+examples/java/task/priority/java_task_priority_compiled
 examples/java/tracing/java_tracing_compiled
 /CMakeCache.txt
 examples/smpi/mc/smpi_bugged1
 examples/java/tracing/java_tracing_compiled
 /CMakeCache.txt
 examples/smpi/mc/smpi_bugged1
index 76ff8c9..41d6dc0 100644 (file)
@@ -53,9 +53,12 @@ set(process_startkilltime_sources ${srcdir}/Main.java ${srcdir}/Sleeper.java)
 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend)
 set(process_suspend_sources    ${srcdir}/Main.java  ${srcdir}/DreamMaster.java  ${srcdir}/LazyGuy.java)
 
 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend)
 set(process_suspend_sources    ${srcdir}/Main.java  ${srcdir}/DreamMaster.java  ${srcdir}/LazyGuy.java)
 
+set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/task/priority)
+set(task_priority_sources      ${srcdir}/Main.java  ${srcdir}/Test.java)
+
 foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker 
          dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration
 foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker 
          dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration
-         process_startkilltime process_suspend)
+         process_startkilltime process_suspend task_priority)
   string (REPLACE "_" "/" example_dir ${example})
   if(enable_java)
     add_custom_command(
   string (REPLACE "_" "/" example_dir ${example})
   if(enable_java)
     add_custom_command(
@@ -83,12 +86,13 @@ set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/bi
                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/masterworker.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/masterworker.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime/startkilltime.xml   PARENT_SCOPE)
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime/startkilltime.xml
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/task/priority/priority.xml                  PARENT_SCOPE)
 
 if(enable_java)
   foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker 
            dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration
 
 if(enable_java)
   foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker 
            dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration
-           process_startkilltime process_suspend)
+           process_startkilltime process_suspend task_priority)
     string (REPLACE "_" "/" example_dir ${example})
     ADD_TESH(java-${example}  --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh)
   endforeach()
     string (REPLACE "_" "/" example_dir ${example})
     ADD_TESH(java-${example}  --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh)
   endforeach()
diff --git a/examples/java/priority/CMakeLists.txt b/examples/java/priority/CMakeLists.txt
deleted file mode 100644 (file)
index f254e91..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-set(example java_priority)
-set(sources ${CMAKE_CURRENT_SOURCE_DIR}/Priority.java ${CMAKE_CURRENT_SOURCE_DIR}/Test.java)
-
-if(enable_java)
-  add_custom_command(
-    COMMENT "Building ${example}..."
-    OUTPUT ${example}_compiled
-    DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
-    COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
-    COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
-    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
-  )
-  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
-  ADD_TESH(java-priority --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/priority/priority.tesh)
-endif()
-
-set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/priority.tesh           PARENT_SCOPE)
-set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/priorityDeployment.xml  PARENT_SCOPE)
-set(examples_src  ${examples_src}  ${sources}                                          PARENT_SCOPE)
diff --git a/examples/java/priority/priority.tesh b/examples/java/priority/priority.tesh
deleted file mode 100644 (file)
index 004ef19..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#! tesh
-
-! output sort 19
-
-$ java -classpath ${classpath:=.} priority/Priority ${srcdir:=.}/../platforms/platform.xml ${srcdir:=.}/priority/priorityDeployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:maestro@) Using regular java threads.
-> [  0.000000] (1:priority.Test@Fafard) Hello! Running a task of size 7.6296E7 with priority 1.0
-> [  0.000000] (2:priority.Test@Fafard) Hello! Running a task of size 7.6296E7 with priority 2.0
-> [  0.833332] (2:priority.Test@Fafard) Goodbye now!
-> [  1.111109] (0:maestro@) MSG_main finished; Cleaning up the simulation...
-> [  1.111109] (1:priority.Test@Fafard) Goodbye now!
diff --git a/examples/java/priority/priorityDeployment.xml b/examples/java/priority/priorityDeployment.xml
deleted file mode 100644 (file)
index ddf55b5..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4">
-  <process host="Fafard" function="priority.Test">
-       <argument value="76296000"/>
-       <argument value="1.0"/>
-  </process>
-  <process host="Fafard" function="priority.Test">
-       <argument value="76296000"/>
-       <argument value="2.0"/>
-  </process>
-</platform>
similarity index 95%
rename from examples/java/priority/Priority.java
rename to examples/java/task/priority/Main.java
index 10fa76a..adf7fc2 100644 (file)
@@ -4,12 +4,12 @@
 /* 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. */
 
 /* 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. */
 
-package priority;
+package task.priority;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.NativeException;
 
 /* Demonstrates the use of Task.setPriority to change the computation priority of a task */ 
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.NativeException;
 
 /* Demonstrates the use of Task.setPriority to change the computation priority of a task */ 
-public class Priority  {
+public class Main {
   public static void main(String[] args) throws NativeException {
     Msg.init(args);
     if(args.length < 2) {
   public static void main(String[] args) throws NativeException {
     Msg.init(args);
     if(args.length < 2) {
similarity index 97%
rename from examples/java/priority/Test.java
rename to examples/java/task/priority/Test.java
index 8fb44d3..7edd279 100644 (file)
@@ -4,7 +4,7 @@
 /* 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. */
 
 /* 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. */
 
-package priority;
+package task.priority;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
 import org.simgrid.msg.Task;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
 import org.simgrid.msg.Task;
diff --git a/examples/java/task/priority/priority.xml b/examples/java/task/priority/priority.xml
new file mode 100644 (file)
index 0000000..a2784b2
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
+<platform version="4">
+  <process host="Fafard" function="task.priority.Test"> <argument value="76296000"/> <argument value="1.0"/> </process>
+  <process host="Fafard" function="task.priority.Test"> <argument value="76296000"/> <argument value="2.0"/> </process>
+</platform>
diff --git a/examples/java/task/priority/task_priority.tesh b/examples/java/task/priority/task_priority.tesh
new file mode 100644 (file)
index 0000000..c859505
--- /dev/null
@@ -0,0 +1,11 @@
+#! tesh
+
+! output sort 19
+
+$ java -classpath ${classpath:=.} task/priority/Main ${srcdir:=.}/../platforms/small_platform.xml ${srcdir:=.}/task/priority/priority.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (0:maestro@) Using regular java threads.
+> [  0.000000] (1:task.priority.Test@Fafard) Hello! Running a task of size 7.6296E7 with priority 1.0
+> [  0.000000] (2:task.priority.Test@Fafard) Hello! Running a task of size 7.6296E7 with priority 2.0
+> [  1.500000] (2:task.priority.Test@Fafard) Goodbye now!
+> [  2.000000] (0:maestro@) MSG_main finished; Cleaning up the simulation...
+> [  2.000000] (1:task.priority.Test@Fafard) Goodbye now!
index 1cbec02..0e1b300 100644 (file)
@@ -1,6 +1,6 @@
 foreach(x actions-mpi actions-storage async-wait async-waitall async-waitany dht-chord dht-pastry exception 
           energy-consumption energy-onoff energy-pstate energy-ptask energy-vm failures io-file io-file-unlink io-remote
 foreach(x actions-mpi actions-storage async-wait async-waitall async-waitany dht-chord dht-pastry exception 
           energy-consumption energy-onoff energy-pstate energy-ptask energy-vm failures io-file io-file-unlink io-remote
-          io-storage masterslave masterslave-mailbox pmm priority process-kill process-migration process-suspend 
+          io-storage masterslave masterslave-mailbox pmm task-priority process-kill process-migration process-suspend 
           properties sendrecv set-maestro process-startkilltime synchro token_ring trace-categories 
           trace-link-srcdst-user-variables trace-link-user-variables trace-masterslave trace-platform 
           trace-process-migration trace-simple trace-user-variables)
           properties sendrecv set-maestro process-startkilltime synchro token_ring trace-categories 
           trace-link-srcdst-user-variables trace-link-user-variables trace-masterslave trace-platform 
           trace-process-migration trace-simple trace-user-variables)
@@ -39,7 +39,8 @@ foreach (file answer dht-kademlia node routing_table task)
 endforeach()
 
 foreach (file actions-mpi actions-storage async-wait async-waitall async-waitany bittorrent chainsend dht-chord 
 endforeach()
 
 foreach (file actions-mpi actions-storage async-wait async-waitall async-waitany bittorrent chainsend dht-chord 
-         dht-kademlia dht-pastry io-remote masterslave masterslave-mailbox priority properties sendrecv set-maestro)
+         dht-kademlia dht-pastry io-remote masterslave masterslave-mailbox properties sendrecv set-maestro
+         task-priority)
   set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/${file}/${file}_d.xml)
 endforeach()
 
   set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/${file}/${file}_d.xml)
 endforeach()
 
@@ -82,7 +83,7 @@ set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-mpi/action
                                   ${CMAKE_CURRENT_SOURCE_DIR}/process-startkilltime/start_kill_d.xml       PARENT_SCOPE)
 
 foreach(x actions-mpi actions-storage async-wait async-waitall async-waitany bittorrent chainsend dht-chord dht-kademlia
                                   ${CMAKE_CURRENT_SOURCE_DIR}/process-startkilltime/start_kill_d.xml       PARENT_SCOPE)
 
 foreach(x actions-mpi actions-storage async-wait async-waitall async-waitany bittorrent chainsend dht-chord dht-kademlia
-        failures io-file io-file-unlink io-remote io-storage masterslave masterslave-mailbox priority process-kill 
+        failures io-file io-file-unlink io-remote io-storage masterslave masterslave-mailbox task-priority process-kill 
         process-migration process-suspend properties sendrecv synchro process-startkilltime token_ring)
   ADD_TESH_FACTORIES(msg-${x} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/${x} ${x}.tesh)
 endforeach()
         process-migration process-suspend properties sendrecv synchro process-startkilltime token_ring)
   ADD_TESH_FACTORIES(msg-${x} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/${x} ${x}.tesh)
 endforeach()
diff --git a/examples/msg/priority/priority_d.xml b/examples/msg/priority/priority_d.xml
deleted file mode 100644 (file)
index 7a6c462..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4">
-<!-- For using with ping_pong, platform_sendrecv.xml -->
-
-  <process host="Fafard" function="test">
-       <argument value="76296000"/>
-       <argument value="1.0"/>
-  </process>
-  <process host="Fafard" function="test">
-       <argument value="76296000"/>
-       <argument value="2.0"/>
-  </process>
-</platform>
similarity index 77%
rename from examples/msg/priority/priority.c
rename to examples/msg/task-priority/task-priority.c
index 6b951e4..37f477b 100644 (file)
@@ -15,17 +15,11 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example")
 
 static int test(int argc, char *argv[])
 {
 
 static int test(int argc, char *argv[])
 {
-  double computation_amount = 0.0;
-  double priority = 1.0;
-  msg_task_t task = NULL;
-
-  XBT_ATTRIB_UNUSED int res = sscanf(argv[1], "%lg", &computation_amount);
-  xbt_assert(res, "Invalid argument %s\n", argv[1]);
-  res = sscanf(argv[2], "%lg", &priority);
-  xbt_assert(res, "Invalid argument %s\n", argv[2]);
+  double computation_amount = xbt_str_parse_double(argv[1], "Invalid argument: %s");
+  double priority = xbt_str_parse_double(argv[2], "Invalid argument: %s");
 
   XBT_INFO("Hello! Running a task of size %g with priority %g", computation_amount, priority);
 
   XBT_INFO("Hello! Running a task of size %g with priority %g", computation_amount, priority);
-  task = MSG_task_create("Task", computation_amount, 0.0, NULL);
+  msg_task_t task = MSG_task_create("Task", computation_amount, 0.0, NULL);
   MSG_task_set_priority(task, priority);
 
   MSG_task_execute(task);
   MSG_task_set_priority(task, priority);
 
   MSG_task_execute(task);
similarity index 68%
rename from examples/msg/priority/priority.tesh
rename to examples/msg/task-priority/task-priority.tesh
index 34f1712..9c7cb85 100644 (file)
@@ -3,7 +3,7 @@
 p Testing a simple master/slave example application
 
 ! output sort 19
 p Testing a simple master/slave example application
 
 ! output sort 19
-$ $SG_TEST_EXENV ${bindir:=.}/priority$EXEEXT ${srcdir:=.}/small_platform.xml  ${srcdir:=.}/../msg/priority/priority_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/task-priority$EXEEXT ${srcdir:=.}/small_platform.xml  ${srcdir:=.}/../msg/task-priority/task-priority_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (1:test@Fafard) Hello! Running a task of size 7.6296e+07 with priority 1
 > [  0.000000] (2:test@Fafard) Hello! Running a task of size 7.6296e+07 with priority 2
 > [  1.500000] (2:test@Fafard) Goodbye now!
 > [  0.000000] (1:test@Fafard) Hello! Running a task of size 7.6296e+07 with priority 1
 > [  0.000000] (2:test@Fafard) Hello! Running a task of size 7.6296e+07 with priority 2
 > [  1.500000] (2:test@Fafard) Goodbye now!
diff --git a/examples/msg/task-priority/task-priority_d.xml b/examples/msg/task-priority/task-priority_d.xml
new file mode 100644 (file)
index 0000000..dc50e15
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
+<platform version="4">
+  <process host="Fafard" function="test"> <argument value="76296000"/> <argument value="1.0"/> </process>
+  <process host="Fafard" function="test"> <argument value="76296000"/> <argument value="2.0"/> </process>
+</platform>
index 8064f22..d6ec1ed 100644 (file)
@@ -926,7 +926,6 @@ set(CMAKEFILES_TXT
   examples/java/CMakeLists.txt
     examples/java/async/CMakeLists.txt
     examples/java/pingPong/CMakeLists.txt
   examples/java/CMakeLists.txt
     examples/java/async/CMakeLists.txt
     examples/java/pingPong/CMakeLists.txt
-    examples/java/priority/CMakeLists.txt
     examples/java/tracing/CMakeLists.txt
   examples/msg/CMakeLists.txt
     examples/msg/cloud/CMakeLists.txt
     examples/java/tracing/CMakeLists.txt
   examples/msg/CMakeLists.txt
     examples/msg/cloud/CMakeLists.txt