Swarm-NG  1.1
Advanced Options for Building Swarm

Swarm provides options in both configuration and complilation stage.

In configuration, CMake tries to automatically find required packages if they are installed in default locations. You may override the default values using CMake tools. You may select specific compile time options to build the swarm components that you desire. Here we discuss the CMake tools for configuration and the advanced compiling options.

Configration Tools

In How to build swarm we discussed one of the configuration tools by using Console. Here we show two other options.

Configuration using CMake command line

Change into the <build directory> and execute the following command:

cmake <source directory>

It may give error messages if it couldn't find the required packages in their default locations. You can fix the errors by editing the file 'CMakeCache.txt' that cmake generates in the <build directory> and repeat this process until there are no more error messages.

Configuration using CMake GUI

CMake GUI is an X11 interface to CMake. To run CMake GUI, you need an X server running on your local machine.

To get started, change into the build directory and type this command:

cmake-gui <source directory>

Click on "Configure" button, in the dialogs that follow, select the default options. CMake will check the configuration and show the error messages if any in red text in the bottom pane. Change the variables according to CMake. Click on "Configure" again to apply changes. Repeat this procedure until there are no more errors.

Click the "Generate" button when you are done and Makefiles will be generated. You can then close the GUI window using the "Close" button.

Configuration Options

Compile-time constants

Variable Description Acceptable Values Default value
MAX_NBODIES Maximum number of bodies per system 3..10 3
NUM_PLANET_ATTRIBUTES
NUM_SYSTEM_ATTRIBUTES
Number of attributes per planet and system, respectively. The attributes are used for application specific values that need to be stored per planet or per system 1..10 1
SHMEM_CHUNK_SIZE
ENSEMBLE_CHUNK_SIZE
The chunk size setting for data structures stored in shared memory and the ensemble data structure. Higher chunk-size aids coalesced reads. However, higher shared-memory chunk size are not available for larger number of bodies. 1,4,8,16,32 Automatic based on MAX_NBODIES

Compiler options

Variable Description Default value
CMAKE_CXX_COMPILER
CMAKE_C_COMPILER
To specify the path for C++ and C compilers on your system. Swarm has been tested with GNU g++ and gcc compilers. You are free to try other compilers and report the results back to us. c++
cc
CMAKE_EXE_LINKER_FLAGS Flags for that are passed to the linker. Normally not needed
CMAKE_CXX_FLAGS
CMAKE_C_FLAGS
to specify the compiler flags during the compilation. For example: -g for debugging, -O for the level of optimization. Please consult your compiler manual for the details.

CUDA related options

Variable Description Default value
GENERATE_FERMI to generate CUDA binaries for Fermi (Geforce 400 series) architecture, check this option only if you have a Fermi card in your system. ON
GENERATE_GT200 to generate CUDA binaries for GT200 architecture(Geforce 200 series), check this option only if you have a GT200 card in your system. OFF
GENERATE_KEPLER to generate CUDA binaries for Kepler architecture(Geforce 600 series), check this option only if you have a Kepler compatible card in your system. [Experimental, not thoroughly tested]OFF
CUDA_TOOLKIT_ROOT_DIR The directory where CUDA toolkit is installed. Useful when multiple version of CUDA are installed on one system /usr/local/cuda

Python and Boost related options

Variable Description Default value
Boost_DIR to specify the directory where Boost is installed. ON
Boost_INCLUDE_DIR to specify the directory where Boost header files are located. ON
Boost_LIBRARY_DIR to specify the directory where Boost libraries are installed. ON
Boost_PYTHON_LIBRARY to specify the full file path to libboost_python.so ON
PYTHON_INCLUDE_DIR to specify the directory where Python header files are located ON
PYTHON_LIBRARY to specify the full file path to python library file. ON

Miscellaneous options

Variable Description Default value
CMAKE_VERBOSE_BUILD
CUDA_VERBOSE_BUILD
to print out compile details during the build process. You may set turn it ON to see the details of compilation to aid debugging when compilation fails. OFF
OFF

Plugin management

Variables that begin with PLUGIN_ are used to control compilation of plugins. Widely-used plugins are enabled by default. It is advised for the user to turn off unused plugins to reduce compilation time.

Testing options

Since testing is done through CTest, the CMake testing system, testing parameters are to be set using CMake variables. These variables are used when issuing a "make test" command.

Variable Description
TEST_integrator_nbod Enable testing integrators with different number of bodies
TEST_integrator_nbod_list List of configurations for integrators to be tested.(must correspond to files in test/integrators/*.cfg)
TEST_monitors_nbod Enable testing monitors with different number of bodies
TEST_stability Enable stability test for long-term integrations
TEST_stability_list List of configurations for integrators to be tested.(must correspond to files in test/integrators/*.cfg)
TEST_stability_duration Duration of the integration for stability test
TEST_stability_nsys Number of systems to integrator for the stability test

Build all executables and libraries

To make all swarm executables and swarm-ng libraries in one step, do:

  make all

Make individual components

We provide options to build individual components, documentations, and tutorials. To see a list of options, type:

  make help

It lists all the options that you can use with 'make' to build the components you desire. For example,

  • to generate all the documentations, do (Doxygen is required for this option):
  make doc
  • to build benchmark, do:
  make benchmark