-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.html
447 lines (434 loc) · 31 KB
/
install.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8" />
<title>Get MagIC and run it — Magic 6.3 documentation</title>
<link rel="stylesheet" href="_static/magic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Magic 6.3 documentation"
href="_static/opensearch.xml"/>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Formulation of the (magneto)-hydrodynamics problem" href="equations.html" />
<link rel="prev" title="Introduction" href="foreword.html" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,700'
rel='stylesheet' type='text/css' />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script src="galleria/galleria-1.4.2.min.js"></script>
<style type="text/css">
table.right { float: right; margin-left: 20px; }
table.right td { border: 1px solid #ccc; }
</style>
<script type="text/javascript">
// intelligent scrolling of the sidebar content
$(window).scroll(function() {
var sb = $('.sphinxsidebarwrapper');
var win = $(window);
var sbh = sb.height();
var offset = $('.sphinxsidebar').position()['top'];
var wintop = win.scrollTop();
var winbot = wintop + win.innerHeight();
var curtop = sb.position()['top'];
var curbot = curtop + sbh;
// does sidebar fit in window?
if (sbh < win.innerHeight()) {
// yes: easy case -- always keep at the top
sb.css('top', $u.min([$u.max([0, wintop - offset - 10]),
$(document).height() - sbh - 200]));
} else {
// no: only scroll if top/bottom edge of sidebar is at
// top/bottom edge of window
if (curtop > wintop && curbot > winbot) {
sb.css('top', $u.max([wintop - offset - 10, 0]));
} else if (curtop < wintop && curbot < winbot) {
sb.css('top', $u.min([winbot - sbh - offset - 20,
$(document).height() - sbh - 200]));
}
}
});
</script>
</head><body>
<div class="pageheader">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="#">Get it/Run it</a></li>
<li><a href="contribute.html">Contribute!</a></li>
<li><a href="numerics.html">Numerical methods</a></li>
<li><a href="contents.html">Contents</a></li>
</ul>
<div>
<a href="index.html">
<img src="_static/logo.png" alt="magic" height="120px" width="192px"/>
</a>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="f-modindex.html" title="Fortran Module Index"
>fortran modules</a> |</li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="equations.html" title="Formulation of the (magneto)-hydrodynamics problem"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="foreword.html" title="Introduction"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="contents.html">Magic 6.3 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="get-magic-and-run-it">
<span id="secquickstart"></span><h1>Get MagIC and run it<a class="headerlink" href="#get-magic-and-run-it" title="Permalink to this headline">¶</a></h1>
<div class="section" id="download-the-code">
<h2>Download the code<a class="headerlink" href="#download-the-code" title="Permalink to this headline">¶</a></h2>
<p>You can download a snapshot of the code from the <a class="reference external" href="https://git-scm.com/">Git</a> repository using</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ git clone https://github.com/magic-sph/magic.git
</pre></div>
</div>
<p>In case you already have an account on <a class="reference external" href="https://github.com/">github.com</a> and uploaded a public SSH key on it, you could then rather use SSH:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ git clone ssh://[email protected]/magic-sph/magic.git
</pre></div>
</div>
</div>
<div class="section" id="setting-up-the-environment-variables">
<h2>Setting up the environment variables<a class="headerlink" href="#setting-up-the-environment-variables" title="Permalink to this headline">¶</a></h2>
<p>Although not mandatory, it is strongly recommended to correctly source the
environment variables of the MagIC code. It will ensure a smoother usage of the
post-processing <a class="reference internal" href="postProc.html#secpythonpostproc"><span class="std std-ref">python classes</span></a> and allow to run the
<a class="reference internal" href="contribute.html#secautotest"><span class="std std-ref">auto-test suite</span></a>. To do that, just go to the root directory of
the MagIC code (<code class="docutils literal notranslate"><span class="pre">magic</span></code>) and source <code class="docutils literal notranslate"><span class="pre">sourceme</span></code> file that corresponds to your
<code class="docutils literal notranslate"><span class="pre">$SHELL</span></code> environment variable.</p>
<p>In case you use <a class="reference external" href="http://tiswww.case.edu/php/chet/bash/bashtop.html">bash</a>,
<a class="reference external" href="http://www.kornshell.com/">ksh</a> or <a class="reference external" href="http://www.zsh.org/">zsh</a>, just use:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">source</span> sourceme.sh
</pre></div>
</div>
<p>In case you use <a class="reference external" href="http://www.tcsh.org/Home">csh</a> or <a class="reference external" href="http://www.tcsh.org/Home">tcsh</a>,
rather use</p>
<div class="highlight-csh notranslate"><div class="highlight"><pre><span></span><span class="nv">$ </span><span class="nb">source </span>sourceme.csh
</pre></div>
</div>
<p>You can make sure that the environment variables have been correctly sourced by typing:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">echo</span> <span class="nv">$MAGIC_HOME</span>
$ <span class="nb">echo</span> <span class="nv">$PYTHONPATH</span>
</pre></div>
</div>
<p>If you don’t want to <code class="docutils literal notranslate"><span class="pre">source</span> <span class="pre">sourceme.[c]sh</span></code> on each session, you can add the following
into your <code class="docutils literal notranslate"><span class="pre">.bash_profile</span></code> (or <code class="docutils literal notranslate"><span class="pre">.profile</span></code> or <code class="docutils literal notranslate"><span class="pre">.zprofile</span></code> or <code class="docutils literal notranslate"><span class="pre">.cshrc</span></code>):</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">source</span> whereverYouCheckedOut/magic/sourceme.sh
</pre></div>
</div>
<p>To get started, you then need to compile the code.</p>
</div>
<div class="section" id="install-shtns-recommended">
<h2>Install SHTns (<strong>recommended</strong>)<a class="headerlink" href="#install-shtns-recommended" title="Permalink to this headline">¶</a></h2>
<p><a class="reference external" href="https://bitbucket.org/nschaeff/shtns">SHTns</a> is a an open-source library for the Spherical Harmonics transforms. It is significantly faster than the native transforms implemented in MagIC, and it is hence <strong>recommended</strong> (though not mandatory) to install it. To install the library, first define a C compiler</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">export</span> <span class="nv">CC</span><span class="o">=</span> gcc
</pre></div>
</div>
<p>or</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">export</span> <span class="nv">CC</span><span class="o">=</span> icc
</pre></div>
</div>
<p>Then make sure a FFT library such FFTW or the MKL is installed on the target machine. Then make use of the install script</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> <span class="nv">$MAGIC_HOME</span>/bin
./install-shtns.sh
</pre></div>
</div>
<p>or install it manually after downloading and extracting the latest version <a class="reference external" href="https://bitbucket.org/nschaeff/shtns/downloads/">here</a></p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./configure --enable-openmp --enable-ishioka --enable-magic-layout --prefix<span class="o">=</span><span class="nv">$HOME</span>/local
</pre></div>
</div>
<p>if FFTW is used or</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./configure --enable-openmp --enable-ishioka --enable-magic-layout --prefix<span class="o">=</span><span class="nv">$HOME</span>/local --enable-mkl
</pre></div>
</div>
<p>if the MKL is used. Possible additional options may be required depending on the machine (check the website). Then compile and install the library</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>make
make install
</pre></div>
</div>
</div>
<div class="section" id="setting-up-compiler-options-and-compiling">
<h2>Setting up compiler options and compiling<a class="headerlink" href="#setting-up-compiler-options-and-compiling" title="Permalink to this headline">¶</a></h2>
<p>The <strong>recommended way of compiling MagIC</strong> is to use the build system <a class="reference external" href="https://cmake.org/">CMake</a> , if available on your platform. Otherwise, a backup
solution is provided via the manual edition of a <code class="docutils literal notranslate"><span class="pre">Makefile</span></code>.</p>
<div class="section" id="generic-compiling-options">
<h3>Generic compiling options<a class="headerlink" href="#generic-compiling-options" title="Permalink to this headline">¶</a></h3>
<p>For both build systems (CMake or make), several build options can be toggled using
the following available options:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">ARCH</span></code> Set it to ‘64’ for 64 bit architecture or to ‘32’ for 32 bit architecture</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">PRECISION</span></code> Set it to ‘dble’ for double-precision calculations or to ‘sngl’ for single-precision calculations</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">OUT_PREC</span></code> Set it to ‘dble’ for double-precision in binary outputs or to ‘sngl’ for single precision</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">USE_MPI</span></code> Set to <code class="docutils literal notranslate"><span class="pre">yes</span></code> to use MPI, set it to <code class="docutils literal notranslate"><span class="pre">no</span></code> if you want a serial version of the code .</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">USE_OMP</span></code> Set it to <code class="docutils literal notranslate"><span class="pre">yes</span></code> to use the hybrid version of the code, or to <code class="docutils literal notranslate"><span class="pre">no</span></code> for a pure MPI (or serial) version.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">USE_PRECOND</span></code> Set to <code class="docutils literal notranslate"><span class="pre">yes</span></code> to perform some pre-conditioning of the matrices.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">USE_FFTLIB</span></code> This option lets you select the library you want to use for Fast Fourier Transforms. This can be set to ‘JW’, ‘FFTW’ or ‘MKL’. ‘JW’ refers to the built-in library by <strong>J</strong> ohannes <strong>W</strong> icht, FFTW refers to the <a class="reference external" href="http://www.fftw.org/">Fastest Fourier Transform in the West</a>, while ‘MKL’ refers to the <a class="reference external" href="https://software.intel.com/en-us/intel-mkl">Intel Math Kernel Library</a>. Use ‘JW’ if you don’t have Intel MKL installed.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">USE_DCTLIB</span></code> This option lets you select the library you want to use for Discrete Cosine Transforms. This can be set to ‘JW’, ‘FFTW’ or ‘MKL’.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">USE_LAPACKLIB</span></code> This option allows you to select the library you want to use for LU factorisation. This can be set to ‘JW’, ‘MKL’, ‘LIBFLAME’ or ‘LAPACK’. ‘LIBFLAME’ refers to the AMD dense matrix solvers <a class="reference external" href="https://github.com/amd/libflame">libflame</a>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">USE_SHTNS</span></code> Set to <code class="docutils literal notranslate"><span class="pre">yes</span></code> to use <a class="reference external" href="https://bitbucket.org/nschaeff/shtns">SHTns</a> library for spherical harmonics transforms. The helper script <code class="docutils literal notranslate"><span class="pre">install-shtns.sh</span></code> is available in the <code class="docutils literal notranslate"><span class="pre">bin</span></code> directory to help installing SHTns.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CMAKE_BUILD_TYPE</span></code> Set to <code class="docutils literal notranslate"><span class="pre">Debug</span></code> to enable the full debug flags.</p></li>
</ul>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>MagIC cannot run with openMP alone, therefore a configuration of the form
<code class="docutils literal notranslate"><span class="pre">USE_MPI=no</span></code>, <code class="docutils literal notranslate"><span class="pre">USE_OMP=yes</span></code> will be overwritten to force <code class="docutils literal notranslate"><span class="pre">USE_OMP=no</span></code></p>
</div>
</div>
<div class="section" id="using-cmake-recommended">
<h3>Using <code class="docutils literal notranslate"><span class="pre">CMake</span></code> (recommended)<a class="headerlink" href="#using-cmake-recommended" title="Permalink to this headline">¶</a></h3>
<p><a class="reference external" href="https://cmake.org/">CMake</a> is a powerful tool that can automatically detects
and finds the best appropriate configuration for your platform. To use it, you
just need to create a directory where you want to build the sources. For instance:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ mkdir <span class="nv">$MAGIC_HOME</span>/build
$ <span class="nb">cd</span> <span class="nv">$MAGIC_HOME</span>/build
</pre></div>
</div>
<p>In a second step, you might want to specify your C and Fortran compilers (in
case you skip this step, <a class="reference external" href="https://cmake.org/">CMake</a> will look for compilers
for you but it might pick up another compiler as the one you might have wanted).
For instance, in case you want to use the <a class="reference external" href="https://software.intel.com/en-us/intel-compilers">Intel compilers</a>, you can export the following
environment variables</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">export</span> <span class="nv">FC</span><span class="o">=</span>mpiifort
$ <span class="nb">export</span> <span class="nv">CC</span><span class="o">=</span>icc
</pre></div>
</div>
<p>for bash/ksh/zsh users and</p>
<div class="highlight-tcsh notranslate"><div class="highlight"><pre><span></span><span class="nv">$ </span><span class="nb">setenv </span><span class="nv">FC</span><span class="o">=</span>mpiifort
<span class="nv">$ </span><span class="nb">setenv </span><span class="nv">CC</span><span class="o">=</span>mpiicc
</pre></div>
</div>
<p>for csh/tcsh users. At this stage you should be ready to build the code. If you simply use:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ cmake .. -DUSE_SHTNS<span class="o">=</span>yes
</pre></div>
</div>
<p><a class="reference external" href="https://cmake.org/">CMake</a> will try to use the best options available on your
machine (for instance it will try to locate and link the <a class="reference external" href="https://software.intel.com/en-us/intel-mkl">Intel Math Kernel Library</a>). Otherwise you can
pass the aforementioned available options to <a class="reference external" href="https://cmake.org/">CMake</a> using the
generic form <cite>-DOPTION=value</cite>. For instance, in case you want to make use of
the built-in libraries of MagIC and want to disable OpenMP, simply use</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ cmake .. -DUSE_OMP<span class="o">=</span>no -DUSE_FFTLIB<span class="o">=</span>JW -DUSE_LAPACKLIB<span class="o">=</span>JW
</pre></div>
</div>
<p>Once you’re happy with your configuration, just compile the code:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ make -j
</pre></div>
</div>
<p>The executable <code class="docutils literal notranslate"><span class="pre">magic.exe</span></code> should have been produced in the local directory.</p>
<p>If you want to recompile the code from scratch do</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ make clean
</pre></div>
</div>
<p>to remove all the files generated by the compiler.</p>
<p>Once the executable is built, you are now ready to run your first production run!</p>
</div>
<div class="section" id="using-make-backup-solution">
<h3>Using <code class="docutils literal notranslate"><span class="pre">make</span></code> (backup solution)<a class="headerlink" href="#using-make-backup-solution" title="Permalink to this headline">¶</a></h3>
<p>In case <a class="reference external" href="https://cmake.org/">CMake</a> is not available on your platform, it is
still possible to compile the code directly. Go to the directory where the
source files of MagIC are contained</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">cd</span> <span class="nv">$MAGIC_HOME</span>/src
</pre></div>
</div>
<p><strong>Select compiler</strong></p>
<p>Edit the file named <code class="docutils literal notranslate"><span class="pre">Makefile</span></code> using your favourite editor and set a suitable
compiler for your platform using the variable: <code class="docutils literal notranslate"><span class="pre">COMPILER</span> <span class="pre">=</span> <span class="pre">value</span></code>. The possible
options are <code class="docutils literal notranslate"><span class="pre">intel</span></code>, <code class="docutils literal notranslate"><span class="pre">gnu</span></code> or <code class="docutils literal notranslate"><span class="pre">portland</span></code> compilers.</p>
<p><em>List of default compilers</em></p>
<blockquote>
<div><table class="docutils align-default">
<colgroup>
<col style="width: 34%" />
<col style="width: 30%" />
<col style="width: 36%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p>Compiler Option</p></td>
<td><p>Normal</p></td>
<td><p>With MPI</p></td>
</tr>
<tr class="row-even"><td><p>intel</p></td>
<td><p>ifort, icc</p></td>
<td><p>mpiifort, mpiicc</p></td>
</tr>
<tr class="row-odd"><td><p>gnu</p></td>
<td><p>gfortran, gcc</p></td>
<td><p>mpif90, mpicc</p></td>
</tr>
<tr class="row-even"><td><p>portland</p></td>
<td><p>pgf95, pgcc</p></td>
<td><p>mpif90, mpicc</p></td>
</tr>
</tbody>
</table>
</div></blockquote>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>In case you want to use intel but <code class="docutils literal notranslate"><span class="pre">mpiifort</span></code> and <code class="docutils literal notranslate"><span class="pre">mpiicc</span></code> are not available,
you may also need to adapt the variables <code class="docutils literal notranslate"><span class="pre">COMP_MPFC</span></code> and <code class="docutils literal notranslate"><span class="pre">COMP_MPCC</span></code>.</p>
</div>
<p><strong>Select compiling options</strong></p>
<p>You can also modify the different compiling options by editing the values of
the various parameters defined in the first lines of the <code class="docutils literal notranslate"><span class="pre">Makefile</span></code>.
For instance, in case you want to make use of
the built-in libraries and want to disable OpenMP, just define</p>
<div class="highlight-make notranslate"><div class="highlight"><pre><span></span><span class="nv">USE_OMP</span><span class="o">=</span>no
<span class="nv">USE_FFTLIB</span><span class="o">=</span>JW
<span class="nv">USE_LAPACKLIB</span><span class="o">=</span>JW
</pre></div>
</div>
<p><strong>MPI_INCPATH</strong></p>
<p>This variable sets the path for your MPI header file <code class="docutils literal notranslate"><span class="pre">mpif.h</span></code>. This is in
general useless if you already use the MPI wrappers such as <code class="docutils literal notranslate"><span class="pre">mpiifort</span></code> or
<code class="docutils literal notranslate"><span class="pre">mpif90</span></code> to compile the code. It might be however required to define this
path for some compiler configurations: <code class="docutils literal notranslate"><span class="pre">MPI_INCPATH</span></code> is usually
<code class="docutils literal notranslate"><span class="pre">/usr/include</span></code> or <code class="docutils literal notranslate"><span class="pre">/usr/include/mpi</span></code> and should be found by the
<code class="docutils literal notranslate"><span class="pre">Makefile</span></code> automatically thanks to the command <code class="docutils literal notranslate"><span class="pre">mpif90</span> <span class="pre">--showme:incdirs</span></code>.
In case this doesn’t work, you may need to specify this variable manually in
the <code class="docutils literal notranslate"><span class="pre">Makefile</span></code>. On supercomputing clusters, this variable is in general not
used.</p>
<p><strong>Other compilers</strong></p>
<p>If your available compilers are different from the options provided in the
<code class="docutils literal notranslate"><span class="pre">Makefile</span></code>, then just create a new profile for your desired compiler
by changing the options <code class="docutils literal notranslate"><span class="pre">COMP_FC</span></code> and
<code class="docutils literal notranslate"><span class="pre">COMP_CC</span></code> for serial fortran and C compilers and <code class="docutils literal notranslate"><span class="pre">COMP_MPFC</span></code> and
<code class="docutils literal notranslate"><span class="pre">COMP_MPCC</span></code> for the possible MPI wrappers.</p>
<p>Once you’ve set up your compiling options compile the code using</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ make -j
</pre></div>
</div>
<p>The compiler should then produce an executable named <code class="docutils literal notranslate"><span class="pre">magic.exe</span></code>.</p>
<p>If you want to recompile the code from scratch do</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ make clean
</pre></div>
</div>
<p>to remove all the files generated by the compiler.</p>
<p>Once the executable is built, you are now ready to run your first production run!</p>
</div>
</div>
<div class="section" id="preparing-a-production-run">
<h2>Preparing a production run<a class="headerlink" href="#preparing-a-production-run" title="Permalink to this headline">¶</a></h2>
<p>After building the executable, use one of the namelists provided in the
<code class="docutils literal notranslate"><span class="pre">$MAGIC_HOME/samples</span></code> directory (called <code class="docutils literal notranslate"><span class="pre">input.nml</span></code>), adapt it to your
physical problem (see <a class="reference internal" href="inputNamelists/namelists.html#secnamelists"><span class="std std-ref">here</span></a> for an exhaustive
description of the possible options) and run <strong>MagIC</strong> as follows:</p>
<ul>
<li><p>Running a serial version of the code (<code class="docutils literal notranslate"><span class="pre">USE_MPI=no</span></code> and <code class="docutils literal notranslate"><span class="pre">USE_OMP=no</span></code>):</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ ./magic.exe input.nml
</pre></div>
</div>
</li>
<li><p>Running the code without OpenMP (<code class="docutils literal notranslate"><span class="pre">USE_MPI=yes</span></code> and <code class="docutils literal notranslate"><span class="pre">USE_OMP=no</span></code>) with <code class="docutils literal notranslate"><span class="pre"><n_mpi></span></code>
MPI ranks:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ mpiexec -n <n_mpi> ./magic.exe input.nml
</pre></div>
</div>
</li>
<li><p>Running the hybrid code (<code class="docutils literal notranslate"><span class="pre">USE_MPI=yes</span></code> and <code class="docutils literal notranslate"><span class="pre">USE_OMP=yes</span></code>) with <code class="docutils literal notranslate"><span class="pre"><n_mpi></span></code> MPI ranks
and <code class="docutils literal notranslate"><span class="pre"><n_omp></span></code> OpenMP threads:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">export</span> <span class="nv">OMP_NUM_THREAD</span> <span class="o">=</span> <n_omp>
$ <span class="nb">export</span> <span class="nv">KMP_AFFINITY</span><span class="o">=</span>verbose,granularity<span class="o">=</span>core,compact,1
$ mpiexec -n <n_mpi> ./magic.exe input.nml
</pre></div>
</div>
</li>
</ul>
<p>Note that the <a class="reference internal" href="inputNamelists/gridNamelist.html#varn-r-max"><span class="std std-ref">n_r_max-1</span></a> must be a multiple of <code class="docutils literal notranslate"><span class="pre"><n_mpi></span></code>,
where <a class="reference internal" href="inputNamelists/gridNamelist.html#varn-r-max"><span class="std std-ref">n_r_max</span></a> is the number of radial grid points (see
<a class="reference internal" href="inputNamelists/gridNamelist.html#secgridnml"><span class="std std-ref">here</span></a>).</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="contents.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Get MagIC and run it</a><ul>
<li><a class="reference internal" href="#download-the-code">Download the code</a></li>
<li><a class="reference internal" href="#setting-up-the-environment-variables">Setting up the environment variables</a></li>
<li><a class="reference internal" href="#install-shtns-recommended">Install SHTns (<strong>recommended</strong>)</a></li>
<li><a class="reference internal" href="#setting-up-compiler-options-and-compiling">Setting up compiler options and compiling</a><ul>
<li><a class="reference internal" href="#generic-compiling-options">Generic compiling options</a></li>
<li><a class="reference internal" href="#using-cmake-recommended">Using <code class="docutils literal notranslate"><span class="pre">CMake</span></code> (recommended)</a></li>
<li><a class="reference internal" href="#using-make-backup-solution">Using <code class="docutils literal notranslate"><span class="pre">make</span></code> (backup solution)</a></li>
</ul>
</li>
<li><a class="reference internal" href="#preparing-a-production-run">Preparing a production run</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="foreword.html"
title="previous chapter">Introduction</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="equations.html"
title="next chapter">Formulation of the (magneto)-hydrodynamics problem</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/install.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="f-modindex.html" title="Fortran Module Index"
>fortran modules</a> |</li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="equations.html" title="Formulation of the (magneto)-hydrodynamics problem"
>next</a> |</li>
<li class="right" >
<a href="foreword.html" title="Introduction"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="contents.html">Magic 6.3 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2023, Thomas Gastine, Johannes Wicht, Ankit Barik, Lùcia Duarte.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.3.1.
</div>
</body>
</html>