Skip to content

OlegJakushkin/BLonD-minimal-cpp

 
 

Repository files navigation

C++ Version of CERN's BLonD code

Status

NOT Stable - Under heavy development

Build Status Build status Coverage Status

Requirements

####Linux

####Windows

  • Visual Studio version >= 2015 with C++ compiler install

Installation (Windows and Linux)

  • clone the code into a directory (lets call it BLonD-minimal-cpp/):
git clone --branch=master https://github.com/kiliakis/BLonD-minimal-cpp
  • To compile all dependencies and build blond library run the commands:
cd BLonD-minimal-cpp
mkdir build  
cd build 
cmake -DWITH_FFTW=True -DWITH_GOOGLETEST=True -DWITH_BENCHMARK=True -DBUILD_EXTERNALS=True -DCMAKE_BUILD_TYPE=Release .. # Configuration
cmake --build . # Compilation
ctest -VV # Testing

What was happening here:

  1. we opened folder with downloaded Blond source files
  2. created a folder to hold solution and project files
  3. On configuration step: 1. Downloaded build and installed external libraries (FFTW, GoogleTest, GoogleBenchmark) into BLonD-minimal-cpp\external\install 2. Generated solution and project files
  4. Compiled and linked default build configuration
  5. Executed unit tests
  • The executables should be ready!
  • Developer's Notes:
    • set -DWITH_COMPUTE=True and -DOPENCL_SDK_PATH=$CUDA_OR_INTELL_OR_AMD_SDK to build OpenCL benchmarks with boost
    • On Linux, by default, the Release version of the code is compiled. You can build a debug version by adding -DCMAKE_BUILD_TYPE=Debug argument to configuration command, before ..
    • On Windows by default, the Debug version of the code is compiled. You can build a debug version by adding --target ALL_BUILD --config Release argument to Compilation command after .
    • On Windows one shall copy contents of external/install/bin/fftw/$(configuration) into corresponding to given build configuration folder to be able to test and run executables.
    • To commit properly formatted code, reformatted by clang-format on each build please add -DWITH_FORMAT=True argument to configuration command, before .., note clang-format shall be installed
    • To set data refrence files path's one can set -DDATAFILES_DIR_DEMOS and -DDATAFILES_DIR_TESTS.
    • To use CLion IDE please add -DABSOLUTE_DATA_PATHS=True to embed absolute test data path's instead of default relative to build forder

Using system Libraries (advanced)

If FFTW, GoogleTest or GoogleBenchmark are already installed in your system you can set -DWITH_* to False or skip this arguments when calling configuration commands

Configuration

The following definitions, found in file include/blond/configuration.h, can be commented / uncommented to alter simulation's configuration:

#define TIMING
#define PRINT_RESULTS

Note that a re-compile is needed every time a change is made.

Usage

The following optional command line arguments can be specified in order to specify some basic simulation parameters:

  • -m , --threads=<num> : Number of OpenMP threads that will be used in the simulation (default: 1)
  • -p , --particles=<num> : Number of macro particles that will be simulated (default: 10k)
  • -t , --turns=<num> : Number of simulation turns (default: 10k)
  • -s , --slices=<num> : Number of slices that will be used to generate the beam's histogram (default: 100)

Example: ./testcase -t 1000 -p2000
Or type: ./testcase -h for more

Running the Unit-Tests

Once you have successfully compiled the code you can run the tests:

cd BLonD-minimal-cpp/build
ctest -VV

Then you can generate unit-test documentation:

Building Documentation

To generate html documentation with search and graphical class hierarchy's please install Doxygen and Graphviz and run:

cd BLonD-minimal-cpp/build
doxygen Doxyfile

Building Unit-Test Documentation (Linux only)

To generate html documentation on unit tests coverage please install genhtml and lcov

cd BLonD-minimal-cpp/build
lcov --capture --directory .. --output-file coverage.info
genhtml coverage.info --output-directory html

Extended documentation for developers

Developers FAQ and TLDR are located here

Original BLonD Links

Developers

  • Alexandre Lasheen (alexandre.lasheen (at) cern.ch)
  • Juan Esteban Muller (juan.fem (at) cern.ch)
  • Danilo Quartullo (danilo.quartullo (at) cern.ch)
  • Helga Timko (Helga.Timko (at) cern.ch)
  • Konstantinos Iliakis (konstantinos.iliakis (at) cern.ch)

Contributors Notice

Dear all contributors, you are kindly requested to format your code using astyle format options found [here] (https://root.cern.ch/coding-conventions#Astyle).

About

Minimal BLonD implementation in C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 84.7%
  • JavaScript 10.5%
  • CMake 2.8%
  • HTML 1.5%
  • Shell 0.3%
  • CSS 0.1%
  • C 0.1%