Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
include the documentation from Jonathan (a bit updated by me, but network down; canno...
[simgrid.git] / doc / install.doc
1 /*! \page install Java Binding
2
3 \section bindings_binding_java_install How to install Simgrid-java
4
5 To use java with Simgrid you have to install some dependencies:
6  \li Simgrid (see <a href="http://simgrid.gforge.inria.fr/simgrid/3.7/doc/install.html">install
7      Simgrid</a>). You should set the SIMGRID_ROOT environment
8      variable to the path where you installed SimGrid.
9  \li Java JDK packages, such as sun-java6-jdk (with libgcj10-dev or
10 another version of gcj) or openjdk6. For maximal performance and
11 scalability, use a coroutine-enabled JVM (see
12 \ref bindings_binding_java_coroutines).
13  
14 Then Download and install package Simgrid-java:
15 \verbatim
16 git clone git://scm.gforge.inria.fr/simgrid/simgrid-java.git
17 cd simgrid-java
18 cmake -DCMAKE_INSTALL_PREFIX=$HOME/Install/simgrid-java/ .
19 make install
20 \endverbatim
21  
22 Cmake output
23 \verbatim
24 -- SITE        : Linux_2.6.38-8-generic_x86_64
25 -- BUILDNAME   : Simgrid-Java
26 -- Looking for lib SimGrid
27 -- Looking for lib SimGrid - found
28 -- Simgrid version : 3.6
29 -- Looking for gras.h
30 -- Looking for gras.h - found
31 -- Found Tesh: /home/user/Bureau/simgrid/git/bin/tesh
32 -- Found gras_stub_generator: /home/user/Bureau/simgrid/git/bin/gras_stub_generator
33 -- Java version 1.6.0.22 configured successfully!
34 -- Looking for jni.h
35 -- Looking for jni.h - found
36 -- Add flags -I/usr/lib/jvm/java-6-openjdk/include
37 -- Looking for jni_md.h
38 -- Looking for jni_md.h - found
39 -- Found javac: /usr/bin/javac
40 -- Found jar: /usr/bin/jar
41 -- Configuring done
42 -- Generating done
43 -- Build files have been written to: /home/user/workspace/simgrid-java/build
44 \endverbatim
45
46 \section bindings_binding_java_use How to use Simgrid-java
47
48 To execute the examples you need to add the path where you installed
49 the generated libSG_java library (<build_dir>/lib) and libsimgrid
50 ($SIMGRID_ROOT/lib) into the LD_LIBRARY_PATH.
51
52 Be careful on Mac, this variable is called DYLD_LIBRARY_PATH and not
53 LD_LIBRARY_PATH.
54
55 \verbatim
56 $ export SIMGRID_ROOT="$HOME/Install/simgrid/"
57 $ export SIMGRID_JAVA_ROOT="$HOME/Install/simgrid-java"
58 $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SIMGRID_ROOT/lib:$SIMGRID_JAVA_ROOT/java
59 $ cd examples
60 $ java -cp .:../simgrid.jar basic/BasicTest platform.xml basic/basicDeployment.xml
61 \endverbatim
62
63
64
65
66
67
68
69
70 \section bindings_binding_java_coroutines How to use the coroutines context factory
71
72 There is two main motivations to use the coroutine variant of SimGrid
73 Java bindings: it's about 5 times faster than the default thread-based
74 context factory, and the amount of runnable processes is then only
75 limited by the amount of RAM that you have. The drawbacks are that it
76 requires a specific and rather experimental JVM to run, and that this
77 context factory itself remains a bit experimental so far.
78
79 \subsection  bindings_java_coro_install Getting a mlvm JVM
80
81 You need to get a patched JVM from <a href="http://ssw.jku.at/General/Staff/LS/coro/">here</a>
82 (many thanks to Lukas Stadler for this work!). 
83
84 You can either get a prebuilt binary, or recompile your own JVM. Make
85 sure to get a coro-simple version, as we don't need to serialize nor
86 migrate stacks in SimGrid. You should be able to follow the README.txt
87 that you'll get in the repository, but here is how we did it, just in
88 case. The instructions are given for a debian or Ubuntu box, but I
89 think you should manage to convert it to your system quite easily.
90  
91  -# Install mercurial and some dependencies
92 \verbatim 
93 sudo apt-get install mercurial ksh libfreetype6-dev libcups2-dev libasound2-dev gawk openjdk-7-jdk libxext-dev libxrender-dev libxtst-dev
94 # Grab the forest extension: we need to source-install it
95 hg clone https://bitbucket.org/gxti/hgforest hgforest \endverbatim
96 \endverbatim
97  -# Configure the Forest extension: Edit ~/.hgrc and paste the
98     following lines (beware of changing the /path/to/forest.py):
99 \verbatim
100 [extensions]
101 forest=/path/to/forest.py
102 \endverbatim
103  -# Prepare the source code
104 \verbatim 
105 # create a working directory, and enter it
106 mkdir davinci; cd davinci
107
108 # Grab the sources
109 hg fclone http://hg.openjdk.java.net/hsx/hotspot-comp sources
110 # Grab the patches
111 hg fclone http://hg.openjdk.java.net/mlvm/mlvm patches
112
113 # Link the patch directories into the sources
114 patches/make/link-patch-dirs.sh sources patches
115 # Check that it worked
116 ls -il patches/hotspot/series sources/hotspot/.hg/patches/series
117
118 # Fetches the guards (patches) to apply: 
119 export davinci=$(pwd) guards="buildable testable coro-simple"
120 # (if a1 does not work) edit patches/make/Makefile and add coro-simple to GLOBAL_GUARDS
121 sh patches/make/each-patch-repo.sh hg qselect --reapply $guards '$(sh $davinci/patches/make/current-release.sh)'
122 \endverbatim           
123  -# Compile it all
124 \verbatim
125 # Prepare the sources
126 (cd patches/make; make setup && make force && make && make FORCE_VERSIONS=1)
127
128 unset LD_LIBRARY_PATH
129 export ALT_BOOTDIR=/usr/lib/jvm/java-7-openjdk-amd64/
130 # Check that everything is fine
131 make sanity
132 # Go for it
133 make all
134 \endverbatim
135
136 \subsection  bindings_java_coro_use Using coroutine contexts
137
138 SimGrid Java will automatically switch to the coroutine context
139 factory if your JVM support it, so you will just need to execute your
140 simulation with the correct JVM. The selected context factory gets
141 displayed when enabling the verbose logs of jmsg
142 (--log=jmsg.thres:verbose in the following).
143 \verbatim
144 $ $PATH_TO_COROUTINE_JVM/java -cp .:../simgrid.jar --log=jmsg.thres:verbose basic/BasicTest platform.xml basic/basicDeployment.xml
145 \endverbatim
146
147 Note that you may have to adjust the "coro.stacksPerThread"
148 configuration option to run large simulations. The default is 100 and
149 you want to increase it to run more processes.
150 \verbatim
151 $ $PATH_TO_COROUTINE_JVM/java -Dcoro.stacksPerThread=$STACKS_NUMBER -cp .:../simgrid.jar basic/BasicTest platform.xml basic/basicDeployment.xml
152 \endverbatim
153
154 If you feel limited in the amount of processes you can run, give a try
155 to this command:
156 \verbatim 
157 sysctl -w vm.max_map_count = 131072
158 \endverbatim
159  */