Skip to content

Commit 8529cc9

Browse files
Merge release-next into main
2 parents fc0059c + 5ac5173 commit 8529cc9

File tree

10 files changed

+95
-142
lines changed

10 files changed

+95
-142
lines changed

CMakePresets.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@
5959
"inherits": [
6060
"ci-default",
6161
"conda"
62-
],
63-
"cacheVariables": {
64-
"PROFILE_ALGORITHM_LINUX": "ON"
65-
}
62+
]
6663
},
6764
{
6865
"name": "win-64-ci",
@@ -123,10 +120,7 @@
123120
"inherits": [
124121
"unix-debug",
125122
"conda"
126-
],
127-
"cacheVariables": {
128-
"PROFILE_ALGORITHM_LINUX": "ON"
129-
}
123+
]
130124
},
131125
{
132126
"name": "win-vs-2019",

Framework/API/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(SRC_FILES
22
src/ADSValidator.cpp
33
src/Algorithm.cpp
4+
src/AlgorithmExecuteProfile.cpp
45
src/AlgorithmFactory.cpp
56
src/AlgorithmFactoryObserver.cpp
67
src/AlgorithmHasProperty.cpp
@@ -10,6 +11,7 @@ set(SRC_FILES
1011
src/AlgorithmProperties.cpp
1112
src/AlgorithmProperty.cpp
1213
src/AlgorithmRuntimeProps.cpp
14+
src/AlgoTimeRegister.cpp
1315
src/AnalysisDataService.cpp
1416
src/AnalysisDataServiceObserver.cpp
1517
src/ArchiveSearchFactory.cpp
@@ -375,6 +377,7 @@ set(TEST_FILES
375377
AlgorithmPropertyTest.h
376378
AlgorithmRuntimePropsTest.h
377379
AlgorithmTest.h
380+
AlgoTimeRegisterTest.h
378381
AnalysisDataServiceObserverTest.h
379382
AnalysisDataServiceTest.h
380383
AsynchronousTest.h
@@ -483,15 +486,6 @@ set(TEST_FILES
483486
WorkspaceUnitValidatorTest.h
484487
)
485488

486-
option(PROFILE_ALGORITHM_LINUX "Profile algorithm execution on Linux" OFF)
487-
if(PROFILE_ALGORITHM_LINUX)
488-
set(SRC_FILES "${SRC_FILES}" "src/AlgorithmExecuteProfile.cpp" "src/AlgoTimeRegister.cpp")
489-
set(INC_FILES "${INC_FILES}" "inc/MantidAPI/AlgoTimeRegister.h")
490-
set(TEST_FILES "${TEST_FILES}" "AlgoTimeRegisterTest.h")
491-
else()
492-
set(SRC_FILES "${SRC_FILES}" "src/AlgorithmExecute.cpp")
493-
endif()
494-
495489
set(GMOCK_TEST_FILES ImplicitFunctionFactoryTest.h ImplicitFunctionParameterParserFactoryTest.h MatrixWorkspaceTest.h)
496490

497491
if(COVERAGE)

Framework/API/src/AlgorithmExecute.cpp

Lines changed: 0 additions & 30 deletions
This file was deleted.

Framework/API/test/AlgoTimeRegisterTest.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
using Mantid::Instrumentation::AlgoTimeRegister;
2020
using Mantid::Kernel::ConfigService;
21-
using std::filesystem::exists;
22-
using std::filesystem::remove_all;
2321

2422
class AlgoTimeRegisterTest : public CxxTest::TestSuite {
2523
public:
@@ -34,16 +32,19 @@ class AlgoTimeRegisterTest : public CxxTest::TestSuite {
3432
};
3533

3634
AlgoTimeRegisterTest() {
37-
if (mkdir(m_directory.c_str(), 0777) == -1) {
35+
36+
const auto &path = m_directory.c_str();
37+
if (!std::filesystem::create_directory(path)) {
3838
std::cerr << "Error : " << strerror(errno) << std::endl;
3939
}
40+
std::filesystem::permissions(path, std::filesystem::perms::owner_write, std::filesystem::perm_options::add);
4041
ConfigService::Instance().setString("performancelog.filename", m_directory + "test.log");
4142
ConfigService::Instance().setString("performancelog.write", "On");
4243
AlgoTimeRegister::Instance();
4344
}
4445

4546
~AlgoTimeRegisterTest() override {
46-
remove_all(m_directory);
47+
std::filesystem::remove_all(m_directory);
4748
ConfigService::Instance().setString("performancelog.filename", "");
4849
ConfigService::Instance().setString("performancelog.write", "Off");
4950
}
@@ -186,7 +187,7 @@ class AlgoTimeRegisterTest : public CxxTest::TestSuite {
186187

187188
// Add the time entry
188189
AlgoTimeRegister::Instance().addTime("TestAlgorithm", startTime, endTime);
189-
TS_ASSERT(!exists(m_directory + "noWrite.log"));
190+
TS_ASSERT(!std::filesystem::exists(m_directory + "noWrite.log"));
190191
}
191192

192193
private:

Framework/PythonInterface/mantid/api/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set(EXPORT_FILES
88
src/Exports/IAlgorithm.cpp
99
src/Exports/AlgorithmObserver.cpp
1010
src/Exports/AlgorithmHistory.cpp
11+
src/Exports/AlgoTimeRegister.cpp
1112
src/Exports/CatalogManager.cpp
1213
src/Exports/CatalogSession.cpp
1314
src/Exports/DeprecatedAlgorithmChecker.cpp
@@ -90,10 +91,6 @@ set(EXPORT_FILES
9091
src/Exports/RegionSelectorObserver.cpp
9192
)
9293

93-
if(PROFILE_ALGORITHM_LINUX)
94-
set(EXPORT_FILES "${EXPORT_FILES}" "src/Exports/AlgoTimeRegister.cpp")
95-
endif()
96-
9794
set(MODULE_DEFINITION ${CMAKE_CURRENT_BINARY_DIR}/api.cpp)
9895
create_module(${MODULE_TEMPLATE} ${MODULE_DEFINITION} ${EXPORT_FILES})
9996

Framework/PythonInterface/mantid/api/_aliases.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
Defines a set of aliases to make accessing certain objects easier
99
"""
1010

11-
import sys
12-
1311
from mantid.api import (
1412
AlgorithmFactoryImpl,
1513
AlgorithmManagerImpl,
14+
AlgoTimeRegisterImpl,
1615
AnalysisDataServiceImpl,
1716
CatalogManagerImpl,
1817
FileFinderImpl,
@@ -43,12 +42,6 @@
4342
FunctionFactory = lazy_instance_access(FunctionFactoryImpl)
4443
WorkspaceFactory = lazy_instance_access(WorkspaceFactoryImpl)
4544
CatalogManager = lazy_instance_access(CatalogManagerImpl)
46-
if sys.platform.startswith("linux"):
47-
try:
48-
from mantid.api import AlgoTimeRegisterImpl
49-
50-
AlgoTimeRegister = lazy_instance_access(AlgoTimeRegisterImpl)
51-
except:
52-
AlgoTimeRegister = None
45+
AlgoTimeRegister = lazy_instance_access(AlgoTimeRegisterImpl)
5346
# backwards-compatible
5447
mtd = AnalysisDataService

Framework/PythonInterface/mantid/api/src/Exports/AlgoTimeRegister.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using namespace Mantid::Instrumentation;
1616
using namespace boost::python;
1717
using Mantid::Kernel::time_point_ns;
1818

19-
void addTimeWrapper(const std::string &name, long int begin, long int end) {
19+
void addTimeWrapper(const std::string &name, size_t begin, size_t end) {
2020

2121
std::chrono::nanoseconds begin_ns(begin);
2222
std::chrono::nanoseconds end_ns(end);

0 commit comments

Comments
 (0)