Projet

Général

Profil

Install the platform » Historique » Version 27

Arnaud Sevin, 23/09/2014 14:30

1 14 Arnaud Sevin
{{toc}}
2 1 Damien Gratadour
3 14 Arnaud Sevin
h1. Install the platform without MAGMA
4
5 1 Damien Gratadour
The COMPASS platform is distributed as a single bundle of CArMA and SuTrA libraries and YoGA and its AO extension for Yorick. 
6
7
h2. Hardware requirements
8 2 Damien Gratadour
9 10 Damien Gratadour
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).
10 1 Damien Gratadour
11
h2. Environment requirements
12 2 Damien Gratadour
13 11 Damien Gratadour
The system must be running a 64 bit distribution of Linux or Mac OS with the latest NVIDIA drivers and "CUDA toolkit":https://developer.nvidia.com/cuda-downloads. The installation of the corresponding version of the "CULA tools":http://www.culatools.com/downloads/dense/ is also required. The following installation instructions are valid if the default installation paths have been selected for these components.
14 1 Damien Gratadour
15 5 Damien Gratadour
Additionally, to benefit from the user-oriented features of the platform, Yorick should be installed as well as the latest version of Python and the associated pygtk module. 
16 1 Damien Gratadour
17 3 Damien Gratadour
To install Yorick, download the latest version from the github repository:
18
<pre>
19
git clone https://github.com/dhmunro/yorick.git yorick.git
20
</pre>
21
then cd onto the created directory and install:
22
<pre>
23
./configure && make && make install
24
</pre>
25
once Yorick is locally installed, you will have to add this directory : yorick.git/relocate/bin to your PATH to have an easy access to the yorick executable. You may want to add support for command history by using rlwrap and alias the yorick executable as :
26
<pre>
27 4 Damien Gratadour
alias yorick='rlwrap path_to_yorick_executable/yorick'
28 3 Damien Gratadour
</pre>
29 1 Damien Gratadour
30 3 Damien Gratadour
31 1 Damien Gratadour
h2. Installation process
32
33
First check out the latest version from the svn repository :
34
<pre>
35 3 Damien Gratadour
svn co https://version-lesia.obspm.fr/repos/compass compass
36 1 Damien Gratadour
</pre>
37
then go in the newly created directory and then trunk:
38
<pre>
39
cd compass/trunk
40
</pre>
41
once there, you need to modify system variables in the define_var.sh executable :
42
<pre>
43
emacs define_var.sh
44
</pre>
45
in this file define properly CUDA_ROOT, CULA_ROOT and YoGA path. Note that for the latter, as YoGA is distributed with SUTrA you should just point to the newly created trunk directory. On a Linux system you should normally have:
46
<pre>
47
export CUDA_ROOT=/usr/local/cuda
48
export CULA_ROOT=/usr/local/cula
49
export YOGA_DIR=/home/MyUserName/path2compass/trunk
50
</pre>
51 12 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. Modify the following line:
52 13 Damien Gratadour
<pre>
53 12 Damien Gratadour
export GENCODE="arch=compute_12,code=sm_12"
54
</pre>
55 24 pierre kestener
and change both 12 to your architecture : for instance a Tesla Fermi will have 2.0 computing capabilities so change 12 to 20, a Kepler GPU will have 3.0 or 3.5 (K20) computing capabilities, change 12 to 30 (or 35).
56 1 Damien Gratadour
57
Once this is done, you're ready to compile the whole library. First run define_var.sh to define the system variables that will be used during the compilation process:
58
<pre>
59
./define_var.sh
60
</pre>
61
62
then identify the absolute path to your Yorick executable using: 
63
<pre>
64
which yorick
65
</pre>
66
and run the compilation script:
67
<pre>
68 6 Damien Gratadour
./reinstall absolute_path_to_yorick
69 1 Damien Gratadour
</pre>
70
71 7 Damien Gratadour
If you did not get any error, CArMA, SuTrA and YoGA are now installed on your machine. You can check that everything is working by launching a GUI to test a simulation:
72 1 Damien Gratadour
<pre>
73
yorick -i yoga_ao/ywidgets/widget_ao.i
74
</pre>
75 14 Arnaud Sevin
76
h1. Install the platform with MAGMA
77
78
h2. Why MAGMA ?
79
80
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.
81
82
Unlike CULA, MAGMA propose a dense linear algebra library handling double for free.
83
84
But MAGMA needs a LAPACK and a BLAS implementation. Actually, we try two options : ATLAS BLAS (free, easy to install) and MKL (free, need a registration but more powerful)
85
86 18 Arnaud Sevin
h2. Dependencies : gfortran
87
88
Use your package manager to install dependencies:
89
* on scientific linux : yum install gcc-gfortran libgfortran
90
* on debian : apt-get install gfortran gfortran-multilib
91
92 14 Arnaud Sevin
h2. Configure MAGMA with ATLAS
93
94
h3. Dependencies : blas, lapack, atlas
95
96
Use your package manager to install dependencies:
97
* on scientific linux : yum install blas-devel lapack-devel atlas-devel
98 1 Damien Gratadour
* on debian : apt-get install libblas-dev liblapack-dev libatlas-base-dev libatlas-dev
99 24 pierre kestener
100
The binary packages of ATLAS (and also OpenBLAS / GotoBLAS2) distributed by your Linux distribution (SL, Fedora, Debian,...) are generic packages, which are not optimized for a specific machine.
101
It is strongly advised to recompile ATLAS on your local machine to get best performances.
102 14 Arnaud Sevin
103 26 Arnaud Sevin
debian easy method :
104
sudo apt-get build-dep atlas
105 27 Arnaud Sevin
sudo apt-get install build-essential devscripts lintian diffutils patch patchutils
106 26 Arnaud Sevin
apt-get source atlas
107 1 Damien Gratadour
cd atlas-*
108 27 Arnaud Sevin
fakeroot debian/rules custom
109 26 Arnaud Sevin
cd ..
110
ls libatlas*.deb
111
112
Then, for each of the entries listed by the ls command (there may be a quicker way to do it, using "*"), type:
113
sudo dpkg -i <filename here>.deb
114
115
This should install an optimised build of the version of ATLAS that Ubuntu provides. There's a more recent version, but it doesn't come with the easy "debian/rules" stuff, so this method won't work.
116
117 25 pierre kestener
IMPORTANT NOTE: when building ATLAS, you must ensure that cpu throtling is disabled (if not timing measurement are erroneous, which may lead to an unoptimized build of ATLAS); see page
118
http://math-atlas.sourceforge.net/atlas_install/node5.html
119
120
121 14 Arnaud Sevin
h3. extraction
122
123
MAGMA is available here : http://icl.cs.utk.edu/magma/software/index.html
124
125
extract the tgz file and go into the new directory
126
> ~$ tar xf magma-1.4.1-beta.tar.gz
127
> ~$ cd magma-1.4.1
128
129
h3. configuration
130
131
You have to create your own make.inc :
132
133
* example on a scientific linux : *please verify GPU_TARGET, LAPACKDIR, ATLASDIR, CUDADIR*
134
135
<pre><code class="Makefile">
136
#//////////////////////////////////////////////////////////////////////////////
137
#   -- MAGMA (version 1.4.1) --
138
#      Univ. of Tennessee, Knoxville
139
#      Univ. of California, Berkeley
140
#      Univ. of Colorado, Denver
141
#      November 2013
142
#//////////////////////////////////////////////////////////////////////////////
143
144
# GPU_TARGET specifies for which GPU you want to compile MAGMA:
145
#     "Tesla"  (NVIDIA compute capability 1.x cards)
146
#     "Fermi"  (NVIDIA compute capability 2.x cards)
147
#     "Kepler" (NVIDIA compute capability 3.x cards)
148
# See http://developer.nvidia.com/cuda-gpus
149
150
GPU_TARGET ?= Fermi
151
152
CC        = gcc
153
NVCC      = nvcc
154
FORT      = gfortran
155
156
ARCH      = ar
157
ARCHFLAGS = cr
158
RANLIB    = ranlib
159
160
OPTS      = -fPIC -O3 -DADD_ -fopenmp -DMAGMA_SETAFFINITY
161
F77OPTS   = -fPIC -O3 -DADD_
162
FOPTS     = -fPIC -O3 -DADD_ -x f95-cpp-input
163
NVOPTS    =       -O3 -DADD_ -Xcompiler "-fno-strict-aliasing -fPIC"
164
LDOPTS    = -fPIC -fopenmp
165
166
# Depending on how ATLAS and LAPACK were compiled, you may need one or more of:
167
LIB       = -llapack -lf77blas -latlas -lcblas -lcublas -lcudart -lstdc++ -lm -lgfortran
168
169
# define library directories here or in your environment
170
LAPACKDIR = /usr/lib64
171
ATLASDIR  = /usr/lib64/atlas
172
CUDADIR   = /usr/local/cuda
173
174
LIBDIR    = -L$(LAPACKDIR) \
175
            -L$(ATLASDIR) \
176
            -L$(CUDADIR)/lib64
177
178
INC       = -I$(CUDADIR)/include
179
</code></pre>
180
181 20 Arnaud Sevin
* example on debian : *please verify GPU_TARGET, LAPACKDIR, ATLASDIR, CUDADIR*
182 17 Arnaud Sevin
<pre><code class="Makefile">
183
#//////////////////////////////////////////////////////////////////////////////
184
#   -- MAGMA (version 1.4.1) --
185
#      Univ. of Tennessee, Knoxville
186
#      Univ. of California, Berkeley
187
#      Univ. of Colorado, Denver
188
#      November 2013
189
#//////////////////////////////////////////////////////////////////////////////
190
191
# GPU_TARGET specifies for which GPU you want to compile MAGMA:
192
#     "Tesla"  (NVIDIA compute capability 1.x cards)
193
#     "Fermi"  (NVIDIA compute capability 2.x cards)
194
#     "Kepler" (NVIDIA compute capability 3.x cards)
195
# See http://developer.nvidia.com/cuda-gpus
196
197
GPU_TARGET ?= Fermi
198
199
CC        = gcc
200
NVCC      = nvcc
201
FORT      = gfortran
202
203
ARCH      = ar
204
ARCHFLAGS = cr
205
RANLIB    = ranlib
206
207
OPTS      = -fPIC -O3 -DADD_ -fopenmp -DMAGMA_SETAFFINITY
208
F77OPTS   = -fPIC -O3 -DADD_
209
FOPTS     = -fPIC -O3 -DADD_ -x f95-cpp-input
210
NVOPTS    =       -O3 -DADD_ -Xcompiler "-fno-strict-aliasing -fPIC" 
211
LDOPTS    = -fPIC -fopenmp
212
213
# Depending on how ATLAS and LAPACK were compiled, you may need one or more of:
214
LIB       = -llapack -lf77blas -latlas -lcblas -lcublas -lcudart -lstdc++ -lm -lgfortran
215
216
# define library directories here or in your environment
217
LAPACKDIR = /usr/lib
218
ATLASDIR  = /usr/lib
219
CUDADIR   = /usr/local/cuda
220
221
LIBDIR    = -L$(LAPACKDIR) \
222
            -L$(ATLASDIR) \
223 19 Arnaud Sevin
            -L$(CUDADIR)/lib64 \
224
            -L/usr/lib/x86_64-linux-gnu
225 17 Arnaud Sevin
226
INC       = -I$(CUDADIR)/include
227
</code></pre>
228 14 Arnaud Sevin
229
h2. Configure MAGMA with MKL
230
231
h3. extraction
232
233
To download MKL, you have to create a account here : https://registrationcenter.intel.com/RegCenter/NComForm.aspx?ProductID=1517
234
235
extract l_ccompxe_2013_sp1.1.106.tgz and go into l_ccompxe_2013_sp1.1.106
236
237
install it with ./install_GUI.sh and add IPP stuff to default choices
238
239
h3. configuration
240 1 Damien Gratadour
241 23 Arnaud Sevin
* example on debian : *please verify GPU_TARGET, MKLROOT, CUDADIR*
242 20 Arnaud Sevin
<pre><code class="Makefile">
243
#//////////////////////////////////////////////////////////////////////////////
244
#   -- MAGMA (version 1.4.1-beta2) --
245
#      Univ. of Tennessee, Knoxville
246
#      Univ. of California, Berkeley
247
#      Univ. of Colorado, Denver
248
#      December 2013
249
#//////////////////////////////////////////////////////////////////////////////
250
251
# GPU_TARGET contains one or more of Tesla, Fermi, or Kepler,
252
# to specify for which GPUs you want to compile MAGMA:
253
#     Tesla  - NVIDIA compute capability 1.x cards
254
#     Fermi  - NVIDIA compute capability 2.x cards
255
#     Kepler - NVIDIA compute capability 3.x cards
256
# The default is all, "Tesla Fermi Kepler".
257
# See http://developer.nvidia.com/cuda-gpus
258
#
259
GPU_TARGET ?= Fermi
260
261
CC        = gcc
262
NVCC      = nvcc
263
FORT      = gfortran
264
265
ARCH      = ar
266
ARCHFLAGS = cr
267
RANLIB    = ranlib
268
269
OPTS      = -fPIC -O3 -DADD_ -Wall -fno-strict-aliasing -fopenmp -DMAGMA_WITH_MKL -DMAGMA_SETAFFINITY
270
F77OPTS   = -fPIC -O3 -DADD_ -Wall
271
FOPTS     = -fPIC -O3 -DADD_ -Wall -x f95-cpp-input
272
NVOPTS    =       -O3 -DADD_ -Xcompiler "-fno-strict-aliasing -fPIC"
273
LDOPTS    = -fPIC -fopenmp
274
275
# gcc with MKL 10.3, Intel threads
276
LIB       = -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -lcublas -lcudart -lstdc++ -lm -liomp5 -lgfortran
277
278
# define library directories preferably in your environment, or here.
279
# for MKL run, e.g.: source /opt/intel/composerxe/mkl/bin/mklvars.sh intel64
280
MKLROOT ?= /opt/intel/composerxe/mkl
281
CUDADIR ?= /usr/local/cuda
282
-include make.check-mkl
283
-include make.check-cuda
284
285
LIBDIR    = -L$(MKLROOT)/lib/intel64 \
286
            -L$(CUDADIR)/lib64
287
288
INC       = -I$(CUDADIR)/include -I$(MKLROOT)/include
289
</code></pre>
290 14 Arnaud Sevin
291 22 Arnaud Sevin
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  
292 21 Arnaud Sevin
293 14 Arnaud Sevin
h2. compilation and installation
294
295
h3. compilation
296
297
just compile the shared target (and test if you want)
298
> ~$ make -j 8 shared
299
300
h3. installation
301
302
To install libraries and include files in a given prefix, run:
303
> ~$ make install prefix=/usr/local/magma
304
  
305
The default prefix is /usr/local/magma. You can also set prefix in make.inc.
306
307
h3. tune (not tested)
308
309 15 Arnaud Sevin
For multi-GPU functions, set $MAGMA_NUM_GPUS to set the number of GPUs to use.
310
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.
311
312
h2. Platform installation
313
314
Just just define $MAGMA_PATH and use the standard procedure