Giter Club home page Giter Club logo

mach3's Introduction

MaCh3 MaCh3

The Markov Chain 3 flavour is a framework born in 2013 as a Bayesian MCMC fitter for T2K oscillation analysis. It has now been used for multiple T2K Oscillation analyses both at the Near and Far detectors throughout the years and is also used by the DUNE and HK oscillation analysis groups as well as for joint fits between T2K and NOvA and T2K and SK's atmospheric data.

The framework has also evolved to allow non MCMC modules to interrogate the likelihoods implemented.

License Release - v1.0.0 Container Image Code - Documented Code - Doxygen Build CI

Famous Plots

Example of plots made using MaCh3 apparent in scientific publications, for more see here MaCh3 MaCh3

Cite

When citing MaCh3, please use on Zenodo DOI.

How to Compile

MaCh3 follows standard cmake pattern. By default you should get most optimal build setting although below we list many configurable options:

mkdir build;
cd build;
cmake ../
make -jN [set number of threads]
make install

Don't forget to:

source bin/setup.MaCh3.sh

Building against MaCh3

If you compiled MaCh3 and sourced it you can simply call

find_package(MaCh3)

and cmake will find it. Alternatively, you can use CPM, for example:

CPMFindPackage(
  NAME MaCh3
  GIT_TAG "blarb"
  GITHUB_REPOSITORY mach3-software/MaCh3
)

Once you found MaCh3 you might want to link your library against MaCh3. You can do this as follows:

target_link_libraries(blarb MaCh3::All)

Some functionalities rely on setting Env{MACH3} which should point to path experiment specific MaCh3. This way MaCh3 can easily find Env{MACH3}/inputs/SomeInput.root for example.

Multithreading

MaCh3 quite heavily relies on Multithreading, it is turned on by default. If for debugging purposes you would like to turn it off please use

cmake ../ [-DMaCh3_MULTITHREAD_ENABLED=<OFF>]

CUDA

If the system has access to GPU, MaCh3 will enable GPU functionality automatically. If you would like to CPU only despite having access to CUDA

mkdir build; cd build;
cmake ../ [-USE_CPU=ON]

MaCh3 supports quite a high range of CUDA architectures if something doesn't work on your GPU let us know. MaCh3 supports only NVIDIA GPUs.

Oscillator

MaCh3 uses several neutrino oscillation calculators. By default, CUDAProb3 is used. If you would like to use Prob3++

cmake ../ [-DUSE_PROB3=<ON,OFF>]

Following neutrino oscillation calculators are available:

Oscillator Hardware Source
CUDAProb3 CPU/GPU Beam/Atm
Prob3++ CPU Beam
probGPU GPU Beam

Fitting algorithms

The following fitting algorithms are available:

Algorithm Need Ext Library
MR2T2 No
MINUIT2 Yes
PSO No

Debug

Several debugging options are available which are heavy for RAM and performance and, therefore not used by default. To enable it:

cmake ../ [-DMaCh3_DEBUG_ENABLED=<ON,OFF>]

There are several debug modes, to enable more detailed but very heavy specific debug levels. Level 1 is the default debug activated by the above.

cmake ../ [-DMaCh3_DEBUG_ENABLED=<ON,OFF>] [-DDEBUG_LEVEL=<1,2,3>]

System Requirements

Most of external libraries are being handled through CPM. The only external library that is not being handled through CPM and is required is ROOT. Currently used external dependencies include:

  1. yaml-cpp
  2. spdlog

Based on several test here are recommended version:

  GCC: >= 8.5 [lower versions may work]
  CMake: >= 3.14
  ROOT: >= 6.18

Supported operational systems

Name Status
Alma9
Ubuntu22.04
Fedora32
CentOS7
Windows

✅ - Part of CI/CD
❔ - Not part of CI/CD but used by some users/developers so it might work
❌ - Not supported and no plans right now

How To Use

This is an example how your executable can look like using MaCh3:

  manager *fitMan = nullptr; //Manager is responsible for reading from config

  std::vector<samplePDFBase*> sample; //vector storing information about sample for different detector
  std::vector<covarianceBase*> Cov; // vector with systematic implementation
  mcmc *markovChain = nullptr; // MCMC class, can be replaced with other fitting method
  MakeMaCh3Instance(fitMan, sample, Cov, markovChain); //Factory like function which initialises everything

  //Adding samples and covariances to the Fitter class could be in the factory
  for(unsigned int i = 0; sample.size(); i++)
    markovChain->addSamplePDF(sample[i]);
  for(unsigned int i = 0; Cov.size(); i++)
    markovChain->addSystObj(Cov[i]);

  markovChain->RunLLHScan(); // can run LLH scan
  markovChain->runMCMC(); //or run actual fit

Help and Guidelines

Plotting and Diagnostic

Example of chain diagnostic utils can be found here with example of config.

mach3's People

Contributors

akaboth avatar dbarrow257 avatar edatkin avatar henry-wallace-phys avatar kskwarczynski avatar pgranger23 avatar pjdunne avatar tdealtry avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mach3's Issues

CUDA_PATH changes in cuda-12

The cuda path variable changes from CUDAPATH to CUDA_PATH in cuda 12 (and newer). This breaks core compilation

SplineMonolith name change

For the following files, the first letter of the file name should not be capitalised. It should be modified as:

mv MaCh3_core/splines/SplineMonolith.h MaCh3_core/splines/splineMonolith.h
mv MaCh3_core/splines/SplineMonolith.cpp MaCh3_core/splines/splineMonolith.cpp

This is currently creating issue for the compilation, and the library must be recompiled to be used for MaCh3_DUNE.

Define Covaraince Enum to avoid copy pasting

// ********************************************
// DB Grab the Normalisation parameters for the relevant DetID
const std::vector<XsecNorms4> covarianceXsec::GetNormParsFromDetID(const int DetID) {
// ********************************************
  std::vector<XsecNorms4> returnVec;
  for (int i = 0; i < _fNumPar; ++i) {
    if (strcmp(GetParamType(i), "Norm") == 0) { //If parameter is implemented as a normalisation
      if ((GetParDetID(i) & DetID)) { //If parameter applies to required DetID
        returnVec.push_back(NormParams[i]);
      }
    }
  }
  return returnVec;
}

and this

// ********************************************
// DB Grab the Functional parameter names for the relevant DetID
const std::vector<std::string> covarianceXsec::GetFuncParsNamesFromDetID(const int DetID) {
// ********************************************
  std::vector<std::string> returnVec;

  for (int i = 0; i < _fNumPar; ++i) {
    if ((GetParDetID(i) & DetID)) { //If parameter applies to required DetID
      if (strcmp(GetParamType(i), "Functional") == 0) { //If parameter is implemented as a functional param
		returnVec.push_back(GetParFancyName(i));
      }
    }
  }
  return returnVec;
}

is bloody identical!!!

If we make enums
Norm, Spline, Func, whatever we can simply large part of Xec into
const std::vector<std::string> covarianceXsec::GetParsNamesFromDetID(const int DetID, CovEnum EnumId) {

Doxygen format

We've now got our doxygen auto-building here 🎉

But I've noticed that the format of the doxygen is to be a copy of the code e.g. here

Collectively, I think we need to decide - is this what we want the doxygen to be?

Personally, I would suggest that instead of a copy of the code, it should be a description of what each method does / data member represents.

Thoughts in emoticon poll format

  • 👍 for old code copy
  • 👎 for new written description

Related to #47

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.