nuTens
nuTens Documentation

nuTens

nuTens

nuTens is a software library which uses tensors to efficiently calculate neutrino oscillation probabilities.

CI badge pip Code - Doxygen test - coverage cpp - linter

Installation

Requirements

  • CMake - Should work with most modern versions. If you wish to use precompiled headers to speed up build times you will need CMake > 3.16.
  • Compiler with support for c++17 standard - Tested with gcc
  • PyTorch - The recommended way to install is using PyTorch_requirements.txt:
    pip install -r PyTorch_requirements.txt
    (or see PyTorch installation instructions for instructions on how to build yourself)

Installation

Assuming PyTorch was built using pip, nuTens can be built using

mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=`python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'`
make <-j Njobs>

(installation with a non-pip install of PyTorch have not been tested but should be possible)

Verifying Installation

Once nuTens has been built, you can verify your installation by running

make test

Python

nuTens provides a python interface for it's high level functionality.

PyPi Distribution

For each nuTens release there is a corresponding python module distributed using PyPi which can automatically be obtained via pip using

pip install nuTens

Manual Installation

The python interface can be installed manually after cloning the repository using pip by running

pip install .

in the root directory of nuTens

Additionally, the nuTens python module can be installed as a shared library .so object by specifying the CMake option

cmake -DNT_ENABLE_PYTHON=ON <other options> <source dir>

and doing make && make install

Benchmarking

nuTens uses Googles benchmark library to perform benchmarking and tracks the results uing Bencher. Each benchmark consists of calculating neutrino oscillations for 1024 batches of 1024 neutrino energies using the standard PMNS formalism in vacuum and in constant density matter:


Const Density Osc Benchmark for nuTens - Bencher

Vacuum Osc Benchmark for nuTens - Bencher

Feature Wishlist

  • [x] Support PyTorch in tensor library
  • [x] Vacuum oscillation calculations
  • [x] Constant matter density propagation
  • [x] Basic test suite
  • [x] Basic CI
  • [x] Doxygen documentation with automatic deployment
  • [x] Add test coverage checks into CI
  • [x] Integrate linting ( cpp-linter? )
  • [x] Add instrumentation library for benchmarking and profiling
  • [x] Add suite of benchmarking tests
  • [x] Integrate benchmarks into CI ( maybe use hyperfine and bencher for this? )
  • [ ] Add proper unit tests
  • [x] Expand CI to include more platforms
  • [ ] Add support for modules (see PyTorch doc)
  • [ ] Propagation in variable matter density
  • [ ] Add support for Tensorflow backend
  • [x] Add python interface