Projet

Général

Profil

Install the platform » Historique » Version 49

Arnaud Sevin, 13/02/2017 14:29

1 14 Arnaud Sevin
{{toc}}
2 1 Damien Gratadour
3 48 Arnaud Sevin
h1. Install Anaconda with python2
4 1 Damien Gratadour
5 49 Arnaud Sevin
more info: https://www.continuum.io/downloads#linux
6
7 1 Damien Gratadour
h2. Download and installation
8 49 Arnaud Sevin
9 48 Arnaud Sevin
* wget https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh
10
* bash ./Anaconda2-4.2.0-Linux-x86_64.sh
11
* update your .batchrc
12
  add anaconda2/bin into the $PATH
13
14 1 Damien Gratadour
h2. add more packets
15 49 Arnaud Sevin
16 48 Arnaud Sevin
* conda install gcc pyqtgraph
17
18 1 Damien Gratadour
h1. Install MAGMA
19 24 pierre kestener
20 36 Damien Gratadour
h2. Why MAGMA ?
21 1 Damien Gratadour
22
The MAGMA project aims to develop a dense linear algebra library similar to LAPACK but for heterogeneous/hybrid architectures, starting with current "Multicore+GPU" systems.
23
24 26 Arnaud Sevin
Unlike CULA, MAGMA propose a dense linear algebra library handling double for free.
25
26 1 Damien Gratadour
But MAGMA needs a LAPACK and a BLAS implementation. Actually, we try two options : openBLAS (free, easy to install) and MKL (free, need a registration but better optimized on Intel processors)
27
28 28 Arnaud Sevin
h2. Configure MAGMA with openBLAS
29 1 Damien Gratadour
30 28 Arnaud Sevin
h3. Dependencies : openblas (http://www.openblas.net)
31 1 Damien Gratadour
32 28 Arnaud Sevin
First, clone the GIT repository:
33
<pre>
34
git clone https://github.com/xianyi/OpenBLAS.git
35 1 Damien Gratadour
</pre>
36 28 Arnaud Sevin
37
compile it:
38 1 Damien Gratadour
<pre>
39 28 Arnaud Sevin
cd OpenBLAS/
40
make
41 14 Arnaud Sevin
</pre>
42 1 Damien Gratadour
43 28 Arnaud Sevin
install it:
44
<pre>
45 48 Arnaud Sevin
sudo make install PREFIX=$HOME/local/openblas
46 28 Arnaud Sevin
</pre>
47
48 1 Damien Gratadour
add to you .bashrc:
49
<pre>
50 48 Arnaud Sevin
export OPENBLAS_ROOT=$HOME/local/openblas
51 28 Arnaud Sevin
</pre>
52 1 Damien Gratadour
53
h3. extraction
54 14 Arnaud Sevin
55 1 Damien Gratadour
MAGMA is available here : http://icl.cs.utk.edu/magma/software/index.html
56 14 Arnaud Sevin
57
extract the tgz file and go into the new directory
58 48 Arnaud Sevin
> ~$ tar xf magma-2.1.0.tar.gz
59
> ~$ cd magma-2.1.0
60 14 Arnaud Sevin
61
h3. configuration
62 1 Damien Gratadour
63 28 Arnaud Sevin
You have to create your own make.inc based on make.inc.openblas:
64 1 Damien Gratadour
65 37 Damien Gratadour
example : *please verify GPU_TARGET, OPENBLASDIR, CUDADIR*
66 1 Damien Gratadour
67
<pre><code class="Makefile">
68
#//////////////////////////////////////////////////////////////////////////////
69 28 Arnaud Sevin
#   -- MAGMA (version 1.7.0) --
70 1 Damien Gratadour
#      Univ. of Tennessee, Knoxville
71
#      Univ. of California, Berkeley
72
#      Univ. of Colorado, Denver
73 28 Arnaud Sevin
#      @date September 2015
74 1 Damien Gratadour
#//////////////////////////////////////////////////////////////////////////////
75
76 28 Arnaud Sevin
# GPU_TARGET contains one or more of Tesla, Fermi, or Kepler,
77
# to specify for which GPUs you want to compile MAGMA:
78
#     Tesla  - NVIDIA compute capability 1.x cards (no longer supported in CUDA 6.5)
79
#     Fermi  - NVIDIA compute capability 2.x cards
80
#     Kepler - NVIDIA compute capability 3.x cards
81
# The default is "Fermi Kepler".
82 1 Damien Gratadour
# See http://developer.nvidia.com/cuda-gpus
83 28 Arnaud Sevin
#
84
GPU_TARGET ?= Kepler
85 1 Damien Gratadour
86 28 Arnaud Sevin
# --------------------
87
# programs
88 1 Damien Gratadour
89
CC        = gcc
90 28 Arnaud Sevin
CXX       = g++
91 1 Damien Gratadour
NVCC      = nvcc
92
FORT      = gfortran
93
94
ARCH      = ar
95
ARCHFLAGS = cr
96
RANLIB    = ranlib
97
98
99 28 Arnaud Sevin
# --------------------
100
# flags
101 1 Damien Gratadour
102 28 Arnaud Sevin
# Use -fPIC to make shared (.so) and static (.a) library;
103
# can be commented out if making only static library.
104
FPIC      = -fPIC
105 14 Arnaud Sevin
106 28 Arnaud Sevin
CFLAGS    = -O3 $(FPIC) -DADD_ -Wall -fopenmp 
107
FFLAGS    = -O3 $(FPIC) -DADD_ -Wall -Wno-unused-dummy-argument
108
F90FLAGS  = -O3 $(FPIC) -DADD_ -Wall -Wno-unused-dummy-argument -x f95-cpp-input
109
NVCCFLAGS = -O3         -DADD_       -Xcompiler "$(FPIC)"
110 14 Arnaud Sevin
LDFLAGS   =     $(FPIC)              -fopenmp
111 1 Damien Gratadour
112 28 Arnaud Sevin
113
# --------------------
114 17 Arnaud Sevin
# libraries
115 1 Damien Gratadour
116 28 Arnaud Sevin
# gcc with OpenBLAS (includes LAPACK)
117
LIB       = -lopenblas
118 17 Arnaud Sevin
119 28 Arnaud Sevin
LIB      += -lcublas -lcudart
120 17 Arnaud Sevin
121
122 28 Arnaud Sevin
# --------------------
123
# directories
124 17 Arnaud Sevin
125 28 Arnaud Sevin
# define library directories preferably in your environment, or here.
126 48 Arnaud Sevin
OPENBLASDIR = $(HOME)/local/openblas
127 28 Arnaud Sevin
CUDADIR = /usr/local/cuda
128
-include make.check-openblas
129
-include make.check-cuda
130 17 Arnaud Sevin
131 28 Arnaud Sevin
LIBDIR    = -L$(CUDADIR)/lib64 \
132
            -L$(OPENBLASDIR)/lib
133 17 Arnaud Sevin
134
INC       = -I$(CUDADIR)/include
135
</code></pre>
136
137
h2. Configure MAGMA with MKL
138
139
h3. extraction
140
141
To download MKL, you have to create a account here : https://registrationcenter.intel.com/RegCenter/NComForm.aspx?ProductID=1517
142
143
extract l_ccompxe_2013_sp1.1.106.tgz and go into l_ccompxe_2013_sp1.1.106
144
145
install it with ./install_GUI.sh and add IPP stuff to default choices
146
147
h3. configuration
148
149 28 Arnaud Sevin
You have to create your own make.inc based on make.inc.mkl-gcc-ilp64:
150
151
example: *please verify GPU_TARGET, MKLROOT, CUDADIR*
152 17 Arnaud Sevin
<pre><code class="Makefile">
153
#//////////////////////////////////////////////////////////////////////////////
154 28 Arnaud Sevin
#   -- MAGMA (version 1.7.0) --
155 19 Arnaud Sevin
#      Univ. of Tennessee, Knoxville
156
#      Univ. of California, Berkeley
157 17 Arnaud Sevin
#      Univ. of Colorado, Denver
158 28 Arnaud Sevin
#      @date September 2015
159 17 Arnaud Sevin
#//////////////////////////////////////////////////////////////////////////////
160 14 Arnaud Sevin
161
# GPU_TARGET contains one or more of Tesla, Fermi, or Kepler,
162
# to specify for which GPUs you want to compile MAGMA:
163 28 Arnaud Sevin
#     Tesla  - NVIDIA compute capability 1.x cards (no longer supported in CUDA 6.5)
164 14 Arnaud Sevin
#     Fermi  - NVIDIA compute capability 2.x cards
165
#     Kepler - NVIDIA compute capability 3.x cards
166 28 Arnaud Sevin
# The default is "Fermi Kepler".
167 14 Arnaud Sevin
# See http://developer.nvidia.com/cuda-gpus
168
#
169 28 Arnaud Sevin
#GPU_TARGET ?= Fermi Kepler
170 14 Arnaud Sevin
171 28 Arnaud Sevin
# --------------------
172
# programs
173
174 20 Arnaud Sevin
CC        = gcc
175 28 Arnaud Sevin
CXX       = g++
176 20 Arnaud Sevin
NVCC      = nvcc
177
FORT      = gfortran
178
179
ARCH      = ar
180
ARCHFLAGS = cr
181 1 Damien Gratadour
RANLIB    = ranlib
182 20 Arnaud Sevin
183 1 Damien Gratadour
184
# --------------------
185
# flags
186
187
# Use -fPIC to make shared (.so) and static (.a) library;
188
# can be commented out if making only static library.
189
FPIC      = -fPIC
190
191
CFLAGS    = -O3 $(FPIC) -DADD_ -Wall -Wshadow -fopenmp -DMAGMA_WITH_MKL
192
FFLAGS    = -O3 $(FPIC) -DADD_ -Wall -Wno-unused-dummy-argument
193
F90FLAGS  = -O3 $(FPIC) -DADD_ -Wall -Wno-unused-dummy-argument -x f95-cpp-input
194
NVCCFLAGS = -O3         -DADD_       -Xcompiler "$(FPIC) -Wall -Wno-unused-function"
195
LDFLAGS   =     $(FPIC)              -fopenmp
196
197
# Defining MAGMA_ILP64 or MKL_ILP64 changes magma_int_t to int64_t in include/magma_types.h
198
CFLAGS    += -DMKL_ILP64
199
FFLAGS    += -fdefault-integer-8
200
F90FLAGS  += -fdefault-integer-8
201
NVCCFLAGS += -DMKL_ILP64
202
203
# Options to do extra checks for non-standard things like variable length arrays;
204
# it is safe to disable all these
205
CFLAGS   += -pedantic -Wno-long-long
206
#CFLAGS   += -Werror  # uncomment to ensure all warnings are dealt with
207
CXXFLAGS := $(CFLAGS) -std=c++98
208
CFLAGS   += -std=c99
209
210
211
# --------------------
212
# libraries
213
214
# IMPORTANT: this link line is for 64-bit int !!!!
215
# For regular 64-bit builds using 64-bit pointers and 32-bit int,
216
# use the lp64 library, not the ilp64 library. See make.inc.mkl-gcc or make.inc.mkl-icc.
217
# see MKL Link Advisor at http://software.intel.com/sites/products/mkl/
218
# gcc with MKL 10.3, Intel threads, 64-bit int
219
# note -DMAGMA_ILP64 or -DMKL_ILP64, and -fdefault-integer-8 in FFLAGS above
220
LIB       = -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -lpthread -lstdc++ -lm -liomp5 -lgfortran
221
222
LIB      += -lcublas -lcudart
223
224
225
# --------------------
226
# directories
227
228
# define library directories preferably in your environment, or here.
229
# for MKL run, e.g.: source /opt/intel/composerxe/mkl/bin/mklvars.sh intel64
230
#MKLROOT ?= /opt/intel/composerxe/mkl
231
#CUDADIR ?= /usr/local/cuda
232
-include make.check-mkl
233
-include make.check-cuda
234
235
LIBDIR    = -L$(CUDADIR)/lib64 \
236
            -L$(MKLROOT)/lib/intel64
237
238
INC       = -I$(CUDADIR)/include \
239
            -I$(MKLROOT)/include
240
</code></pre>
241
242
In this example, I use gcc but with MKL, you can use icc instead of gcc. In this case, you have to compile yorick with icc. For this, you have to change the CC flag in Make.cfg  
243
244
h2. compilation and installation
245
246
h3. compilation
247
248
just compile the shared target (and test if you want)
249
> ~$ make -j 8 shared sparse
250
251
h3. installation
252
253
To install libraries and include files in a given prefix, run:
254 48 Arnaud Sevin
> ~$ make install prefix=$HOME/local/magma
255 1 Damien Gratadour
  
256
The default prefix is /usr/local/magma. You can also set prefix in make.inc.
257
258 38 Damien Gratadour
h3. tuning (not tested)
259 1 Damien Gratadour
260 38 Damien Gratadour
For multi-GPU functions, set $MAGMA_NUM_GPUS to set the number of GPUs to use.
261 29 Arnaud Sevin
For multi-core BLAS libraries, set $OMP_NUM_THREADS or $MKL_NUM_THREADS or $VECLIB_MAXIMUM_THREADS to set the number of CPU threads, depending on your BLAS library.
262
263
h1. Install the platform
264
265
The COMPASS platform is distributed as a single bundle of CArMA and SuTrA C++ / Cuda libraries and their Python extensions NAGA & SHESHA. 
266
267
h2. Hardware requirements
268
269
The system must contain at least an x86 CPU and a CUDA capable GPU. list of compatible GPUs can be found here http://www.nvidia.com/object/cuda_gpus.html. Specific requirements apply to clusters (to be updated).
270 41 Arnaud Sevin
271 29 Arnaud Sevin
h2. Environment requirements
272
273
The system must be running a 64 bit distribution of Linux with the latest NVIDIA drivers and "CUDA toolkit":https://developer.nvidia.com/cuda-downloads. The following installation instructions are valid if the default installation paths have been selected for these components.
274
275 47 Arnaud Sevin
Additionally, to benefit from the user-oriented features of the platform, Anaconda2 should be installed (https://www.continuum.io/downloads#_unix).
276 29 Arnaud Sevin
In the last versions of compass (r608+), Yorick is no more supported.
277
278
h2. Installation process
279
280
First check out the latest version from the svn repository :
281
<pre>
282 39 Arnaud Sevin
svn co https://version-lesia.obspm.fr/repos/compass/trunk compass
283 1 Damien Gratadour
</pre>
284 29 Arnaud Sevin
then go in the newly created directory and then trunk:
285
<pre>
286 39 Arnaud Sevin
cd compass
287 29 Arnaud Sevin
</pre>
288
once there, you need to modify system variables in our .bashrc :
289
<pre>
290
# CUDA default definitions
291
export CUDA_ROOT=$CUDA_ROOT #/usr/local/cuda
292
export CUDA_INC_PATH=$CUDA_ROOT/include
293
export CUDA_LIB_PATH=$CUDA_ROOT/lib
294
export CUDA_LIB_PATH_64=$CUDA_ROOT/lib64
295
export PATH=$CUDA_ROOT/bin:$PATH
296
</pre>
297 1 Damien Gratadour
in this file, you also have to indicate the proper architecture of your GPU so as the compiler will generate the appropriate code.
298 29 Arnaud Sevin
<pre>
299 33 Arnaud Sevin
export GENCODE="arch=compute_52,code=sm_52"
300 29 Arnaud Sevin
</pre>
301 48 Arnaud Sevin
and change both 52 to your architecture : for instance a Tesla Fermi will have 2.0 computing capabilities so change 52 to 20, a Kepler GPU will have 3.0 or 3.5 (K20) computing capabilities, change 52 to 30 (or 35), a Maxwell GPU have 5.2 (M6000), a Pascal have 6.0 (P100). 
302 43 Arnaud Sevin
(more informations here: https://developer.nvidia.com/cuda-gpus)
303 29 Arnaud Sevin
304
If you are using CULA, you have to specify it:
305
<pre>
306
# CULA default definitions
307
export CULA_ROOT= /usr/local/cula
308
export CULA_INC_PATH= $CULA_ROOT/include
309
export CULA_LIB_PATH= $CULA_ROOT/lib
310
export CULA_LIB_PATH_64= $CULA_ROOT/lib64
311
</pre>
312
313
If you are using MAGMA, you have to specify it:
314
<pre>
315
# MAGMA definitions (uncomment this line if MAGMA is installed)
316 48 Arnaud Sevin
export MAGMA_ROOT=$HOME/local/magma
317 29 Arnaud Sevin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MAGMA_ROOT/lib
318
export PKG_CONFIG_PATH=$MAGMA_ROOT/lib/pkgconfig
319
</pre>
320
321
Last variables to define:
322
<pre>
323
export COMPASS_ROOT=/path/to/compass/trunk
324
export NAGA_ROOT=$COMPASS_ROOT/naga
325
export SHESHA_ROOT=$COMPASS_ROOT/shesha
326
export LD_LIBRARY_PATH=$COMPASS_ROOT/libcarma:$COMPASS_ROOT/libsutra:$CUDA_LIB_PATH_64:$CUDA_LIB_PATH:$CULA_LIB_PATH_64:$CULA_LIB_PATH:$LD_LIBRARY_PATH
327
</pre>
328
329
Once this is done, you're ready to compile the whole library:
330
<pre>
331 44 Arnaud Sevin
make clean all
332 29 Arnaud Sevin
</pre>
333
334
If you did not get any error, CArMA, SuTrA, NAGA and SHESHA are now installed on your machine. You can check that everything is working by launching a GUI to test a simulation:
335
<pre>
336 45 Arnaud Sevin
ipython -i $SHESHA_ROOT/widgets/widget_ao.py
337 29 Arnaud Sevin
</pre>