Mantid
Loading...
Searching...
No Matches
SerialAlgorithm.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
8
9namespace Mantid::API {
10
11Parallel::ExecutionMode
12SerialAlgorithm::getParallelExecutionMode(const std::map<std::string, Parallel::StorageMode> &storageModes) const {
13 using namespace Parallel;
14 const auto nonMasterOnly = std::find_if(storageModes.cbegin(), storageModes.cend(), [](const auto &element) {
15 return element.second != StorageMode::MasterOnly;
16 });
17 if (nonMasterOnly != storageModes.cend()) {
18 throw std::runtime_error(nonMasterOnly->first + " must have " + Parallel::toString(StorageMode::MasterOnly));
19 }
20 return getCorrespondingExecutionMode(StorageMode::MasterOnly);
21}
22
23} // namespace Mantid::API
Parallel::ExecutionMode getParallelExecutionMode(const std::map< std::string, Parallel::StorageMode > &storageModes) const override
Get correct execution mode based on input storage modes for an MPI run.