Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions FWCore/Framework/src/EventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
#include <iostream>
#include <utility>
#include <sstream>
#include <ranges>

#include <sys/ipc.h>
#include <sys/msg.h>
Expand Down Expand Up @@ -546,7 +547,7 @@ namespace edm {
actReg_->prePrincipalsCreationSignal_.emit();
auto guard = makeGuard([this]() { actReg_->postPrincipalsCreationSignal_.emit(); });
principalCache_.setNumberOfConcurrentPrincipals(preallocations_);
for (unsigned int index = 0; index < preallocations_.numberOfStreams(); ++index) {
for (auto index : std::views::iota(0U, preallocations_.numberOfStreams())) {
// Reusable event principal
auto ep = std::make_shared<EventPrincipal>(preg(),
productResolversFactory::makePrimary,
Expand All @@ -559,7 +560,7 @@ namespace edm {
principalCache_.insert(std::move(ep));
}

for (unsigned int index = 0; index < preallocations_.numberOfRuns(); ++index) {
for (auto index : std::views::iota(0U, preallocations_.numberOfRuns())) {
auto rp = std::make_unique<RunPrincipal>(preg(),
productResolversFactory::makePrimary,
*processConfiguration_,
Expand All @@ -569,7 +570,7 @@ namespace edm {
principalCache_.insert(std::move(rp));
}

for (unsigned int index = 0; index < preallocations_.numberOfLuminosityBlocks(); ++index) {
for (auto index : std::views::iota(0U, preallocations_.numberOfLuminosityBlocks())) {
auto lp = std::make_unique<LuminosityBlockPrincipal>(
preg(), productResolversFactory::makePrimary, *processConfiguration_, historyAppender_.get(), index);
principalCache_.insert(std::move(lp));
Expand Down Expand Up @@ -772,7 +773,7 @@ namespace edm {
using namespace edm::waiting_task::chain;
{
WaitingTaskHolder taskHolder(group, &finalWaitingTask);
for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) {
for (auto i : std::views::iota(0U, preallocations_.numberOfStreams())) {
first([this, i](auto nextTask) {
std::exception_ptr exceptionPtr;
{
Expand All @@ -798,7 +799,7 @@ namespace edm {
using namespace edm::waiting_task::chain;
{
WaitingTaskHolder taskHolder(group, &finalWaitingTask);
for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) {
for (auto i : std::views::iota(0U, preallocations_.numberOfStreams())) {
first([this, i, &collector, &collectorMutex](auto nextTask) {
{
ServiceRegistry::Operate operate(serviceToken_);
Expand Down Expand Up @@ -1332,7 +1333,7 @@ namespace edm {

CMS_SA_ALLOW try {
streamQueuesInserter_.push(*holder.group(), [this, status, holder]() mutable {
for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) {
for (auto i : std::views::iota(0U, preallocations_.numberOfStreams())) {
CMS_SA_ALLOW try {
streamQueues_[i].push(*holder.group(), [this, i, status, holder]() mutable {
streamBeginRunAsync(i, std::move(status), std::move(holder));
Expand Down Expand Up @@ -1443,7 +1444,7 @@ namespace edm {
}
ServiceRegistry::Operate operate(serviceToken_);
streamQueuesInserter_.push(*nextTask.group(), [this, nextTask]() mutable {
for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) {
for (auto i : std::views::iota(0U, preallocations_.numberOfStreams())) {
CMS_SA_ALLOW try {
streamQueues_[i].push(*nextTask.group(), [this, i, nextTask]() mutable {
streamQueues_[i].pause();
Expand Down Expand Up @@ -1757,7 +1758,7 @@ namespace edm {
using Traits = OccurrenceTraits<LuminosityBlockPrincipal, TransitionActionStreamBegin>;

streamQueuesInserter_.push(*holder.group(), [this, status, holder, &es]() mutable {
for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) {
for (auto i : std::views::iota(0U, preallocations_.numberOfStreams())) {
streamQueues_[i].push(*holder.group(), [this, i, status, holder, &es]() mutable {
if (!status->shouldStreamStartLumi()) {
return;
Expand Down Expand Up @@ -1962,7 +1963,7 @@ namespace edm {
streamLumiStatus_[0]->setCleaningUpAfterException(cleaningUpAfterException);
{
WaitingTaskHolder holder{taskGroup_, &globalWaitTask};
for (unsigned int i = 0; i < preallocations_.numberOfStreams(); ++i) {
for (auto i : std::views::iota(0U, preallocations_.numberOfStreams())) {
streamEndLumiAsync(holder, i);
}
}
Expand Down
27 changes: 16 additions & 11 deletions FWCore/Framework/src/Schedule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <set>
#include <exception>
#include <sstream>
#include <ranges>

#include "make_shared_noexcept_false.h"
#include "processEDAliases.h"
Expand Down Expand Up @@ -100,18 +101,20 @@ namespace edm {
vstring scheduledPaths = proc_pset.getParameter<vstring>("@paths");
std::set<std::string> modulesOnPaths;
{
std::set<std::string> noEndPaths(scheduledPaths.begin(), scheduledPaths.end());
for (auto const& endPath : end_path_name_list) {
noEndPaths.erase(endPath);
}
{
vstring labels;
for (auto const& path : noEndPaths) {
labels = proc_pset.getParameter<vstring>(path);
modulesOnPaths.insert(labels.begin(), labels.end());
}
auto getModuleLabelsOfPath = [&](auto const& lbl) {
return proc_pset.getParameter<std::vector<std::string>>(lbl);
};
auto notEndPath = [&](auto const& lbl) {
return std::ranges::find(end_path_name_list, lbl) == end_path_name_list.end();
};

auto tmp = scheduledPaths | std::views::filter(notEndPath) | std::views::transform(getModuleLabelsOfPath) |
std::views::join;
for (auto const& modLabel : tmp) {
modulesOnPaths.insert(modLabel);
Comment on lines +113 to +114
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would

Suggested change
for (auto const& modLabel : tmp) {
modulesOnPaths.insert(modLabel);
modulesOnPaths.insert(std::ranges::begin(tmp), std::ranges::end(tmp));

work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't compile. the types returned by std::ranges::begin and std::ranges::end do not identical.

}
}

//Initially fill labelsToBeDropped with all module mentioned in
// the configuration but which are not being used by the system
std::vector<std::string> labelsToBeDropped;
Expand Down Expand Up @@ -144,7 +147,9 @@ namespace edm {
labelsToBeDropped.begin(), labelsToBeDropped.begin() + sizeBeforeOutputModules, labelsToBeDropped.end());

// drop the parameter sets used to configure the modules
for_all(labelsToBeDropped, std::bind(&ParameterSet::eraseOrSetUntrackedParameterSet, std::ref(proc_pset), _1));
for (auto& label : labelsToBeDropped) {
proc_pset.eraseOrSetUntrackedParameterSet(label);
}

// drop the labels from @all_modules
vstring::iterator endAfterRemove =
Expand Down