@@ -5,7 +5,7 @@ http://www.nest-simulator.org/installation
55Introduction
66============
77
8- NEST is installed with cmake (at least v2.8.12). In the simplest case, the commands
8+ NEST is installed with ` cmake` (at least v2.8.12). In the simplest case, the commands
99
1010 cmake -DCMAKE_INSTALL_PREFIX:PATH=</install/path> </path/to/NEST/src>
1111 make
@@ -14,6 +14,12 @@ NEST is installed with cmake (at least v2.8.12). In the simplest case, the comma
1414should build and install NEST to <install-path>. Detailed installation
1515instructions can be found below.
1616
17+ Choice of CMake Version
18+ =======================
19+
20+ We recommend to use `cmake` v3.4, even though installing NEST with
21+ `cmake` v2.8.12 will in most cases work properly.
22+ For more detailed information please see below: `Python3 Binding (PyNEST)`
1723
1824Choice of compiler
1925==================
@@ -72,11 +78,12 @@ Set default libraries:
7278 -Dwith-readline=[OFF|ON|</path/to/readline>] Find a GNU Readline library. To set
7379 a specific library, set install path.
7480 [default=ON]
75- -Dwith-ltdl=[OFF|ON|</path/to/ltdl>] Find a ltdl library. To set a specific
76- ltdl, set install path.
77- [default=ON]
78- -Dwith-python=[OFF|ON|</path/to/python>] Build PyNEST. To set a specific Python,
79- set install path. [default=ON]
81+ -Dwith-ltdl=[OFF|ON|</path/to/ltdl>] Find an ltdl library. To set a specific
82+ ltdl, set install path. NEST uses the
83+ ltdl for dynamic loading of external
84+ user modules. [default=ON]
85+ -Dwith-python=[OFF|ON|2|3] Build PyNEST. To set a specific Python
86+ version, set 2 or 3. [default=ON]
8087 -Dcythonize-pynest=[OFF|ON] Use Cython to cythonize pynestkernel.pyx.
8188 If OFF, PyNEST has to be build from
8289 a pre-cythonized pynestkernel.pyx.
@@ -85,13 +92,13 @@ Set default libraries:
8592Change compilation behavior:
8693
8794 -Dstatic-libraries=[OFF|ON] Build static executable and libraries. [default=OFF]
88- -Dwith-optimize=[OFF|ON|<list;off ;flags>] Enable user defined optimizations. Separate
95+ -Dwith-optimize=[OFF|ON|<list;of ;flags>] Enable user defined optimizations. Separate
8996 multiple flags by ';'.
9097 [default OFF, when ON, defaults to '-O3']
91- -Dwith-warning=[OFF|ON|<list;off ;flags>] Enable user defined warnings. Separate
98+ -Dwith-warning=[OFF|ON|<list;of ;flags>] Enable user defined warnings. Separate
9299 multiple flags by ';'.
93100 [default ON, when ON, defaults to '-Wall']
94- -Dwith-debug=[OFF|ON|<list;off ;flags>] Enable user defined debug flags. Separate
101+ -Dwith-debug=[OFF|ON|<list;of ;flags>] Enable user defined debug flags. Separate
95102 multiple flags by ';'.
96103 [default OFF, when ON, defaults to '-g']
97104 -Dwith-libraries=<list;of;libraries> Link additional libraries. Give full path.
@@ -115,34 +122,77 @@ Configuring NEST for Distributed Simulation with MPI
115122 -DMPI_C_COMPILER=myC_CompilerWrapper -Dwith-mpi=ON
116123 4. Sorry, you need to fix your MPI installation.
117124
118-
119125Disabling the Python Bindings (PyNEST)
120126======================================
121127
122128Please see also the file pynest/README.md in the documentation directory. If you
123129are impatient, use
124130
125- --Dwith-python=OFF
131+ -Dwith-python=OFF
132+
133+ as an argument to `cmake`.
134+
135+ Python3 Binding (PyNEST)
136+ =========================
137+
138+ To force a Python3-binding in a mixed Python2/3 environment pass
139+
140+ -Dwith-python=3
141+
142+ as an argument to `cmake`.
126143
127- as argument to `cmake`.
144+ `cmake` usually autodetects your Python installation.
145+ In some cases `cmake` might not be able to localize the Python interpreter
146+ and its corresponding libraries correctly. To circumvent such a problem following
147+ `cmake` built-in variables can be set manually and passed to `cmake`:
128148
149+ PYTHON_EXECUTABLE ..... path to the Python interpreter
150+ PYTHON_LIBRARY ........ path to libpython
151+ PYTHON_INCLUDE_DIR .... two include ...
152+ PYTHON_INCLUDE_DIR2 ... directories
153+
154+ e.g.: Please note `-Dwith-python=ON` is the default.
155+ cmake -DCMAKE_INSTALL_PREFIX=</install/path> \
156+ -DPYTHON_EXECUTABLE=/usr/bin/python3 \
157+ -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.4m.so \
158+ -DPYTHON_INCLUDE_DIR=/usr/include/python3.4 \
159+ -DPYTHON_INCLUDE_DIR2=/usr/include/x86_64-linux-gnu/python3.4m \
160+ </path/to/NEST/src>
129161
130162Compiling for BlueGene/Q
131163========================
132164
133165NEST provides a cmake tool-chain file for cross compilation for BlueGene/Q. When
134166configuring NEST use the following `cmake` line:
135167
136- cmake -DCMAKE_TOOLCHAIN_FILE=Platform/BlueGeneQ_XLC
137- -DCMAKE_INSTALL_PREFIX:PATH=</install/path>
138- -Dwith-python=OFF
139- -Dstatic-libraries=ON
168+ cmake -DCMAKE_TOOLCHAIN_FILE=Platform/BlueGeneQ_XLC \
169+ -DCMAKE_INSTALL_PREFIX:PATH=</install/path> \
170+ -Dwith-python=OFF \
171+ -Dstatic-libraries=ON \
140172 </path/to/NEST/src>
141173
142- It is recommended to build statically on larger BlueGene/Q systems. If you need
143- PyNEST on BlueGene/Q, you have to compile dynamically, i.e. `-Dstatic-libraries=OFF`
144- and you have to cythonize the `pynest/pynestkernel.pyx/.pxd`
145- on a machine with Cython installed:
174+ If you compile dynamically, be aware that the BlueGene/Q system might not provide an `ltdl`
175+ library. If you want to dynamically load an external user module, you have to
176+ compile and install an `ltdl` yourself and add `-Dwith-ltdl=<ltdl-install-dir>`
177+ to the `cmake` line. Otherwise add `-Dwith-ltdl=OFF`.
178+
179+ Additionally, the design of `cmake`'s MPI handling has a broken design, which is
180+ brittle in the case of BGQ and certain libraries (flags to use SIONlib, for example).
181+
182+ If you run into that, you must force `cmake` to use the wrappers rather than
183+ it's attempts to extract the proper flags for the underlying compiler
184+ as in:
185+ ```
186+ -DCMAKE_C_COMPILER=/bgsys/drivers/ppcfloor/comm/xl/bin/mpixlc_r
187+ -DCMAKE_CXX_COMPILER=/bgsys/drivers/ppcfloor/comm/xl/bin/mpixlcxx_r
188+ ```
189+
190+ BlueGene/Q and PyNEST
191+ ---------------------
192+
193+ Building PyNEST on BlueGene/Q requires you to compile dynamically, i.e.
194+ `-Dstatic-libraries=OFF`. Further, you have to cythonize the
195+ `pynest/pynestkernel.pyx/.pyx` on a machine with Cython installed:
146196
147197 cythonize pynestkernel.pyx
148198
@@ -151,20 +201,66 @@ BlueGene/Q and point `-Dwith-python=<...>` to a valid python version for cross
151201compilation:
152202
153203 -Dwith-python=/bgsys/tools/Python-2.7/bin/hostpython
154-
155- Eventually, you also have to specify `PYTHON_LIBRARY` and `PYTHON_INCLUDE_DIR`,
156- if the they are not found, e.g.:
157-
158- -DPYTHON_LIBRARY=/bgsys/tools/Python-2.7/lib64/libpython2.7.so.1.0
159- -DPYTHON_INCLUDE_DIR=/bgsys/tools/Python-2.7/include/python2.7
204+ or (much better)
205+ -Dwith-python=/bgsys/local/python3/3.4.2/bin/python3
206+
207+ CMake <3.4 is buggy about finding the matching libraries (for many years).
208+ Thus, you also have to specify `PYTHON_LIBRARY` and `PYTHON_INCLUDE_DIR`
209+ if they are not found OR the incorrect libraries are found, e.g.:
210+
211+ ```
212+ -DPYTHON_LIBRARY=/bgsys/tools/Python-2.7/lib64/libpython2.7.so.1.0
213+ -DPYTHON_INCLUDE_DIR=/bgsys/tools/Python-2.7/include/python2.7
214+ ```
215+ or (much better)
216+ ```
217+ -DPYTHON_LIBRARY=/bgsys/local/python3/3.4.2/lib/libpython3.4m.a
218+ -DPYTHON_INCLUDE_DIR=/bgsys/local/python3/3.4.2/include/python3.4m
219+ ```
220+
221+ A complete `cmake` line for PyNEST could look like this:
222+ ```
223+ module load gsl
224+
225+ cmake -DCMAKE_TOOLCHAIN_FILE=Platform/BlueGeneQ_XLC \
226+ -DCMAKE_INSTALL_PREFIX=</install/path> \
227+ -Dstatic-libraries=OFF \
228+ -Dcythonize-pynest=OFF \
229+ -DCMAKE_C_COMPILER=/bgsys/drivers/ppcfloor/comm/xl/bin/mpixlc_r \
230+ -DCMAKE_CXX_COMPILER=/bgsys/drivers/ppcfloor/comm/xl/bin/mpixlcxx_r \
231+ -Dwith-python=/bgsys/local/python3/3.4.2/bin/python3 \
232+ -DPYTHON_LIBRARY=/bgsys/local/python3/3.4.2/lib/libpython3.4m.a \
233+ -DPYTHON_INCLUDE_DIR=/bgsys/local/python3/3.4.2/include/python3.4m \
234+ -Dwith-ltdl=OFF \
235+ <nest-src>
236+ ```
160237
161238Further, for running PyNEST, make sure all python dependencies are installed and
162239environment variables are set properly:
163-
164- # adds PyNEST to the PYTHONPATH
165- source <nest-install-dir>/bin/nest_vars.sh
166- # makes HOME and PYTHONPATH available for python
167- runjob --exp-env HOME --exp-env PYTHONPATH ... : python script.py
240+ ```
241+ module load python3/3.4.2
242+
243+ # adds PyNEST to the PYTHONPATH
244+ source <nest-install-dir>/bin/nest_vars.sh
245+
246+ # makes HOME and PYTHONPATH available for python
247+ runjob \
248+ --exp-env HOME \
249+ --exp-env PATH \
250+ --exp-env LD_LIBRARY_PATH \
251+ --exp-env PYTHONUNBUFFERED \
252+ --exp-env PYTHONPATH \
253+ ... \
254+ : /bgsys/local/python3/3.4.2/bin/python3.4 script.py
255+ ```
256+
257+ BlueGene/Q and GCC
258+ ------------------
259+
260+ Compiling NEST with GCC (`-DCMAKE_TOOLCHAIN_FILE=Platform/BlueGeneQ_GCC`)
261+ might require you to use a GSL library compiled using GCC, otherwise undefined
262+ symbols break your build. After the GSL is built with GCC and installed in
263+ <gsl-install-dir>, add `-Dwith-gsl=<gsl-install-dir>` to the `cmake` line.
168264
169265Compiling for Fujitsu Sparc64
170266=============================
@@ -189,25 +285,25 @@ On the K Computer:
189285 tar -xzf gsl-2.1.tar.gz
190286 mkdir gsl-2.1.build gsl-2.1.install
191287 cd gsl-2.1.build
192- ../gsl-2.1/configure --prefix=$PWD/../gsl-2.1.install/
193- CC=mpifccpx
194- CXX=mpiFCCpx
195- CFLAGS="-Nnoline"
196- CXXFLAGS="--alternative_tokens -O3 -Kfast,openmp, -Nnoline, -Nquickdbg -NRtrap"
197- --host=sparc64-unknown-linux-gnu
288+ ../gsl-2.1/configure --prefix=$PWD/../gsl-2.1.install/ \
289+ CC=mpifccpx \
290+ CXX=mpiFCCpx \
291+ CFLAGS="-Nnoline" \
292+ CXXFLAGS="--alternative_tokens -O3 -Kfast,openmp, -Nnoline, -Nquickdbg -NRtrap" \
293+ --host=sparc64-unknown-linux-gnu \
198294 --build=x86_64-unknown-linux-gnu
199295 gmake -j4
200296 gmake install
201297
202298 To install NEST, use the following `cmake` line:
203299
204- cmake -DCMAKE_TOOLCHAIN_FILE=Platform/Fujitsu-Sparc64
205- -DCMAKE_INSTALL_PREFIX:PATH=</install/path>
206- -Dwith-gsl=/path/to/gsl-2.1.install/\
207- -Dwith-optimize="-Kfast"
208- -Dwith-defines="-DUSE_PMA"
209- -Dwith-python=OFF
210- -Dwith-warning=OFF
300+ cmake -DCMAKE_TOOLCHAIN_FILE=Platform/Fujitsu-Sparc64 \
301+ -DCMAKE_INSTALL_PREFIX:PATH=</install/path> \
302+ -Dwith-gsl=/path/to/gsl-2.1.install/ \
303+ -Dwith-optimize="-Kfast" \
304+ -Dwith-defines="-DUSE_PMA" \
305+ -Dwith-python=OFF \
306+ -Dwith-warning=OFF \
211307 </path/to/NEST/src>
212308 make -j4
213309 make install
0 commit comments