Projet

Général

Profil

Install the platform » Historique » Version 62

Arnaud Sevin, 07/06/2018 15:53

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