mach3

The official repository for MaCh3

https://github.com/mach3-software/mach3

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 20 DOI reference(s) in README
  • Academic publication links
    Links to: science.org, zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.5%) to scientific vocabulary

Keywords

bayesian cuda data-analysis markov-chain-monte-carlo mathematics neutrino neutrino-oscillations physics statistics
Last synced: 6 months ago · JSON representation

Repository

The official repository for MaCh3

Basic Info
Statistics
  • Stars: 8
  • Watchers: 11
  • Forks: 7
  • Open Issues: 21
  • Releases: 30
Topics
bayesian cuda data-analysis markov-chain-monte-carlo mathematics neutrino neutrino-oscillations physics statistics
Created about 5 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Codeowners Security Zenodo

README.md

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 at both the Near and Far detectors throughout the years. The framework is also utilized by the DUNE and HK oscillation analysis groups. Additionally, it supports joint fits between T2K and NOvA, as well as T2K and SK's atmospheric data.

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

License DOI Release Container Image Code - Documented Code - Doxygen Build CI CodeFactor

Famous Plots

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

Cite

When using MaCh3 you must cite our doi from Zenodo. The bibtex file can be found by exporting the citation from this link: on Zenodo DOI.

Help and Guidelines 📄

How to Compile

MaCh3 follows standard cmake pattern. By default you should get most optimal build setting although below we list many configurable options: bash mkdir build; cd build; cmake ../ make -jN [Where N is number of threads] make install

Don't forget to: bash source bin/setup.MaCh3.sh

Building against MaCh3

To include MaCh3 in your cmake project you can use following syntax cmake CPMFindPackage( NAME MaCh3 GIT_TAG "blarb" GITHUB_REPOSITORY mach3-software/MaCh3 ) Where "blarb" is the MaCh3 version. You can find a list of releases here
If you compiled MaCh3 and sourced it you can simply call cmake find_package(MaCh3)

Once you found MaCh3 you might want to link your library against MaCh3. You can do this as follows: cmake 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.

Python 🐍

MaCh3 has an optional python interface (pyMaCh3) which provides much of the same functionality as the c++ interface (see here for documentation).

You can tell the build system to set up the pyMaCh3 interface by specifying

bash cmake ../ -DMaCh3_PYTHON_ENABLED=ON make && make install

when building

Building with Pip

Additionally, you can build just the Python module by doing:

bash pip install -t <install location> . The (optional) -t option specifies an install location which can be useful if you are on a computing cluster and don't have write access to the default install location. If you specify a non-standard location you will need to add it to your PYTHONPATH as above so that python can find the module.

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 bash 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 bash mkdir build; cd build; cmake ../ -DMaCh3_GPU_ENABLED=OFF 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 has access to several neutrino oscillation calculators via NuOscillator framework.

Following neutrino oscillation calculators are available: |Oscillator | Hardware | Source | Reference | |------------------|------------|------------|------------| | CUDAProb3Linear | CPU/GPU | Beam | | | CUDAProb3 | CPU/GPU | Atm | Ref | | ProbGPULinear | GPU | Beam | Ref | | Prob3++Linear | CPU | Beam | | | NuFastLinear | CPU | Beam | Ref | | OscProb | CPU | Beam/Atm | Ref | | NuSQUIDSLinear | CPU | Beam | Ref |

If nothing is specified in cmake build then NuFastLinear_ENABLED will be used. To control which oscillation calculators you want to use here is syntax:

bash cmake ../ -DCUDAProb3Linear_ENABLED=ON -DCUDAProb3_ENABLED=ON -DProbGPULinear_ENABLED=ON -DProb3ppLinear_ENABLED=ON -DNuFastLinear_ENABLED=ON -DOscProb_ENABLED=ON You can specify more than one engine, and MaCh3 support different engines for different samples. For example, you can use NuFast for beam samples and CUDAProb3 for atmospheric samples.

Fitting algorithms

The following fitting algorithms are available:

| Algorithm | Reference |Need Ext Lib | |------------|------------------|--------------| | MR2T2 | Ref | No | | MINUIT2 | Ref | Yes | | PSO | Ref | No |

Debug

Several debugging options are available which are heavy for RAM and performance and, therefore not used by default. To enable it: bash 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.

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

Logger

Several logging options are available. By default, MaCh3 uses INFO level logging. You can enable more verbose logging by specifying the desired level during configuration: bash cmake ../ -DLOG_LEVEL="TRACE" You can find more here.

Other CMake Options

| Option | Meaning | | ------ | ------- | | MaCh3_NATIVE_ENABLED | Enables native CPU optimizations for improved performance. Not recommended on clusters with multiple CPU configurations due to potential compatibility issues. | | MaCh3_NuOsc_GPU_ENABLED | By default MaCh3 will use NuOscillator with GPU if MaCh3 is compiled with GPU, this flag allows disabling GPU for NuOscillator even if MaCh3 has GPU enabled | | MaCh3_LOW_MEMORY_STRUCTS_ENABLED | This will use float/short string for many structures |

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: bash GCC: >= 8.5 [lower versions may work] C++: >= 14 CMake: >= 3.14 ROOT: >= 6.18

Supported operational systems

| Name | Status | |-------------|--------| | Alma9 | ✅ | | Rocky9 | ✅ | | Ubi9 | ✅ | | Ubuntu22.04 | ✅ | | Ubuntu24.10 | ✅ | | Fedora32 | ✅ | | CentOS7 | ❔ | | Windows | ❌ | | MacOS | ❌ |

✅ - 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

Supported compilers

| Name | Status | |-------------|--------| | GNU | ✅ | | CLANG | ❔ | | INTELLLVM | ❔ | | MSVC | ❌ |

✅ - Fully working with every feature fully tested by CI/CD
❔ - Not every feature may work, only compilation being tested by CI/CD
❌ - Not supported and no plans right now

Plotting and Diagnostic 📊

Example of chain diagnostic utils can be found here with example of config. The MaCh3 core plotting library code can be found here along with example config files and some apps for making standard plots.

How To Use

This is an example how your executable can look like using MaCh3: ```cpp //Manager is responsible for reading from config std::unique_ptr fitMan = MaCh3ManagerFactory(argc, argv);

std::vector sample; //vector storing information about sample for different detector std::vector Cov; // vector with systematic implementation MakeMaCh3Instance(fitMan.get(), sample, Cov); //Factory like function which initialises everything

// FitterBase class, can be replaced with other fitting method std::unique_ptr MarkovChain = MaCh3FitterFactory(FitManager.get());

//Adding samples and covariances to the Fitter class could be in the factory for(unsigned int i = 0; sample.size(); i++) MarkovChain->AddSampleHandler(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 ``` For more see here

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 49
  • Total pull requests: 397
  • Average time to close issues: 6 months
  • Average time to close pull requests: 5 days
  • Total issue authors: 11
  • Total pull request authors: 16
  • Average comments per issue: 0.27
  • Average comments per pull request: 1.1
  • Merged pull requests: 288
  • Bot issues: 0
  • Bot pull requests: 9
Past Year
  • Issues: 28
  • Pull requests: 353
  • Average time to close issues: 29 days
  • Average time to close pull requests: 2 days
  • Issue authors: 10
  • Pull request authors: 16
  • Average comments per issue: 0.18
  • Average comments per pull request: 1.2
  • Merged pull requests: 252
  • Bot issues: 0
  • Bot pull requests: 9
Top Authors
Issue Authors
  • KSkwarczynski (16)
  • pjdunne (11)
  • EdAtkin (11)
  • ewanwm (3)
  • luketpickering (2)
  • alexanderrichards (1)
  • BenJarg (1)
  • dbarrow257 (1)
  • tdealtry (1)
  • henry-wallace-phys (1)
  • DomLangridge (1)
Pull Request Authors
  • KSkwarczynski (264)
  • dbarrow257 (28)
  • henry-wallace-phys (20)
  • ewanwm (18)
  • EdAtkin (16)
  • dependabot[bot] (9)
  • nosektom (8)
  • yash-quark (7)
  • BenJarg (6)
  • tdealtry (4)
  • luketpickering (4)
  • hank-hua (3)
  • pgranger23 (3)
  • Jude412 (3)
  • veeramik (2)
Top Labels
Issue Labels
Enhancement (14) Bug Fix (6) Nu Osc/Xsec (4) CI/CD (4) no-issue-activity (3) Plotting (3) Samples (2) python (2) Manager (1) Cmake (1) GPU (1) MCMC (1)
Pull Request Labels
Nu Osc/Xsec (92) Samples (71) MCMC (66) Cmake (61) CI/CD (61) Manager (42) Plotting (42) Documentation (37) dependencies (11) Tidy (9) GPU (8) Enhancement (7) github_actions (6) title needs formatting (3) Bug Fix (3) python (2) no-issue-activity (1) documentation (1) enhancement (1)