Skip to content

Commit

Permalink
Merge branch 'develop' into fix_chain_restart
Browse files Browse the repository at this point in the history
  • Loading branch information
KSkwarczynski authored Feb 3, 2025
2 parents 9a3abdb + b87fbc8 commit 431a39f
Show file tree
Hide file tree
Showing 51 changed files with 731 additions and 707 deletions.
2 changes: 1 addition & 1 deletion .github/CIscripts/RAM.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ source bin/setup.NuOscillator.sh
NUM_CORES=$(nproc)

# Start the executable in the background
./bin/MCMCTutorial Inputs/FitterConfig.yaml &
./bin/MCMCTutorial Inputs/FitterConfig.yaml General:MCMC:NSteps:100000 &

# Get the PID of the process
PID=$!
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/CIBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jobs:
file: Doc/MaCh3DockerFiles/Rocky9/Dockerfile
tag: rocky9latest
cmakeoptions: -DMaCh3_PYTHON_ENABLED=ON
- os: Alma9 NoMultithreading
file: Doc/MaCh3DockerFiles/Alma9/Dockerfile
tag: alma9latest
cmakeoptions: -DMaCh3_PYTHON_ENABLED=ON -DMaCh3_MULTITHREAD_ENABLED=OFF

name: Build CI ${{ matrix.os }}

Expand All @@ -44,4 +48,4 @@ jobs:
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build the Docker image
run: docker build . --file ${{ matrix.file }} --tag ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.tag }} --build-arg MACH3_VERSION=${{ github.head_ref }} --build-arg CMAKE_OPTIONS="${{ matrix.cmakeoptions }}"
run: docker build . --file ${{ matrix.file }} --tag ghcr.io/${{ github.repository_owner }}/mach3:${{ matrix.tag }} --build-arg MACH3_VERSION="${{ github.head_ref }}" --build-arg CMAKE_OPTIONS="${{ matrix.cmakeoptions }}"
51 changes: 51 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Actions

Summary of currently implemented bots

## Benchmark
* Performs several action like reweight and save output in nice chart

## CDImage
* Creates container after each commit to develop or after tag

## CIBuild
* Checks compilation on several resources

## CIPythonValidations
* Testin of pyMaCh3

## CIValidations
* Unit and integration test of MaCh3

## CodeQL
* Code scanning of MaCh3

## Doxygen
* Creates doxygen and spinhx documentation for MaCh3

## Label
* Label each PR based on modified files

## Linter
* Lint code base (currently C++ turned off)

## MakeRelase
* Make realse after tag is made

## Meme
* Nothing to add, cool meme for PR

## Newsletter
* Make weekly summary of

## PRtittleChecker
* Ensures each PR starts with suffix like tidy: for example

## Stale
* Tags stale PRs and issues

## TagTutorial
* Make tag of tutorial after MaCh3 is tagged to ensure both have corresponding tags

## Telemetry
* Add telemetry like RAM and CPU usage for each PR
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set(CMAKE_VERBOSE_MAKEFILE ON)
# CMake version check
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(MaCh3 VERSION 1.3.4 LANGUAGES CXX)
project(MaCh3 VERSION 1.4.0 LANGUAGES CXX)
set(MaCh3_VERSION ${PROJECT_VERSION})

#LP - This option name is confusing, but I wont change it now.
Expand Down
17 changes: 6 additions & 11 deletions Diagnostics/CombineMaCh3Chains.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
// C++ includes
#include <unistd.h>

// MaCh3 includes
#include "manager/manager.h"
#include "samplePDF/Structs.h"

_MaCh3_Safe_Include_Start_ //{
// ROOT includes
#include "TList.h"
#include "TFile.h"
Expand All @@ -17,10 +15,7 @@
#include "TFileMerger.h"
#include "TKey.h"
#include "TROOT.h"
#pragma GCC diagnostic pop

// MaCh3 includes
#include "manager/manager.h"
_MaCh3_Safe_Include_End_ //}

/// @file CombineMaCh3Chains
/// @author Ewan Miller
Expand Down
2 changes: 1 addition & 1 deletion Diagnostics/DiagMCMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void DiagMCMC(const std::string& inputFile, const std::string& config)
{
MACH3LOG_INFO("File for study: {}", inputFile);

YAML::Node Settings = YAML::LoadFile(config);
YAML::Node Settings = M3OpenConfig(config);

// Make the processor
auto Processor = std::make_unique<MCMCProcessor>(inputFile);
Expand Down
23 changes: 7 additions & 16 deletions Diagnostics/GetPenaltyTerm.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
// MaCh3 includes
#include "manager/manager.h"
#include "samplePDF/Structs.h"

_MaCh3_Safe_Include_Start_ //{
// ROOT includes
#include "TFile.h"
#include "TBranch.h"
Expand All @@ -22,14 +20,7 @@
#include "TColor.h"
#include "TObjString.h"
#include "TROOT.h"
#pragma GCC diagnostic pop

#ifdef MULTITHREAD
#include "omp.h"
#endif

#include "manager/manager.h"

_MaCh3_Safe_Include_End_ //}

/// @file GetPenaltyTerm.cpp
/// @brief KS: This file contains the implementation of the function to extract specific penalty terms from systematic chains.
Expand Down Expand Up @@ -85,7 +76,7 @@ void ReadXSecFile(const std::string& inputFile)
XSecFile["Systematics"] = YAML::Node(YAML::NodeType::Sequence);
for(unsigned int i = 0; i < XsecCovPos.size(); i++)
{
YAML::Node YAMLDocTemp = YAML::LoadFile(XsecCovPos[i]);
YAML::Node YAMLDocTemp = M3OpenConfig(XsecCovPos[i]);
for (const auto& item : YAMLDocTemp["Systematics"]) {
XSecFile["Systematics"].push_back(item);
}
Expand Down
18 changes: 9 additions & 9 deletions Diagnostics/ProcessMCMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void ProcessMCMC(const std::string& inputFile)
// Make the processor)
auto Processor = std::make_unique<MCMCProcessor>(inputFile);

YAML::Node card_yaml = YAML::LoadFile(config.c_str());
YAML::Node card_yaml = M3OpenConfig(config.c_str());
YAML::Node Settings = card_yaml["ProcessMCMC"];

const bool PlotCorr = GetFromManager<bool>(Settings["PlotCorr"], false);
Expand Down Expand Up @@ -152,7 +152,7 @@ void ProcessMCMC(const std::string& inputFile)

void MultipleProcessMCMC()
{
YAML::Node card_yaml = YAML::LoadFile(config.c_str());
YAML::Node card_yaml = M3OpenConfig(config.c_str());
YAML::Node Settings = card_yaml["ProcessMCMC"];

constexpr Color_t PosteriorColor[] = {kBlue-1, kRed, kGreen+2};
Expand Down Expand Up @@ -318,7 +318,7 @@ void MultipleProcessMCMC()
// KS: Calculate Bayes factor for a given hypothesis, most informative are those related to osc params. However, it make relative easy interpretation for switch dials
void CalcBayesFactor(const std::unique_ptr<MCMCProcessor>& Processor)
{
YAML::Node card_yaml = YAML::LoadFile(config.c_str());
YAML::Node card_yaml = M3OpenConfig(config.c_str());
YAML::Node Settings = card_yaml["ProcessMCMC"];

std::vector<std::string> ParNames;
Expand All @@ -338,7 +338,7 @@ void CalcBayesFactor(const std::unique_ptr<MCMCProcessor>& Processor)

void CalcSavageDickey(const std::unique_ptr<MCMCProcessor>& Processor)
{
YAML::Node card_yaml = YAML::LoadFile(config.c_str());
YAML::Node card_yaml = M3OpenConfig(config.c_str());
YAML::Node Settings = card_yaml["ProcessMCMC"];

std::vector<std::string> ParNames;
Expand All @@ -356,7 +356,7 @@ void CalcSavageDickey(const std::unique_ptr<MCMCProcessor>& Processor)

void CalcParameterEvolution(const std::unique_ptr<MCMCProcessor>& Processor)
{
YAML::Node card_yaml = YAML::LoadFile(config.c_str());
YAML::Node card_yaml = M3OpenConfig(config.c_str());
YAML::Node Settings = card_yaml["ProcessMCMC"];

std::vector<std::string> ParNames;
Expand All @@ -371,7 +371,7 @@ void CalcParameterEvolution(const std::unique_ptr<MCMCProcessor>& Processor)

void CalcBipolarPlot(const std::unique_ptr<MCMCProcessor>& Processor)
{
YAML::Node card_yaml = YAML::LoadFile(config.c_str());
YAML::Node card_yaml = M3OpenConfig(config.c_str());
YAML::Node Settings = card_yaml["ProcessMCMC"];

std::vector<std::string> ParNames;
Expand All @@ -383,7 +383,7 @@ void CalcBipolarPlot(const std::unique_ptr<MCMCProcessor>& Processor)
}

void GetTrianglePlot(const std::unique_ptr<MCMCProcessor>& Processor) {
YAML::Node card_yaml = YAML::LoadFile(config.c_str());
YAML::Node card_yaml = M3OpenConfig(config.c_str());
YAML::Node Settings = card_yaml["ProcessMCMC"];

for (const auto& dg : Settings["TrianglePlot"])
Expand Down Expand Up @@ -433,7 +433,7 @@ void DiagnoseCovarianceMatrix(const std::unique_ptr<MCMCProcessor>& Processor, c
Canvas->Print(Form("Correlation_%s.pdf[", OutName.c_str()), "pdf");
Canvas->Print(Form("Covariance_%s.pdf[", OutName.c_str()), "pdf");

YAML::Node card_yaml = YAML::LoadFile(config.c_str());
YAML::Node card_yaml = M3OpenConfig(config.c_str());
YAML::Node Settings = card_yaml["ProcessMCMC"];

const int entries = int(Processor->GetnSteps());
Expand Down Expand Up @@ -579,7 +579,7 @@ void DiagnoseCovarianceMatrix(const std::unique_ptr<MCMCProcessor>& Processor, c

void ReweightPrior(const std::unique_ptr<MCMCProcessor>& Processor)
{
YAML::Node card_yaml = YAML::LoadFile(config.c_str());
YAML::Node card_yaml = M3OpenConfig(config.c_str());
YAML::Node Settings = card_yaml["ProcessMCMC"];

const auto& Prior = Settings["PriorReweighting"];
Expand Down
21 changes: 6 additions & 15 deletions Diagnostics/RHat.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
// MaCh3 includes
#include "manager/manager.h"
#include "samplePDF/Structs.h"

_MaCh3_Safe_Include_Start_ //{
// ROOT includes
#include "TObjArray.h"
#include "TChain.h"
Expand All @@ -20,14 +18,7 @@
#include "TColor.h"
#include "TStyle.h"
#include "TROOT.h"
#pragma GCC diagnostic pop

#ifdef MULTITHREAD
#include "omp.h"
#endif

// MaCh3 includes
#include "manager/manager.h"
_MaCh3_Safe_Include_End_ //}

/// @file RHat.cpp
/// @brief This executable calculates the \f$ \hat{R} \f$ estimator for Markov Chain Monte Carlo (MCMC) convergence.
Expand Down
21 changes: 6 additions & 15 deletions Diagnostics/RHat_HighMem.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
// MaCh3 includes
#include "manager/manager.h"
#include "samplePDF/Structs.h"

_MaCh3_Safe_Include_Start_ //{
// ROOT includes
#include "TObjArray.h"
#include "TChain.h"
Expand All @@ -20,14 +18,7 @@
#include "TColor.h"
#include "TStyle.h"
#include "TROOT.h"
#pragma GCC diagnostic pop

#ifdef MULTITHREAD
#include "omp.h"
#endif

// MaCh3 includes
#include "manager/manager.h"
_MaCh3_Safe_Include_End_ //}

/// @file RHat.cpp
/// @brief This executable calculates the \f$ \hat{R} \f$ estimator for Markov Chain Monte Carlo (MCMC) convergence.
Expand Down
2 changes: 1 addition & 1 deletion Doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "MaCh3"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.3.4
PROJECT_NUMBER = 1.4.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 2 additions & 0 deletions Doc/MaCh3DockerFiles/Rocky9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ FROM kamilskwarczynski/nukamil:latest AS mach3_build
# Add a label for the author
LABEL maintainer="The MaCh3 Collaboration"
LABEL website="https://mach3-software.github.io/MaCh3/"
LABEL compiler="GNU 11.4.1"
LABEL root_version="v6.30.04"
LABEL org.opencontainers.image.description="Official MaCh3 container"

# Declare the build argument
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ The following fitting algorithms are available:
| MINUIT2 | [Ref](https://cds.cern.ch/record/2296388/) | Yes |
| PSO | [Ref](https://doi.org/10.1162/EVCO_r_00180) | No |


## Debug
Several debugging options are available which are heavy for RAM and performance and, therefore not used by default. To enable it:
```bash
Expand Down Expand Up @@ -160,6 +159,7 @@ Based on several test here are recommended version:
| Fedora32 ||
| CentOS7 ||
| Windows ||
| MacOS ||

✅ - Part of CI/CD <br>
❔ - Not part of CI/CD but used by some users/developers so it might work <br>
Expand Down
16 changes: 11 additions & 5 deletions cmake/Templates/setup.MaCh3.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,19 @@ function add_to_PYTHONPATH () {
d=$(cd -- "$d" && { pwd -P || pwd; }) 2>/dev/null # canonicalize symbolic links
if [ -z "$d" ]; then continue; fi # skip nonexistent directory

case ":$PYTHONPATH:" in
*":$d:"*) :;;
*) export PYTHONPATH=$d:$PYTHONPATH;;
esac
if [ "$d" == "/usr/bin" ] || [ "$d" == "/usr/bin64" ] || [ "$d" == "/usr/local/bin" ] || [ "$d" == "/usr/local/bin64" ]; then
case ":$PYTHONPATH:" in
*":$d:"*) :;;
*) export PYTHONPATH=$PYTHONPATH:$d;;
esac
else
case ":$PYTHONPATH:" in
*":$d:"*) :;;
*) export PYTHONPATH=$d:$PYTHONPATH;;
esac
fi
done
}

fi


Expand Down
Loading

0 comments on commit 431a39f

Please sign in to comment.