stfwithswift.rst 2.66 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.. SWIFT with VELOCIraptor
   Folkert Nobels 12th October 2018


Configuring SWIFT with VELOCIraptor
===================================

.. toctree::    
   :maxdepth: 2    
   :hidden:    
   :caption: Contents:

In the following three paragraphs we will explain how to setup VELOCIraptor,
how to compile it and how to compile SWIFT with VELOCIraptor. 


Setting up VELOCIraptor
-----------------------

Before we can run SWIFT with VELOCIraptor we first need to download
VELOCIraptor. This can be done by cloning the repository on GitHub_::

  git clone https://github.com/pelahi/VELOCIraptor-STF

Loic Hausammann's avatar
Loic Hausammann committed
25
Currently the best version that works with SWIFT is the master
26
27
28
29
30
of VELOCIraptor, to get this branch use::

  cd VELOCIraptor-STF 
  git fetch 

Loic Hausammann's avatar
Loic Hausammann committed
31
To get VELOCIraptor working with SWIFT simply use::
32

Loic Hausammann's avatar
Loic Hausammann committed
33
  cmake . -DVR_USE_SWIFT_INTERFACE=ON -DCMAKE_CXX_FLAGS="-fPIC" -DVR_USE_GAS=ON
34

Loic Hausammann's avatar
Loic Hausammann committed
35
If you wish to run swift without MPI, you will need to add ``-DVR_MPI=OFF``.
36
37
38
39
40
41
42

Compiling VELOCIraptor
----------------------

After we downloaded the files and made a configuration file we can compile
VELOCIraptor as follows::

Loic Hausammann's avatar
Loic Hausammann committed
43
  make -j 4
44

Loic Hausammann's avatar
Loic Hausammann committed
45
After the compilation of your code, you will find a static library ``libvelociraptor.a``,
Loic Hausammann's avatar
Loic Hausammann committed
46
47
that is required to run SWIFT with VELOCIraptor.
Note that VELOCIraptor needs a serial version of the
48
49
50
51
52
HDF5 library, not a parallel build.

Compiling SWIFT
---------------
The next part is compiling SWIFT with VELOCIraptor and assumes you already
53
downloaded SWIFT from the GitLab_, this can be done by running
54

55
56
.. code:: bash
  
57
  ./autogen.sh 
Loic Hausammann's avatar
Loic Hausammann committed
58
  ./configure --with-velociraptor=/path/to/VELOCIraptor-STF/src 
59
60
61
62
63
64
  make 

In which ``./autogen.sh`` only needs to be run once after the code is cloned
from the GitLab_, and ``/path/to/`` is the path to the ``VELOCIraptor-STF``
directory on your machine. In general ``./configure`` can be run with other
options as desired. After this we can run SWIFT with VELOCIraptor, but for this
65
we first need to add several lines to the yaml file of our simulation
66
67

    
68
69
70
71
72
73
74
.. code:: YAML

   StructureFinding:      
     config_file_name:     stf_input_6dfof_dmonly_sub.cfg
     basename:             ./stf
     scale_factor_first:   0.02
     delta_time:           1.02
75
76
77
78
79
80
81

In which we specify the ``.cfg`` file that is used by VELOCIraptor and the 
other parameters which SWIFT needs to use. In the case of 
the Small Cosmological Volume DMO example we can run a simulation with halo
finder as::

  cd examples/SmallCosmoVolume_DM 
82
  ../swift --cosmology --hydro --self-gravity --velociraptor --threads=8 small_cosmo_volume_dm.yml
83

84
Which activates the VELOCIraptor interface.
85
86
87
88


.. _GitHub: https://github.com/pelahi/VELOCIraptor-STF
.. _GitLab: https://gitlab.cosma.dur.ac.uk/swift/swiftsim