Skip to content

Developer Installation Instructions

Garrett Granroth edited this page Nov 13, 2018 · 5 revisions

#Install SpinWaveGenie#

The instructions below are intended for building SpinWaveGenie on OS X and Linux only. Building on Windows is significantly different and at this time should be considered experimental. For those still undeterred, instructions are available here

##Software Prerequisites##

SpinWaveGenie links to on a number of software packages and libraries. On OS X, these can be install with homebrew. On linux, these can be installed with your distribution's package manager.

Required to compile:

  • CMake 2.8.12 or later (3.0+ recommended)
  • C++11 Compiler (GCC 4.8+, AppleClang)
  • boost
  • Eigen

For parallel builds

For fitting

Developer Documentation

##Installing Prerequisites on OS X With Homebrew## SpinWaveGenie depends on several software packages and libraries which must installed before it can be compiled. The instructions below use homebrew to greatly simplify installing and managing these dependencies.

This page assumes that you have a standard terminal window open. Commands to run in the terminal will be indicated as below:

1 $ echo hello
2 hello

$ indicates a shell prompt. As demonstrated above, if you type echo hello world, then you should see the same output obtained above on the next line: hello world

  1. Install XCode with Command Line Tools: Click on this link to Xcode on the Mac App Store, then click on “View in Mac App Store.” The “App Store” app on your Mac will launch and take you the Xcode page. Click on the “Free” button, then click on “Install App.” Once the installation is complete, go to your Applications folder, double-click on Xcode and accept the license agreement. Install Command Line Tools either through the Mac App Store or from the command line.
1 $ xcode-select --install
  1. Confirm the installation was successful by typing the following in a terminal window.
1 $ clang++ -v
2 Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
3 Target: x86_64-apple-darwin12.5.0
4 Thread model: posix
  1. Install Homebrew: Homebrew is a package manager for OS X. It will manage all libraries Spin Wave Genie depends on. Start by executing the following line
1 $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

and follow the on-screen instructions. Lastly, we need to tap the keg homebrew/science

1 $ brew tap homebrew/science
  1. Use homebrew to install the following formulas
1 $ brew install cmake
2 $ brew install graphviz
3 $ brew install doxygen
4 $ brew install eigen
5 $ brew install nlopt
6 $ brew install boost --c++11
7 $ brew install tbb --c++11

##Installing Prerequisites on Linux##

Using your distribution's package manager, install the following

  • required: g++, boost, git, cmake, eigen.
  • optional: TBB, Nlopt and doxygen.

These dependencies are already installed on cncs2.sns.gov and the SNS analysis cluster. They can be rolled out to other analysis computers.

##Compile SpinWaveGenie##

Now that all of the prerequisite software is installed, you are ready to compile Spin Wave Genie.

  1. Get the source: You can get the source code for Spin Wave Genie by cloning the git repository.

To clone the repository and its submodules, type

1 $ git clone https://github.com/SpinWaveGenie/SpinWaveGenie.git
2 $ git submodule update --init --recursive

To get the submodules, type

  1. Compile and install Spin Wave Genie
  • with autotools on Linux & OS X:

Make is one of the most widespread build systems and included with most unix-based operating systems.

1 $ cd SpinWaveGenie
2 $ mkdir build
3 $ cd build
4 $ cmake ..
5 $ make -j N

where N is the number of cores to use for the compilation.

optional: install library in CMAKE_INSTALL_PREFIX, which by default is /usr/local.

1 $ make install
  • with ninja on OSX & Linux:

Ninja is another build system born out of the Chromium browser project. Its distinguishing goal is to be fast and builds are always run in parallel.

1 $ cd SpinWaveGenie
2 $ mkdir build
3 $ cd build
4 $ cmake -G Ninja ..
5 $ ninja

optional: install library in CMAKE_INSTALL_PREFIX, which by default is /usr/local.

1 $ ninja install
  • Creating an XCode project:

Software development is often more efficient within an integrated development environment (IDE) such as XCode.

1 $ cd SpinWaveGenie
2 $ mkdir build
3 $ cd build
4 $ cmake -G Xcode ..
open spin_wave_genie.xcodeproj

##Build options##

Here is a list of all the build options that may be changed by CMake. To changes these settings, go to your build directory and run

$ ccmake .

After changing an option, press c to configure then press g to generate. The makefile/IDE project is now updated with the newly selected options.

  • BUILD_TESTING - Enables the compilation of unit tests
  • USE_THREADS - Use Threading Building Blocks to spread tasks over multiple CPU cores for better performance
  • CMAKE_BUILD_TYPE - sets the build type (case sensitive)
    • Debug - Compiles debug information into the library and executables. Enables asserts to check for programming mistakes. Spin Wave Genie will run very slow in Debug mode, but problems may be easier to identify.
    • RelWithDebInfo - Compiles with optimizations and debug symbols. Useful for profiling benchmarks.
    • Release - All compiler optimizations are enabled and asserts are removed..
  • ENABLE_DOXYGEN - enables the generation of detailed user and developer documentation (Defaults off)