examples/master_slave_bypass/MsBypass.java
examples/master_slave_bypass/Slave.java
examples/master_slave_bypass/FinalizeTask.java
+ examples/master_slave_kill/Master.java
+ examples/master_slave_kill/MsKill.java
+ examples/master_slave_kill/Slave.java
+ examples/master_slave_kill/FinalizeTask.java
)
set(CMAKE_SRC
examples/basic/basicDeployment.xml
examples/basic/deploy.xml
examples/master_slave_bypass/platform.xml
+ examples/master_slave_kill/platform.xml
)
set(source_to_pack
COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/commTime/*.java
COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/mutualExclusion/centralized/*.java
COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/master_slave_bypass/*.java
+ COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/master_slave_kill/*.java
)
+
add_custom_target(simgrid_java_examples ALL
DEPENDS ${JAVA_EXAMPLES_CLASS}
)
ADD_TEST(bypass
java -cp .:${CMAKE_HOME_DIRECTORY}/examples:${CMAKE_HOME_DIRECTORY}/simgrid.jar master_slave_bypass/MsBypass ${CMAKE_HOME_DIRECTORY}/examples/master_slave_bypass/platform.xml
)
-
+ADD_TEST(kill
+java -cp .:${CMAKE_HOME_DIRECTORY}/examples:${CMAKE_HOME_DIRECTORY}/simgrid.jar master_slave_kill/MsKill ${CMAKE_HOME_DIRECTORY}/examples/master_slave_kill/platform.xml
+)
##########################################
# Set the DYLD_LIBRARY_PATH for mac #
##########################################
if(APPLE)
if($ENV{DYLD_LIBRARY_PATH} STREQUAL "")
- set_tests_properties(basic pingPong CommTime mutualExclusion
+ set_tests_properties(basic pingPong CommTime mutualExclusion bypass kill
PROPERTIES ENVIRONMENT "DYLD_LIBRARY_PATH=${CMAKE_HOME_DIRECTORY}/lib:$ENV{SIMGRID_ROOT}/lib")
else($ENV{DYLD_LIBRARY_PATH} STREQUAL "")
- set_tests_properties(basic pingPong CommTime mutualExclusion
+ set_tests_properties(basic pingPong CommTime mutualExclusion bypass kill
PROPERTIES ENVIRONMENT "DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}:${CMAKE_HOME_DIRECTORY}/lib:$ENV{SIMGRID_ROOT}/lib")
endif($ENV{DYLD_LIBRARY_PATH} STREQUAL "")
endif(APPLE)
# Set the LD_LIBRARY_PATH for our tests #
##########################################
if($ENV{LD_LIBRARY_PATH} STREQUAL "")
- set_tests_properties(basic pingPong CommTime mutualExclusion
+ set_tests_properties(basic pingPong CommTime mutualExclusion bypass kill
PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_HOME_DIRECTORY}/lib:$ENV{SIMGRID_ROOT}/lib")
else($ENV{LD_LIBRARY_PATH} STREQUAL "")
- set_tests_properties(basic pingPong CommTime mutualExclusion
+ set_tests_properties(basic pingPong CommTime mutualExclusion bypass kill
PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_HOME_DIRECTORY}/lib:$ENV{SIMGRID_ROOT}/lib")
endif($ENV{LD_LIBRARY_PATH} STREQUAL "")
#IF YOU HAVE INSTALL SIMGRID IN A SPECIAL DIRECTORY
#YOU CAN SPECIFY SIMGRID_ROOT OR GRAS_ROOT
-# TO CALL THIS FILE USE
- #set(CMAKE_MODULE_PATH
- #${CMAKE_MODULE_PATH}
- #${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/Modules
- #)
-
find_library(HAVE_SIMGRID_LIB
NAME simgrid
HINTS
- $ENV{LD_LIBRARY_PATH}
- $ENV{GRAS_ROOT}
$ENV{SIMGRID_ROOT}
- PATH_SUFFIXES lib64 lib
- PATHS
- /opt
- /opt/local
- /opt/csw
- /sw
- /usr
+ PATH_SUFFIXES lib
)
find_path(HAVE_GRAS_H gras.h
HINTS
- $ENV{GRAS_ROOT}
$ENV{SIMGRID_ROOT}
PATH_SUFFIXES include
- PATHS
- /opt
- /opt/local
- /opt/csw
- /sw
- /usr
-)
-
-find_program(HAVE_TESH
- NAMES tesh
- HINTS
- $ENV{GRAS_ROOT}
- $ENV{SIMGRID_ROOT}
- PATH_SUFFIXES bin
- PATHS
- /opt
- /opt/local
- /opt/csw
- /sw
- /usr
-)
-
-find_program(HAVE_GRAS_STUB
- NAMES gras_stub_generator
- HINTS
- $ENV{GRAS_ROOT}
- $ENV{SIMGRID_ROOT}
- PATH_SUFFIXES bin
- PATHS
- /opt
- /opt/local
- /opt/csw
- /sw
- /usr
)
message(STATUS "Looking for lib SimGrid")
message(STATUS "Looking for gras.h - not found")
endif(HAVE_GRAS_H)
-if(HAVE_TESH)
-message(STATUS "Found Tesh: ${HAVE_TESH}")
-endif(HAVE_TESH)
-
-if(HAVE_GRAS_STUB)
-message(STATUS "Found gras_stub_generator: ${HAVE_GRAS_STUB}")
-endif(HAVE_GRAS_STUB)
\ No newline at end of file
+if(HAVE_SIMGRID_LIB AND HAVE_GRAS_H)
+else(HAVE_SIMGRID_LIB AND HAVE_GRAS_H)
+ message(FATAL_ERROR "You need to install simgrid and set environment variable SIMGRID_ROOT!")
+endif(HAVE_SIMGRID_LIB AND HAVE_GRAS_H)
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2006,2007,2010. The SimGrid Team. All rights reserved.
+ *
+ * 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 master_slave_kill;
+import org.simgrid.msg.Task;
+
+public class FinalizeTask extends Task {
+ public FinalizeTask() {
+ super("finalize",0,0);
+ }
+}
+
\ No newline at end of file
--- /dev/null
+/*
+ * Master of a basic master/slave example in Java
+ *
+ * Copyright 2006,2007,2010 The SimGrid Team. All rights reserved.
+ *
+ * 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 master_slave_kill;
+import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.Msg;
+import org.simgrid.msg.MsgException;
+import org.simgrid.msg.Process;
+import org.simgrid.msg.Task;
+
+import master_slave_kill.FinalizeTask;
+
+public class Master extends Process {
+ public Master(String hostname, String name) throws HostNotFoundException {
+ super(hostname, name);
+ }
+ public void main(String[] args) throws MsgException {
+ Msg.info("Master Hello!");
+ Process process2 = null;
+ //Create a slave on host "alice"
+ try {
+ Msg.info("Create process on host 'alice'");
+ process2 = new Slave("alice","slave");
+ } catch (MsgException e){
+ System.out.println("Process2!");
+ }
+
+ //Wait for slave "alice"
+ while(true)
+ {
+ Task task = Task.receive("mail1");
+ if (task instanceof FinalizeTask) {
+ Msg.info("Received mail1!");
+ break;
+ }
+ }
+
+// FinalizeTask task = new FinalizeTask();
+// Msg.info("Send Mail2!");
+// task.send("mail2");
+
+ Process.waitFor(10);
+ Process.kill(process2);
+
+ }
+}
--- /dev/null
+/*
+ * Copyright 2006,2007,2010. The SimGrid Team. All rights reserved.
+ *
+ * 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 master_slave_kill;
+
+import org.simgrid.msg.Msg;
+import org.simgrid.msg.MsgException;
+import org.simgrid.msg.NativeException;
+
+public class MsKill {
+
+ /* This only contains the launcher. If you do nothing more than than you can run
+ * java simgrid.msg.Msg
+ * which also contains such a launcher
+ */
+
+ public static void main(String[] args) throws NativeException {
+
+ /* initialize the MSG simulation. Must be done before anything else (even logging). */
+ Msg.init(args);
+ Msg.createEnvironment(args[0]);
+
+ /* bypass deploymemt */
+ try {
+ Master process1 = new Master("bob","master");
+ }
+ catch (MsgException e){
+ System.out.println("Create processes failed!");
+ }
+
+ /* execute the simulation. */
+ Msg.run();
+ }
+}
--- /dev/null
+/*
+ * Copyright 2006,2007,2010. The SimGrid Team. All rights reserved.
+ *
+ * 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 master_slave_kill;
+import org.simgrid.msg.HostFailureException;
+import org.simgrid.msg.HostNotFoundException;
+import org.simgrid.msg.Msg;
+import org.simgrid.msg.Task;
+import org.simgrid.msg.TimeoutException;
+import org.simgrid.msg.TransferFailureException;
+import org.simgrid.msg.Process;
+
+import master_slave_kill.FinalizeTask;
+
+public class Slave extends Process {
+ public Slave(String hostname, String name) throws HostNotFoundException {
+ super(hostname, name);
+ }
+ public void main(String[] args) throws TransferFailureException, HostFailureException, TimeoutException {
+ Msg.info("Slave Hello!");
+
+ FinalizeTask task = new FinalizeTask();
+ Msg.info("Send Mail1!");
+ task.send("mail1");
+
+ Task task2 = Task.receive("mail2");
+ Msg.info("Receive Mail2!");
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+<AS id="AS0" routing="Full">
+ <host id="bob" power="137333000"/>
+ <host id="alice" power="98095000"/>
+ <host id="nono" power="98095000"/>
+
+ <link id="1" bandwidth="100000000" latency="0.001"/>
+ <link id="2" bandwidth="100000000" latency="0.001"/>
+ <link id="3" bandwidth="100000000" latency="0.001"/>
+
+ <route src="bob"
+ dst="alice"
+ symmetrical="YES">
+ <link_ctn id="1"/>
+ </route>
+ <route src="alice"
+ dst="nono"
+ symmetrical="YES">
+ <link_ctn id="2"/>
+ </route>
+ <route src="bob"
+ dst="nono"
+ symmetrical="YES">
+ <link_ctn id="3"/>
+ </route>
+</AS>
+</platform>
\ No newline at end of file
/* get the native task */
m_task_t task = jtask_to_native_task(jtask_arg, env);
- jobject jtask;
+// jobject jtask;
if (!task) {
jxbt_throw_notbound(env, "task", task);
return;
}
- jtask = (jobject) MSG_task_get_data(task);
+// jtask = (jobject) MSG_task_get_data(task);
MSG_error_t rv = MSG_task_destroy(task);