diff --git a/CMakeLists.txt b/CMakeLists.txt
index 81731f7be..1543bd119 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@ if (CMAKE_VERSION GREATER_EQUAL "3.3")
cmake_policy(SET CMP0167 NEW)
endif ()
-project(musrfit VERSION 1.11.0 LANGUAGES C CXX)
+project(musrfit VERSION 1.11.1 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
diff --git a/ChangeLog b/ChangeLog
index e6626faa4..0009ab1ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,12 @@ or
https://bitbucket.org/muonspin/musrfit
+Release of V1.11.1, 2026/06/07
+==============================
+
+allow from musredit (via preferences) to select the number of threads to be used
+for fitting.
+
Release of V1.11.0, 2026/05/28
==============================
diff --git a/src/musredit_qt5/musredit/PAdmin.cpp b/src/musredit_qt5/musredit/PAdmin.cpp
index 649f9c55d..598e51fc6 100644
--- a/src/musredit_qt5/musredit/PAdmin.cpp
+++ b/src/musredit_qt5/musredit/PAdmin.cpp
@@ -168,6 +168,8 @@ bool PAdminXMLParser::startElement()
fKeyWord = eEstimateN0;
} else if (qName == "yaml_out") {
fKeyWord = eYamlOut;
+ } else if (qName == "use_no_of_threads") {
+ fKeyWord = eNoOfTreadsToBeUsed;
} else if (qName == "chisq_per_run_block") {
fKeyWord = eChisqPreRunBlock;
} else if (qName == "path_file_name") {
@@ -420,6 +422,11 @@ bool PAdminXMLParser::characters()
fAdmin->fMsr2DataParam.perRunBlockChisq = flag;
fAdmin->setChisqPerRunBlockFlag(flag);
break;
+ case eNoOfTreadsToBeUsed:
+ ival = QString(str.toLatin1()).trimmed().toInt(&ok);
+ if (ok)
+ fAdmin->setNoOfThreadsToBeUsed(ival);
+ break;
case eRecentFile:
fAdmin->addRecentFile(QString(str.toLatin1()).trimmed());
break;
@@ -993,6 +1000,9 @@ int PAdmin::savePrefs(QString pref_fln)
else
data[i] = " n";
}
+ if (data[i].contains("") && data[i].contains("")) {
+ data[i] = " " + QString("%1").arg(fNoOfThreadsToBeUsed) + "";
+ }
if (data[i].contains("") && data[i].contains("")) {
if (fMusrviewShowFourier)
data[i] = " y";
diff --git a/src/musredit_qt5/musredit/PAdmin.h b/src/musredit_qt5/musredit/PAdmin.h
index d1bf5e5c2..929ce264f 100644
--- a/src/musredit_qt5/musredit/PAdmin.h
+++ b/src/musredit_qt5/musredit/PAdmin.h
@@ -70,7 +70,7 @@ class PAdminXMLParser
private:
enum EAdminKeyWords {eEmpty, eTimeout, eKeepMinuit2Output, eDumpAscii, eDumpRoot,
- eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eYamlOut,
+ eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eYamlOut, eNoOfTreadsToBeUsed,
eMusrviewShowFourier, eMusrviewShowAvg, eMusrviewShowOneToOne, eEnableMusrT0,
eDarkThemeIconsMenu, eDarkThemeIconsToolbar, eIgnoreThemeAutoDetection, eEditW, eEditH,
eFontName, eFontSize, eExecPath, eDefaultSavePath,
@@ -128,6 +128,7 @@ class PAdmin : public QObject
bool getDumpRootFlag() { return fDumpRoot; }
bool getEstimateN0Flag() { return fEstimateN0; }
bool getYamlOutFlag() { return fYamlOut; }
+ int getNoOfThreadsToBeUsed() { return fNoOfThreadsToBeUsed; }
bool getChisqPerRunBlockFlag() { return fChisqPreRunBlock; }
bool getIgnoreThemeAutoDetection() { return fIgnoreThemeAutoDetection; }
bool getDarkThemeIconsMenuFlag() { return fDarkThemeIconsMenu; }
@@ -158,6 +159,7 @@ class PAdmin : public QObject
void setDumpRootFlag(const bool flag) { fDumpRoot = flag; }
void setEstimateN0Flag(const bool flag) { fEstimateN0 = flag; }
void setYamlOutFlag(const bool flag) { fYamlOut = flag; }
+ void setNoOfThreadsToBeUsed(const int num) { fNoOfThreadsToBeUsed = num; }
void setChisqPerRunBlockFlag(const bool flag) { fChisqPreRunBlock = flag; }
void setIgnoreThemeAutoDetection(const bool flag) { fIgnoreThemeAutoDetection = flag; }
void setDarkThemeIconsMenuFlag(const bool flag) { fDarkThemeIconsMenu = flag; }
@@ -209,6 +211,7 @@ class PAdmin : public QObject
bool fChisqPreRunBlock{false}; ///< flag indicating if musrfit shall write 'per run block' chisq to the msr-file (default: no).
bool fEstimateN0{true}; ///< flag indicating if musrfit shall estimate N0 for single histogram fits (default: yes).
bool fYamlOut{false}; ///< flag indicating if the MINUIT2.OUTPUT file should also be written as .yaml output. (default: no).
+ int fNoOfThreadsToBeUsed{1}; ///< number of threads to be used
bool fEnableMusrT0{true}; ///< flag indicating if musrT0 shall be enabled at startup from within musredit (default: yes).
bool fIgnoreThemeAutoDetection{false}; ///< flag indicating that the theme autodetection shall be ignored. (default: no)
bool fDarkThemeIconsMenu{false}; ///< flag indicating if dark theme icons shall be used in the menu (default: no)
diff --git a/src/musredit_qt5/musredit/PPrefsDialog.cpp b/src/musredit_qt5/musredit/PPrefsDialog.cpp
index d239b8d0e..c8dcf5d60 100644
--- a/src/musredit_qt5/musredit/PPrefsDialog.cpp
+++ b/src/musredit_qt5/musredit/PPrefsDialog.cpp
@@ -28,6 +28,7 @@
***************************************************************************/
#include
+#include // for # of threads
#include "PChangeDefaultPathsDialog.h"
#include "PPrefsDialog.h"
@@ -90,6 +91,15 @@ PPrefsDialog::PPrefsDialog(PAdmin *admin) : fAdmin(admin)
fTimeout_lineEdit->setText(QString("%1").arg(fAdmin->getTimeout()));
fTimeout_lineEdit->setValidator(new QIntValidator(fTimeout_lineEdit));
+ // get number of threads info from the systems
+ long nprocs = sysconf(_SC_NPROCESSORS_ONLN);
+ if (fAdmin->getNoOfThreadsToBeUsed() > nprocs)
+ fAdmin->setNoOfThreadsToBeUsed(nprocs);
+ for (auto i=0; iaddItem(QString("%1").arg(i+1));
+ fNumberOfThreads_comboBox->setCurrentIndex(fAdmin->getNoOfThreadsToBeUsed()-1);
+ QObject::connect(fNumberOfThreads_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(numberOfThreadsChanged(int)));
+
QObject::connect(fDefaultPath_pushButton, SIGNAL(clicked()), this, SLOT(handleDefaultPaths()));
}
@@ -145,6 +155,17 @@ void PPrefsDialog::handleDefaultPaths()
}
}
+//----------------------------------------------------------------------------------------------------
+/**
+ * @brief Slot: keeps the number of threads to be used for fitting.
+ *
+ * @param idx index of the comboBox
+ */
+void PPrefsDialog::numberOfThreadsChanged(int idx)
+{
+ fAdmin->setNoOfThreadsToBeUsed(idx+1);
+}
+
//----------------------------------------------------------------------------------------------------
// END
//----------------------------------------------------------------------------------------------------
diff --git a/src/musredit_qt5/musredit/PPrefsDialog.h b/src/musredit_qt5/musredit/PPrefsDialog.h
index 8e911df12..7a282d59f 100644
--- a/src/musredit_qt5/musredit/PPrefsDialog.h
+++ b/src/musredit_qt5/musredit/PPrefsDialog.h
@@ -66,6 +66,7 @@ class PPrefsDialog : public QDialog, private Ui::PPrefsDialog
void dumpAscii();
void dumpRoot();
void handleDefaultPaths();
+ void numberOfThreadsChanged(int idx);
private:
PAdmin *fAdmin;
diff --git a/src/musredit_qt5/musredit/PTextEdit.cpp b/src/musredit_qt5/musredit/PTextEdit.cpp
index 2c9b563c2..391892dec 100644
--- a/src/musredit_qt5/musredit/PTextEdit.cpp
+++ b/src/musredit_qt5/musredit/PTextEdit.cpp
@@ -2162,6 +2162,11 @@ void PTextEdit::musrFit()
cmd.append("--yaml");
}
+ // check how many threads to be used
+ cmd.append("--use-no-of-threads");
+ QString noThreads = QString("%1").arg(fAdmin->getNoOfThreadsToBeUsed());
+ cmd.append(noThreads);
+
// check per-run-block-chisq flag
if (fAdmin->getChisqPerRunBlockFlag()) {
cmd.append("--per-run-block-chisq");
diff --git a/src/musredit_qt5/musredit/musredit_startup.xml.in b/src/musredit_qt5/musredit/musredit_startup.xml.in
index 35cab9590..6e2fe2f9e 100644
--- a/src/musredit_qt5/musredit/musredit_startup.xml.in
+++ b/src/musredit_qt5/musredit/musredit_startup.xml.in
@@ -15,6 +15,7 @@
n
y
n
+ 1024
n
n
n
diff --git a/src/musredit_qt6/musredit/PAdmin.cpp b/src/musredit_qt6/musredit/PAdmin.cpp
index c6c003b99..c36fa398f 100644
--- a/src/musredit_qt6/musredit/PAdmin.cpp
+++ b/src/musredit_qt6/musredit/PAdmin.cpp
@@ -212,6 +212,8 @@ bool PAdminXMLParser::startElement()
fKeyWord = eEstimateN0;
} else if (qName == "yaml_out") {
fKeyWord = eYamlOut;
+ } else if (qName == "use_no_of_threads") {
+ fKeyWord = eNoOfTreadsToBeUsed;
} else if (qName == "chisq_per_run_block") {
fKeyWord = eChisqPreRunBlock;
} else if (qName == "path_file_name") {
@@ -469,6 +471,11 @@ bool PAdminXMLParser::characters()
fAdmin->fMsr2DataParam.yamlOut = flag;
fAdmin->setYamlOutFlag(flag);
break;
+ case eNoOfTreadsToBeUsed:
+ ival = QString(str.toLatin1()).trimmed().toInt(&ok);
+ if (ok)
+ fAdmin->setNoOfThreadsToBeUsed(ival);
+ break;
case eChisqPreRunBlock:
if (str == "y")
flag = true;
@@ -1134,6 +1141,9 @@ int PAdmin::savePrefs(QString pref_fln)
else
data[i] = " n";
}
+ if (data[i].contains("") && data[i].contains("")) {
+ data[i] = " " + QString("%1").arg(fNoOfThreadsToBeUsed) + "";
+ }
if (data[i].contains("") && data[i].contains("")) {
if (fMusrviewShowFourier)
data[i] = " y";
diff --git a/src/musredit_qt6/musredit/PAdmin.h b/src/musredit_qt6/musredit/PAdmin.h
index d3bf0a106..250864a76 100644
--- a/src/musredit_qt6/musredit/PAdmin.h
+++ b/src/musredit_qt6/musredit/PAdmin.h
@@ -143,7 +143,7 @@ class PAdminXMLParser
* The parser uses these to determine how to process element content.
*/
enum EAdminKeyWords {eEmpty, eTimeout, eKeepMinuit2Output, eDumpAscii, eDumpRoot,
- eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eYamlOut,
+ eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eYamlOut, eNoOfTreadsToBeUsed,
eMusrviewShowFourier, eMusrviewShowAvg, eMusrviewShowOneToOne, eEnableMusrT0,
eIgnoreThemeAutoDetection, eDarkThemeIconsMenu, eDarkThemeIconsToolbar, eEditW, eEditH,
eFontName, eFontSize, eExecPath, eDefaultSavePath,
@@ -225,6 +225,7 @@ class PAdmin : public QObject
bool getMusrviewShowOneToOneFlag() { return fMusrviewShowOneToOne; } ///< Check if one-to-one theory display is enabled.
bool getEnableMusrT0Flag() { return fEnableMusrT0; } ///< Check if musrT0 is enabled.
bool getYamlOutFlag() { return fYamlOut; } ///< Check if YAML output is enabled.
+ int getNoOfThreadsToBeUsed() { return fNoOfThreadsToBeUsed; } ///< Get number of threads to be used
bool getKeepMinuit2OutputFlag() { return fKeepMinuit2Output; } ///< Check if MINUIT2 output files are preserved.
bool getDumpAsciiFlag() { return fDumpAscii; } ///< Check if ASCII dump is enabled.
bool getDumpRootFlag() { return fDumpRoot; } ///< Check if ROOT dump is enabled.
@@ -264,6 +265,7 @@ class PAdmin : public QObject
void setDumpRootFlag(const bool flag) { fDumpRoot = flag; } ///< Enable/disable ROOT dump.
void setEstimateN0Flag(const bool flag) { fEstimateN0 = flag; } ///< Enable/disable N0 estimation.
void setYamlOutFlag(const bool flag) { fYamlOut = flag; } ///< Enable/disable YAML output.
+ void setNoOfThreadsToBeUsed(const int num) { fNoOfThreadsToBeUsed = num; } ///< set number of threads to be used
void setChisqPerRunBlockFlag(const bool flag) { fChisqPreRunBlock = flag; } ///< Enable/disable per-run-block chi-square.
void setIgnoreThemeAutoDetection(const bool flag) { fIgnoreThemeAutoDetection = flag; } ///< Enable/disable theme auto-detection.
void setDarkThemeIconsMenuFlag(const bool flag) { fDarkThemeIconsMenu = flag; } ///< Enable/disable dark theme menu icons.
@@ -356,6 +358,7 @@ class PAdmin : public QObject
bool fChisqPreRunBlock{false}; ///< If true, write per-run-block chi-square values to msr-file.
bool fEstimateN0{true}; ///< If true, estimate N0 parameter for single histogram fits.
bool fYamlOut{false}; ///< If true, write MINUIT2 output additionally as \.yaml.
+ int fNoOfThreadsToBeUsed{1}; ///< number of threads to be used
/** @} */
/** @name MSR File Defaults
diff --git a/src/musredit_qt6/musredit/PPrefsDialog.cpp b/src/musredit_qt6/musredit/PPrefsDialog.cpp
index 3004c8267..33d53357a 100644
--- a/src/musredit_qt6/musredit/PPrefsDialog.cpp
+++ b/src/musredit_qt6/musredit/PPrefsDialog.cpp
@@ -45,6 +45,7 @@
*/
#include
+#include // for # of threads
#include "PChangeDefaultPathsDialog.h"
#include "PPrefsDialog.h"
@@ -164,6 +165,15 @@ PPrefsDialog::PPrefsDialog(PAdmin *admin) : fAdmin(admin)
fTimeout_lineEdit->setText(QString("%1").arg(fAdmin->getTimeout()));
fTimeout_lineEdit->setValidator(new QIntValidator(fTimeout_lineEdit));
+ // get number of threads info from the systems
+ long nprocs = sysconf(_SC_NPROCESSORS_ONLN);
+ if (fAdmin->getNoOfThreadsToBeUsed() > nprocs)
+ fAdmin->setNoOfThreadsToBeUsed(nprocs);
+ for (auto i=0; iaddItem(QString("%1").arg(i+1));
+ fNumberOfThreads_comboBox->setCurrentIndex(fAdmin->getNoOfThreadsToBeUsed()-1);
+ QObject::connect(fNumberOfThreads_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(numberOfThreadsChanged(int)));
+
QObject::connect(fDefaultPath_pushButton, SIGNAL(clicked()), this, SLOT(handleDefaultPaths()));
}
@@ -340,6 +350,17 @@ void PPrefsDialog::handleDefaultPaths()
}
}
+//----------------------------------------------------------------------------------------------------
+/**
+ * @brief Slot: keeps the number of threads to be used for fitting.
+ *
+ * @param idx index of the comboBox
+ */
+void PPrefsDialog::numberOfThreadsChanged(int idx)
+{
+ fAdmin->setNoOfThreadsToBeUsed(idx+1);
+}
+
//----------------------------------------------------------------------------------------------------
// END
//----------------------------------------------------------------------------------------------------
diff --git a/src/musredit_qt6/musredit/PPrefsDialog.h b/src/musredit_qt6/musredit/PPrefsDialog.h
index 1489e571f..d3c8670ae 100644
--- a/src/musredit_qt6/musredit/PPrefsDialog.h
+++ b/src/musredit_qt6/musredit/PPrefsDialog.h
@@ -318,6 +318,13 @@ class PPrefsDialog : public QDialog, private Ui::PPrefsDialog
*/
void handleDefaultPaths();
+ /**
+ * @brief Slot: called when the current index of the number of threads to be used has changed
+ *
+ * @param idx index of the comboBox
+ */
+ void numberOfThreadsChanged(int idx);
+
private:
PAdmin *fAdmin; ///< Pointer to global administration object storing all preferences.
};
diff --git a/src/musredit_qt6/musredit/PTextEdit.cpp b/src/musredit_qt6/musredit/PTextEdit.cpp
index 9e9f31aff..d1a1db9c0 100644
--- a/src/musredit_qt6/musredit/PTextEdit.cpp
+++ b/src/musredit_qt6/musredit/PTextEdit.cpp
@@ -2273,6 +2273,11 @@ void PTextEdit::musrFit()
cmd.append("--yaml");
}
+ // check how many threads to be used
+ cmd.append("--use-no-of-threads");
+ QString noThreads = QString("%1").arg(fAdmin->getNoOfThreadsToBeUsed());
+ cmd.append(noThreads);
+
// check per-run-block-chisq flag
if (fAdmin->getChisqPerRunBlockFlag()) {
cmd.append("--per-run-block-chisq");
diff --git a/src/musredit_qt6/musredit/forms/PPrefsDialog.ui b/src/musredit_qt6/musredit/forms/PPrefsDialog.ui
index 3cacd6a8a..ef6d0eeed 100644
--- a/src/musredit_qt6/musredit/forms/PPrefsDialog.ui
+++ b/src/musredit_qt6/musredit/forms/PPrefsDialog.ui
@@ -3,7 +3,7 @@
PPrefsDialog
- Qt::WindowModal
+ Qt::WindowModality::WindowModal
@@ -26,13 +26,13 @@
-
- 0
+ 1
general
-
+
11
@@ -57,7 +57,7 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -97,7 +97,7 @@
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -117,7 +117,7 @@
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -225,6 +225,28 @@
yaml out
+
+
+
+ 10
+ 90
+ 291
+ 34
+
+
+
+ -
+
+
+ -
+
+
+ # threads to be used
+
+
+
+
+
@@ -302,7 +324,7 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
diff --git a/src/musredit_qt6/musredit/musredit_startup.xml.in b/src/musredit_qt6/musredit/musredit_startup.xml.in
index 35cab9590..6e2fe2f9e 100644
--- a/src/musredit_qt6/musredit/musredit_startup.xml.in
+++ b/src/musredit_qt6/musredit/musredit_startup.xml.in
@@ -15,6 +15,7 @@
n
y
n
+ 1024
n
n
n