set(soversion 1)
set(SIMGRID_JAVA_VERSION_MAJOR "3")
-set(SIMGRID_JAVA_VERSION_MINOR "7")
-set(SIMGRID_JAVA_VERSION_PATCH "1")
+set(SIMGRID_JAVA_VERSION_MINOR "8")
+set(SIMGRID_JAVA_VERSION_PATCH "0")
set(DIST_NAME ${PROJECT_NAME}-${SIMGRID_JAVA_VERSION_MAJOR}.${SIMGRID_JAVA_VERSION_MINOR}.${SIMGRID_JAVA_VERSION_PATCH})
########
SimGrid-java (3.8) unstable; urgency=low
- * Introduce org.simgrid.trace.Trace (partial implementation of JAVA bindings
- for the TRACE API).
- Although all TRACE methods appear in the Trace class, please not that only
- few of thems are really implemented at the JNI level (see ./src/jtrace.c
- for further information).
- Extend the API:
+ * New module: org.simgrid.trace.Trace (SimGrid trace bindings)
+ Warning: all methods are visible, but only some of them are
+ implemented so far. Check the source (src/jtrace.c)
+ for further information.
* New module: org.simgrid.msg.File (SimGrid File management functions)
- * New Module: org.simgrid.msg.VM (SimGrid interface to mimick IAAS
-clouds)
- * Change the meaning of Process.restart: now restart the process from the start, like MSG_process_restart in C.
- * Add Process.setAutoRestart: handling of process restart when failed host comes back.
- * Add Process.getProperty, Host.getProperty, Host.getProperty: allows you to retrieve the properties of the processes/hosts
+ * New Module: org.simgrid.msg.VM (SimGrid interface to mimick IAAS clouds)
+ * Change the meaning of Process.restart: now restart the process from
+ the begining, like MSG_process_restart in C.
+ * Add Process.setAutoRestart: handling of process restart when failed
+ host comes back.
+ * Add Process.getProperty, Host.getProperty, Host.getProperty: allows
+ you to retrieve the properties of the processes/hosts
+ * Deprecate Msg.clean(): you can just forget about it now.
+
+ * New context factory based on Coroutines. It mandates a modified JVM
+ but then, the simulations run about five times faster, and there is
+ no limit to the amount of processes (beside of the available memory).
- * Introduce a new context factory based on Coroutines (read the doc to know how to use it): simulations are expected to run up to five times faster.
SimGrid-java (3.7.1) stable; urgency=low
The "Java aint got to be bloated and slow" release
Simgrid</a>). You should set the SIMGRID_ROOT environment
variable to the path where you installed SimGrid.
\li Java JDK packages, such as sun-java6-jdk (with libgcj10-dev or
-another version of gcj) or openjdk6.
+another version of gcj) or openjdk6. For maximal performance and
+scalability, use a coroutine-enabled JVM (see
+\ref bindings_binding_java_coroutines).
Then Download and install package Simgrid-java:
\verbatim
$ java -cp .:../simgrid.jar basic/BasicTest platform.xml basic/basicDeployment.xml
\endverbatim
+
+
+
+
+
+
+
\section bindings_binding_java_coroutines How to use the coroutines context factory
-You may want to use the coroutines context factory, if speed maters to you (since it's about 5 times faster than the default thread-based context factory).
+There is two main motivations to use the coroutine variant of SimGrid
+Java bindings: it's about 5 times faster than the default thread-based
+context factory, and the amount of runnable processes is then only
+limited by the amount of RAM that you have. The drawbacks are that it
+requires a specific and rather experimental JVM to run, and that this
+context factory itself remains a bit experimental so far.
+
+\subsection bindings_java_coro_install Getting a mlvm JVM
+
+You need to get a patched JVM from <a href="http://ssw.jku.at/General/Staff/LS/coro/">here</a>
+(many thanks to Lukas Stadler for this work!).
+
+You can either get a prebuilt binary, or recompile your own JVM. Make
+sure to get a coro-simple version, as we don't need to serialize nor
+migrate stacks in SimGrid. You should be able to follow the README.txt
+that you'll get in the repository, but here is how we did it, just in
+case. The instructions are given for a debian or Ubuntu box, but I
+think you should manage to convert it to your system quite easily.
+
+ -# Install mercurial and some dependencies
+\verbatim
+sudo apt-get install mercurial ksh libfreetype6-dev libcups2-dev libasound2-dev gawk openjdk-7-jdk libxext-dev libxrender-dev libxtst-dev
+# Grab the forest extension: we need to source-install it
+hg clone https://bitbucket.org/gxti/hgforest hgforest \endverbatim
+\endverbatim
+ -# Configure the mercurial extensions: Edit ~/.hgrc and paste the
+ following lines. Don't forget to change the /path/to/forest.py to
+ point to where you just downloaded the source.
+
+ Forest extension is needed to download the openjdk source code and
+ patches while the mq line is needed to apply the patches. The
+ username is needed at the step "preparing the sources", not sure why.
+\verbatim
+[ui]
+username = YouUserameWithoutSpaces
+[extensions]
+forest=/path/to/forest.py
+mq=
+\endverbatim
+ -# Prepare the source code
+\verbatim
+# create a working directory, and enter it
+mkdir davinci; cd davinci
+
+# Grab the sources
+hg fclone http://hg.openjdk.java.net/hsx/hotspot-comp sources
+# Grab the patches
+hg fclone http://hg.openjdk.java.net/mlvm/mlvm patches
+
+# Link the patch directories into the sources
+bash patches/make/link-patch-dirs.sh sources patches
+# Test wether the previous command worked with
+ls -i patches/hotspot/series sources/hotspot/.hg/patches/series
+# It should display something like the following.
+# (note that both file share the same inode number)
+# 9707849 patches/hotspot/series
+# 9707849 sources/hotspot/.hg/patches/series
+
+
+# Specify what to compile.
+export davinci=$(pwd) guards="buildable testable coro-simple"
+# Apply the patches
+sh patches/make/each-patch-repo.sh hg qselect --reapply $guards '$(sh $davinci/patches/make/current-release.sh)'
+# Check that it understood that you want the patch applied:
+grep GLOBAL_GUARDS patches/make/* -r
+# this should display something like the following (maybe amonst other unrelated lines)
+# GLOBAL_GUARDS=buildable testable coro-simple
+# If this does not work, edit patches/make/Makefile,
+# manually coro-simple to GLOBAL_GUARDS and then
+# rerun the patches/make/each-patch-repo.sh script as earlier
-First, remember that the coroutines context factory is still experimental work.
-To use the coroutines context factory, you need a Java virtual machine which supports it.
+# Finish the setup
+(cd patches/make; make setup && make force && make && make FORCE_VERSIONS=1 && echo "Sources are properly setup")
+# If this last command failed, check your mercurial config within ~/.hgrc (see above)
+\endverbatim
+ -# Compile it all
+\verbatim
+unset LD_LIBRARY_PATH
+export ALT_BOOTDIR=/usr/lib/jvm/java-7-openjdk-amd64/
+cd sources
+# Check that everything is fine
+make sanity
+# Go for it (it takes about half an hour on my machine)
+make all
+
+# Check that the coroutine library got compiled in
+ls sources/build/linux-amd64/classes/java/dyn/
+# This should display a bunch of class files. If not, something went wrong, you need to investigate further
+\endverbatim
-Our implementation rely on a JVM patch made by Lukas Stadler, which you can find <a href="http://ssw.jku.at/General/Staff/LS/coro/">here</a>. You can either recompile the JVM yourself or use the pre-built binaries offered.
+\subsection bindings_java_coro_use Using coroutine contexts
-SimGrid Java will automatically switch to the coroutine context factory if your JVM support it, so you will just need to execute your simulation with the correct JVM:
+SimGrid Java will automatically switch to the coroutine context
+factory if your JVM support it, so you will just need to execute your
+simulation with the correct JVM. The selected context factory gets
+displayed automatically.
\verbatim
-$ $PATH_TO_COROUTINE_JVM/java -cp .:../simgrid.jar basic/BasicTest platform.xml basic/basicDeployment.xml
+export LD_LIBRARY_PATH=/path/to/simgrid.so:/path/to/libSG_java.so
+cd examples
+$PATH_TO_COROUTINE_JVM/java -cp .:../simgrid.jar masterslave.Masterslave masterslave/ masterslaveDeployment.xml platform.xml
\endverbatim
-Notice that you may have to adjust the "coro.stacksPerThread" configuration option to run large simulations:
+Note that you may have to adjust the "coro.stacksPerThread"
+configuration option to run large simulations. The default is 100 and
+you want to increase it to run more processes.
\verbatim
$ $PATH_TO_COROUTINE_JVM/java -Dcoro.stacksPerThread=$STACKS_NUMBER -cp .:../simgrid.jar basic/BasicTest platform.xml basic/basicDeployment.xml
-\endverbatim
+\endverbatim
+
+If you feel limited in the amount of processes you can run, give a try
+to this command:
+\verbatim
+sysctl -w vm.max_map_count = 131072
+\endverbatim
*/
> [ 29.000728] (0:@) MSG_main finished
> [ 29.000728] (0:@) Clean java world
> [ 29.000728] (0:@) Clean native world
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
! output sort
$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar bittorrent/Bittorrent ${srcdir:=.}/examples/platform.xml ${srcdir:=.}/examples/bittorrent/bittorrent.xml
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [0.000000] [jmsg/INFO] Ready to run MSG_MAIN
> [5000.832370] [jmsg/INFO] Done running MSG_MAIN
> [5000.832370] [jmsg/INFO] MSG_main finished
! output sort
$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar chord/Chord ${srcdir:=.}/examples/platform.xml ${srcdir:=.}/examples/chord/chord.xml
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [0.000000] [jmsg/INFO] Ready to run MSG_MAIN
> [652.548539] [jmsg/INFO] Done running MSG_MAIN
> [652.548539] [jmsg/INFO] MSG_main finished
/* Execute the simulation */
Msg.run();
- Msg.clean();
}
}
\ No newline at end of file
> [ 13.715289] (11:Slave 9@Fafard) Receiving on slave_9
> [ 13.715289] (1:Master@Jacquelin) Enough. Let's resume everybody.
> [ 13.715289] (1:Master@Jacquelin) Sleep long enough for everyone to be done with previous batch of work
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [1000.000000] (12:Slave 10@Jacquelin) Receiving on slave_10
> [1000.000000] (13:Slave 11@Intel) Receiving on slave_11
> [1000.000000] (14:Slave 12@Provost) Receiving on slave_12
! output sort
$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar commTime/CommTimeTest ${srcdir:=.}/examples/platform.xml ${srcdir:=.}/examples/commTime/commTimeDeployment.xml
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [0.000000] [jmsg/INFO] Ready to run MSG_MAIN
> [7016.935689] [jmsg/INFO] Done running MSG_MAIN
> [7016.935689] [jmsg/INFO] MSG_main finished
! output sort
$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar kademlia/Kademlia ${srcdir:=.}/examples/platform.xml ${srcdir:=.}/examples/kademlia/kademlia.xml
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [0.000000] [jmsg/INFO] Ready to run MSG_MAIN
> [900.000000] [jmsg/INFO] Done running MSG_MAIN
> [900.000000] [jmsg/INFO] MSG_main finished
! output sort
$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar master_slave_bypass/MsBypass ${srcdir:=.}/examples/master_slave_bypass/platform.xml
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [0.000000] [jmsg/INFO] Ready to run MSG_MAIN
> [0.013010] [jmsg/INFO] Done running MSG_MAIN
> [0.013010] [jmsg/INFO] MSG_main finished
! output sort
$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar master_slave_kill/MsKill ${srcdir:=.}/examples/master_slave_kill/platform.xml
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [0.000000] [jmsg/INFO] Ready to run MSG_MAIN
> [0.013010] [jmsg/INFO] Done running MSG_MAIN
> [0.013010] [jmsg/INFO] MSG_main finished
> [ 17.252217] (0:@) Clean native world
> [ 17.252217] (1:masterslave.Master@Jacquelin) Goodbye now!
> [ 17.252217] (8:masterslave.Slave@Browne) Received Finalize. I'm done. See you!
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [ 7.000000] (1:migration.Emigrant@Jacquelin) I've been moved on this new host:Jacquelin
> [ 7.000000] (1:migration.Emigrant@Jacquelin) Uh, nothing to do here. Stopping now
> [ 7.000000] (2:migration.Policeman@Boivin) I moved the emigrant
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
! output sort
$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar mutualExclusion/centralized/MutexCentral ${srcdir:=.}/examples/mutualExclusion/ring3.xml ${srcdir:=.}/examples/mutualExclusion/centralized/mutex_centralized_deployment.xml
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [0.000000] [jmsg/INFO] Ready to run MSG_MAIN
> [0.007806] [jmsg/INFO] Done running MSG_MAIN
> [0.007806] [jmsg/INFO] MSG_main finished
! output sort
$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar pingPong/PingPongTest ${srcdir:=.}/examples/platform.xml ${srcdir:=.}/examples/pingPong/pingPongDeployment.xml
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [0.000000] [jmsg/INFO] Ready to run MSG_MAIN
> [1.048890] [jmsg/INFO] Done running MSG_MAIN
> [1.048890] [jmsg/INFO] MSG_main finished
> [ 1.111109] (0:@) Clean java world
> [ 1.111109] (0:@) Clean native world
> [ 1.111109] (1:priority.Test@Fafard) Goodbye now!
-
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
#! ./tesh
$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar startKillTime/StartKillTime ${srcdir:=.}/examples/platform.xml ${srcdir:=.}/examples/startKillTime/deployment_start_kill.xml
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [0.000000] [jmsg/INFO] Ready to run MSG_MAIN
> [Jacquelin:startKillTime.Master:(1) 0.000000] [jmsg/INFO] Hello!
> [Boivin:startKillTime.Slave:(2) 1.000000] [jmsg/INFO] Hello!
#! ./tesh
! output sort
-
$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar suspend/Suspend ${srcdir:=.}/examples/platform.xml ${srcdir:=.}/examples/suspend/suspendDeployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (0:@) Ready to run MSG_MAIN
> [ 0.000000] (1:suspend.DreamMaster@Jacquelin) Let's create a lazy guy.
> [ 10.000000] (1:suspend.DreamMaster@Jacquelin) OK, goodbye now.
> [ 10.000000] (2:Lazy@Jacquelin) Uuuh ? Did somebody call me ?
> [ 10.000000] (2:Lazy@Jacquelin) Mmmh, goodbye now.
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
/* execute the simulation. */
Msg.run();
- Msg.clean();
}
}
! output sort
$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar tracing/TracingTest ${srcdir:=.}/examples/platform.xml ${srcdir:=.}/examples/tracing/tracingPingPongDeployment.xml --cfg=tracing:1 --cfg=tracing/filename:simulation.trace --cfg=tracing/platform:1
+> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
> [0.000000] [jmsg/INFO] Ready to run MSG_MAIN
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to '1'
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/filename' to 'simulation.trace'
*/
public final static native void run() ;
- /**
- * Cleanup the MSG simulation.
- *
- * This function is only useful if you want to chain the simulations within
- * the same environment. But actually, it's not sure at all that cleaning the
- * JVM is faster than restarting a new one, so it's probable that using this
- * function is not a brilliant idea. Do so at own risk.
- *
- * @see MSG_clean
- */
- public final static native void clean();
-
+ /** This function is useless nowadays, just stop calling it. */
+ @Deprecated
+ public final static void clean(){}
/**
* The native implemented method to create the environment of the simulation.
(*env)->GetJavaVM(env, &__java_vm);
if ((*env)->FindClass(env, "java/dyn/Coroutine")) {
- XBT_VERB("Using Coroutines");
+ XBT_INFO("Using Coroutines. Your simulation is on steroid.");
smx_factory_initializer_to_use = SIMIX_ctx_cojava_factory_init;
}
else {
- XBT_VERB("Using java threads");
+ XBT_INFO("Using regular java threads. Coroutines could speed your simulation up.");
smx_factory_initializer_to_use = SIMIX_ctx_java_factory_init;
}
jthrowable exc = (*env)->ExceptionOccurred(env);
xbt_dynar_free(&hosts);
XBT_INFO("Clean native world");
}
-JNIEXPORT void JNICALL
- JNICALL Java_org_simgrid_msg_Msg_clean(JNIEnv * env, jclass cls)
-{
- /* cleanup native stuff. Calling it is ... useless since leaking memory at the end of the simulation is a non-issue */
- msg_error_t rv = MSG_OK != MSG_clean();
- jxbt_check_res("MSG_clean()", rv, MSG_OK,
- bprintf
- ("unexpected error : MSG_clean() failed .. please report this bug "));
-}
JNIEXPORT void JNICALL
Java_org_simgrid_msg_Msg_createEnvironment(JNIEnv * env, jclass cls,
*/
JNIEXPORT void JNICALL
JNICALL Java_org_simgrid_msg_Msg_run(JNIEnv * env, jclass cls);
-/**
- * Class org_simgrid_msg_Msg
- * Method clean
- */
-JNIEXPORT void JNICALL
- JNICALL Java_org_simgrid_msg_Msg_clean(JNIEnv * env, jclass cls);
JNIEXPORT void JNICALL
Java_org_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs);
TRY {
context->thread = xbt_os_thread_create(NULL,smx_ctx_java_thread_run,context,NULL);
} CATCH(e) {
- RETHROWF("Impossible to create context #%d. You may want to switch to Java continuations to increase your limits (error: %s)",
+ RETHROWF("Failed to create context #%d. You may want to switch to Java coroutines to increase your limits (error: %s)."
+ "See the Install section of simgrid-java documentation (in doc/install.html) for more on coroutines.",
thread_amount);
}
}