Skip to content

Commit

Permalink
Merge branch 'release/v3_15_00'
Browse files Browse the repository at this point in the history
  • Loading branch information
knoepfel committed Apr 25, 2024
2 parents 6c925ef + b1ec60e commit 8bb6dcb
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 57 deletions.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/gripe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Gripe
description: Describe a bug, problem, or annoyance that doesn't have a simple reproducer
labels: ["best effort"]
title: "[Gripe]: "
body:
- type: markdown
attributes:
value: |
* **If you are able to define a minimal reproducer for the issue, please use a different issue type.**
* **Gripes will be dealt with on a "best effort" basis only, and cannot be high priority.**
* **Multiple iterations may be necessary to understand your issue well enough to posit a remedy.**
- type: textarea
id: gripe-details
attributes:
label: Details
placeholder: Please describe your issue in as much detail as possible.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
cmake_minimum_required(VERSION 3.19 FATAL_ERROR)

find_package(cetmodules 2.13.00 REQUIRED)
project(art VERSION 3.14.04 LANGUAGES CXX C)
project(art VERSION 3.15.00 LANGUAGES CXX C)

include(CetCMakeEnv)
cet_cmake_env()
Expand Down
4 changes: 2 additions & 2 deletions art/Framework/Core/Modifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ namespace art {

class Modifier : public ModuleBase, private ProductRegistryHelper {
public:
template <typename UserConfig, typename UserKeysToIgnore = void>
template <typename UserConfig, typename... UserKeysToIgnore>
using Table =
ProducerTable<UserConfig, detail::ModuleConfig, UserKeysToIgnore>;
ProducerTable<UserConfig, detail::ModuleConfig, UserKeysToIgnore...>;

~Modifier() noexcept;
Modifier();
Expand Down
9 changes: 3 additions & 6 deletions art/Framework/Core/ProducerTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
#include <string>

namespace art {

template <typename UserConfig,
typename ImplicitConfig,
typename UserKeysToIgnore = void>
typename... UserKeysToIgnore>
class ProducerTable : public fhicl::ConfigurationTable {
private: // TYPES
template <typename T, typename U = ImplicitConfig>
Expand All @@ -26,11 +25,9 @@ namespace art {
fhicl::TableFragment<T> user;
};

using KeysToIgnore_t = std::conditional_t<
std::is_void<UserKeysToIgnore>::value,
typename ImplicitConfig::IgnoreKeys,
using KeysToIgnore_t =
fhicl::KeysToIgnore<typename ImplicitConfig::IgnoreKeys,
UserKeysToIgnore>>;
UserKeysToIgnore...>;

public: // MEMBER FUNCTIONS -- Special Member Functions
explicit ProducerTable(fhicl::Name&& name) : fullConfig_{std::move(name)} {}
Expand Down
5 changes: 3 additions & 2 deletions art/Framework/Core/ResultsProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ namespace art {

ResultsProducer() noexcept(false);

template <typename UserConfig, typename KeysToIgnore = void>
using Table = ProducerTable<UserConfig, detail::PluginConfig, KeysToIgnore>;
template <typename UserConfig, typename... KeysToIgnore>
using Table =
ProducerTable<UserConfig, detail::PluginConfig, KeysToIgnore...>;

void doBeginJob();
void doEndJob();
Expand Down
2 changes: 1 addition & 1 deletion art/Framework/Core/TriggerPathsExecutor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ namespace art {
TDEBUG_END_FUNC_SI(4, scheduleID);
return;
}
auto pathsDoneTask = std::make_shared<WaitingTask>(
auto pathsDoneTask = make_waiting_task(
PathsDoneTask{this, endPathTask, event_principal, taskGroup_},
triggerPathsInfo_.paths().size());
for (auto& path : triggerPathsInfo_.paths()) {
Expand Down
9 changes: 4 additions & 5 deletions art/Framework/Core/detail/Analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace art {
namespace art::detail {
class Analyzer : public Observer {
public:
template <typename UserConfig, typename UserKeysToIgnore = void>
template <typename UserConfig, typename... UserKeysToIgnore>
class Table : public fhicl::ConfigurationTable {
template <typename T>
struct FullConfig {
Expand All @@ -42,10 +42,9 @@ namespace art::detail {
fhicl::TableFragment<T> user;
};

using KeysToIgnore_t = std::conditional_t<
std::is_void<UserKeysToIgnore>::value,
ModuleConfig::IgnoreKeys,
fhicl::KeysToIgnore<ModuleConfig::IgnoreKeys, UserKeysToIgnore>>;
using KeysToIgnore_t =
fhicl::KeysToIgnore<typename ModuleConfig::IgnoreKeys,
UserKeysToIgnore...>;

public:
explicit Table(fhicl::Name&& name) : fullConfig_{std::move(name)} {}
Expand Down
4 changes: 2 additions & 2 deletions art/Framework/Core/detail/Producer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace art::detail {

class Producer : public Modifier {
public:
template <typename UserConfig, typename KeysToIgnore = void>
using Table = Modifier::Table<UserConfig, KeysToIgnore>;
template <typename UserConfig, typename... KeysToIgnore>
using Table = Modifier::Table<UserConfig, KeysToIgnore...>;

virtual ~Producer() noexcept;
explicit Producer(fhicl::ParameterSet const&);
Expand Down
65 changes: 49 additions & 16 deletions art/Framework/IO/ProductMix/MixHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ art::operator<<(std::ostream& os, MixHelper::Mode const mode)
switch (mode) {
case MixHelper::Mode::SEQUENTIAL:
return os << "SEQUENTIAL";
case MixHelper::Mode::RANDOM_OFFSET:
return os << "RANDOM_OFFSET";
case MixHelper::Mode::RANDOM_REPLACE:
return os << "RANDOM_REPLACE";
case MixHelper::Mode::RANDOM_LIM_REPLACE:
return os << "RANDOM_LIM_REPLACE";
case MixHelper::Mode::RANDOM_NO_REPLACE:
return os << "RANDOM_NO_REPLACE";
case MixHelper::Mode::UNKNOWN:
return os << "UNKNOWN";
// No default so compiler can warn.
}
return os;
Expand Down Expand Up @@ -189,6 +189,27 @@ art::MixHelper::createEngine(seed_t const seed,
seed, kind_of_engine_to_make, engine_label);
}

bool
art::MixHelper::overThreshold_(size_t const nSecondaries,
size_t const nEventsInFile) const
{
switch (readMode_) {
case Mode::SEQUENTIAL:
[[fallthrough]];
case Mode::RANDOM_OFFSET:
[[fallthrough]];
case Mode::RANDOM_NO_REPLACE:
return nEventsReadThisFile_ + nSecondaries > nEventsInFile;
case Mode::RANDOM_REPLACE:
[[fallthrough]];
case Mode::RANDOM_LIM_REPLACE:
return nEventsReadThisFile_ + nSecondaries >
nEventsInFile * coverageFraction_;
}
assert(false); // unreachable
return false;
}

bool
art::MixHelper::generateEventSequence(size_t const nSecondaries,
EntryNumberSequence& enSeq,
Expand All @@ -201,12 +222,7 @@ art::MixHelper::generateEventSequence(size_t const nSecondaries,
}

auto const nEventsInFile = ioHandle_->nEventsInFile();
bool const over_threshold =
(readMode_ == Mode::SEQUENTIAL || readMode_ == Mode::RANDOM_NO_REPLACE) ?
((nEventsReadThisFile_ + nSecondaries) > nEventsInFile) :
((nEventsReadThisFile_ + nSecondaries) >
(nEventsInFile * coverageFraction_));
if (over_threshold) {
if (overThreshold_(nSecondaries, nEventsInFile)) {
if (!providerFunc_) {
++nOpensOverThreshold_;
if (nOpensOverThreshold_ > filenames_.size()) {
Expand All @@ -215,11 +231,13 @@ art::MixHelper::generateEventSequence(size_t const nSecondaries,
"the current event.\n"}
<< "The number of requested secondaries (" << nSecondaries
<< ") exceeds the number of events in any\n"
<< "of the files specified for product mixing. For a read mode of '"
<< "of the files specified for product mixing. For a read mode of "
"'"
<< readMode_ << "',\n"
<< "the framework does not currently allow product-mixing to span "
"multiple secondary\n"
<< "input files for a given event. Please contact [email protected] "
<< "input files for a given event. Please contact "
"[email protected] "
"for more information.\n";
}
}
Expand All @@ -233,13 +251,15 @@ art::MixHelper::generateEventSequence(size_t const nSecondaries,
nOpensOverThreshold_ = {};
switch (readMode_) {
case Mode::SEQUENTIAL:
[[fallthrough]];
case Mode::RANDOM_OFFSET:
enSeq.resize(nSecondaries);
std::iota(begin(enSeq), end(enSeq), nEventsReadThisFile_);
break;
case Mode::RANDOM_REPLACE:
std::generate_n(
std::back_inserter(enSeq), nSecondaries, [this, nEventsInFile] {
return dist_.get()->fireInt(nEventsInFile);
return dist_->fireInt(nEventsInFile);
});
std::sort(enSeq.begin(), enSeq.end());
break;
Expand All @@ -250,7 +270,7 @@ art::MixHelper::generateEventSequence(size_t const nSecondaries,
std::generate_n(
std::inserter(entries, entries.begin()),
nSecondaries - entries.size(),
[this, nEventsInFile] { return dist_.get()->fireInt(nEventsInFile); });
[this, nEventsInFile] { return dist_->fireInt(nEventsInFile); });
}
enSeq.assign(cbegin(entries), cend(entries));
std::sort(begin(enSeq), end(enSeq));
Expand Down Expand Up @@ -367,8 +387,9 @@ art::MixHelper::initReadMode_(std::string const& mode) const -> Mode
{
// These regexes must correspond by index to the valid Mode enumerator
// values.
static std::regex const robjs[4]{
static std::regex const robjs[5]{
std::regex("^seq", std::regex_constants::icase),
std::regex("^randomoffset$", std::regex_constants::icase),
std::regex("^random(replace)?$", std::regex_constants::icase),
std::regex("^randomlimreplace$", std::regex_constants::icase),
std::regex("^randomnoreplace$", std::regex_constants::icase)};
Expand All @@ -384,11 +405,25 @@ art::MixHelper::initReadMode_(std::string const& mode) const -> Mode
<< "Unrecognized value of readMode parameter: \"" << mode
<< "\". Valid values are:\n"
<< " sequential,\n"
<< " randomOffset,\n"
<< " randomReplace (random is accepted for reasons of legacy),\n"
<< " randomLimReplace,\n"
<< " randomNoReplace.\n";
}

size_t
art::MixHelper::eventOffset_(size_t nEventsInFile)
{
if (readMode_ == Mode::SEQUENTIAL && eventsToSkip_) {
return eventsToSkip_();
}
if (readMode_ == Mode::RANDOM_OFFSET and not randomOffsetUsed_) {
randomOffsetUsed_ = true;
return dist_->fireInt(nEventsInFile);
}
return 0;
}

bool
art::MixHelper::openNextFile_()
{
Expand Down Expand Up @@ -416,10 +451,8 @@ art::MixHelper::openNextFile_()
}
filename = *fileIter_;
}
nEventsReadThisFile_ = (readMode_ == Mode::SEQUENTIAL && eventsToSkip_) ?
eventsToSkip_() :
0; // Reset for this file.
ioHandle_->openAndReadMetaData(filename, mixOps_);
nEventsReadThisFile_ = eventOffset_(ioHandle_->nEventsInFile());

eventIDIndex_ = buildEventIDIndex(ioHandle_->fileIndex());
auto transMap = buildProductIDTransMap(mixOps_);
Expand Down
27 changes: 24 additions & 3 deletions art/Framework/IO/ProductMix/MixHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
// are:
//
// sequential -- read the secondary events in order
// randomOffset -- sequential but starting from a random location
// in the file
// randomReplace -- random with replacement
// randomLimReplace -- events unique within a primary event
// randomNoReplace -- events guaranteed to be used once only.
Expand Down Expand Up @@ -248,18 +250,34 @@ namespace art {
public:
enum class Mode {
SEQUENTIAL = 0,
RANDOM_OFFSET,
RANDOM_REPLACE,
RANDOM_LIM_REPLACE,
RANDOM_NO_REPLACE,
UNKNOWN
RANDOM_NO_REPLACE
};

struct Config {
fhicl::Sequence<std::string> filenames{fhicl::Name{"fileNames"}, {}};
fhicl::Atom<bool> compactMissingProducts{
fhicl::Name{"compactMissingProducts"},
false};
fhicl::Atom<std::string> readMode{fhicl::Name{"readMode"}, "sequential"};
fhicl::Atom<std::string> readMode{
fhicl::Name{"readMode"},
fhicl::Comment{R"(The readMode parameter specifies how secondary events
should be chosen from each file. Valid values are:
- "sequential" (default)
read the secondary events in order
- "randomOffset"
sequential but starting from a random location in the file
- "randomReplace"
random with replacement
- "randomLimReplace"
events unique within a primary event
- "randomNoReplace"
events guaranteed to be used once only
)"},
"sequential"};
fhicl::Atom<double> coverageFraction{fhicl::Name{"coverageFraction"},
1.0};
fhicl::Atom<bool> wrapFiles{fhicl::Name{"wrapFiles"}, false};
Expand Down Expand Up @@ -386,7 +404,9 @@ namespace art {
cet::exempt_ptr<base_engine_t> engine) const;
bool consistentRequest_(std::string const& kind_of_engine_to_make,
label_t const& engine_label) const;
bool overThreshold_(size_t nSecondaries, size_t nEventsInFile) const;
Mode initReadMode_(std::string const& mode) const;
size_t eventOffset_(size_t nEventsInFile);
bool openNextFile_();

ProdToProdMapBuilder::ProductIDTransMap buildProductIDTransMap_(
Expand All @@ -413,6 +433,7 @@ namespace art {
EntryNumberSequence shuffledSequence_{}; // RANDOM_NO_REPLACE only.
bool haveSubRunMixOps_{false};
bool haveRunMixOps_{false};
bool randomOffsetUsed_{false}; // RANDOM_OFFSET only.
EventIDIndex eventIDIndex_{};

std::unique_ptr<MixIOPolicy> ioHandle_{nullptr};
Expand Down
4 changes: 4 additions & 0 deletions art/Framework/Services/Optional/detail/LinuxMallInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ namespace art {

class LinuxMallInfo {
public:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// FIXME: The 'mallinfo()' function is deprecated for AL9.
LinuxMallInfo() : minfo_(mallinfo()) {}
#pragma GCC diagnostic pop

struct mallinfo
get() const
Expand Down
9 changes: 4 additions & 5 deletions art/Utilities/ToolConfigTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace art {
};
};

template <typename UserConfig, typename UserKeysToIgnore = void>
template <typename UserConfig, typename... UserKeysToIgnore>
class ToolConfigTable : public fhicl::ConfigurationTable {
public:
ToolConfigTable(fhicl::Name&& name) : fullConfig_{std::move(name)} {}
Expand Down Expand Up @@ -56,10 +56,9 @@ namespace art {
fhicl::TableFragment<T> user;
};

using KeysToIgnore_t = std::conditional_t<
std::is_void<UserKeysToIgnore>::value,
MinimalToolConfig::KeysToIgnore,
fhicl::KeysToIgnore<MinimalToolConfig::KeysToIgnore, UserKeysToIgnore>>;
using KeysToIgnore_t =
fhicl::KeysToIgnore<typename MinimalToolConfig::KeysToIgnore,
UserKeysToIgnore...>;

fhicl::Table<FullConfig<UserConfig>, KeysToIgnore_t> fullConfig_;
cet::exempt_ptr<fhicl::detail::ParameterBase const>
Expand Down
Loading

0 comments on commit 8bb6dcb

Please sign in to comment.