-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature instrumentation profiling #35
Conversation
…ptions for the project a bit
Codecov ReportAll modified and coverable lines are covered by tests ✅ ❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
No concerns from clang-format.
Only 13 out of 15 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/nuTens/instrumentation.hpp b/nuTens/instrumentation.hpp
index f302e6c..6bab99e 100644
--- a/nuTens/instrumentation.hpp
+++ b/nuTens/instrumentation.hpp
@@ -7,0 +8 @@
+#include <utility>
@@ -48 +49 @@ class ProfileWriter
- ProfileWriter() : _name(""), _profileCount(0)
+ ProfileWriter()
@@ -84 +85 @@ class ProfileWriter
- _outputStream << "\"cat\":\"function\",";
+ _outputStream << R"("cat":"function",)";
@@ -86,2 +87,2 @@ class ProfileWriter
- _outputStream << "\"name\":\"" << name << "\",";
- _outputStream << "\"ph\":\"X\",";
+ _outputStream << R"("name":")" << name << "\",";
+ _outputStream << R"("ph":"X",)";
@@ -99 +100 @@ class ProfileWriter
- _outputStream << "{\"otherData\": {},\"traceEvents\":[";
+ _outputStream << R"({"otherData": {},"traceEvents":[)";
@@ -121 +122 @@ class ProfileWriter
- uint _profileCount;
+ uint _profileCount{0};
@@ -137 +138 @@ class InstrumentationTimer
- InstrumentationTimer(const std::string &name) : _name(name), _stopped(false)
+ InstrumentationTimer(std::string name) : _name(std::move(name)), _stopped(false)
@@ -145 +146 @@ class InstrumentationTimer
- if (!_stopped)
+ if (!_stopped) {
@@ -146,0 +148 @@ class InstrumentationTimer
+}
diff --git a/nuTens/propagator/const-density-solver.hpp b/nuTens/propagator/const-density-solver.hpp
index 26c87ee..e275f02 100644
--- a/nuTens/propagator/const-density-solver.hpp
+++ b/nuTens/propagator/const-density-solver.hpp
@@ -45 +45 @@ class ConstDensityMatterSolver : public BaseMatterSolver
- inline void setPMNS(const Tensor &newPMNS)
+ inline void setPMNS(const Tensor &newPMNS) override
@@ -58 +58 @@ class ConstDensityMatterSolver : public BaseMatterSolver
- inline void setMasses(const Tensor &newMasses)
+ inline void setMasses(const Tensor &newMasses) override
@@ -81 +81 @@ class ConstDensityMatterSolver : public BaseMatterSolver
- void calculateEigenvalues(const Tensor &energies, Tensor &eigenvectors, Tensor &eigenvalues);
+ void calculateEigenvalues(const Tensor &energies, Tensor &eigenvectors, Tensor &eigenvalues) override;
Have any feedback or feature suggestions? Share it here.
uint _profileCount; | ||
}; | ||
|
||
class InstrumentationTimer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
nuTens/instrumentation.hpp:124:7: warning: [cppcoreguidelines-special-member-functions]
class 'InstrumentationTimer' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator
class InstrumentationTimer
^
@@ -91,6 +94,7 @@ class Propagator | |||
/// @param value The new value | |||
inline void setPMNS(const std::vector<int> &indices, std::complex<float> value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
nuTens/propagator/propagator.hpp:95:2: warning: [clang-diagnostic-delete-abstract-non-virtual-dtor]
delete called on 'BaseMatterSolver' that is abstract but has non-virtual destructor
delete __ptr;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:396:4: note: in instantiation of member function 'std::default_delete<BaseMatterSolver>::operator()' requested here
get_deleter()(std::move(__ptr));
^
/home/runner/work/nuTens/nuTens/nuTens/propagator/propagator.hpp:30:5: note: in instantiation of member function 'std::unique_ptr<BaseMatterSolver>::~unique_ptr' requested here
Propagator(int nGenerations, float baseline) : _baseline(baseline), _nGenerations(nGenerations){};
^
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Click here for the full clang-format patch
diff --git a/nuTens/instrumentation.hpp b/nuTens/instrumentation.hpp
index b9127e3..fb0746a 100644
--- a/nuTens/instrumentation.hpp
+++ b/nuTens/instrumentation.hpp
@@ -48 +48 @@ class ProfileWriter
- ProfileWriter()
+ ProfileWriter()
@@ -145 +145,2 @@ class InstrumentationTimer
- if (!_stopped) {
+ if (!_stopped)
+ {
@@ -146,0 +148 @@ class InstrumentationTimer
+ }
@@ -148 +149,0 @@ class InstrumentationTimer
-}
Only 3 out of 5 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/nuTens/instrumentation.hpp b/nuTens/instrumentation.hpp
index b9127e3..d5dda3d 100644
--- a/nuTens/instrumentation.hpp
+++ b/nuTens/instrumentation.hpp
@@ -49,2 +49 @@ class ProfileWriter
- {
- }
+ = default;
diff --git a/nuTens/propagator/const-density-solver.hpp b/nuTens/propagator/const-density-solver.hpp
index 3ff1e48..e275f02 100644
--- a/nuTens/propagator/const-density-solver.hpp
+++ b/nuTens/propagator/const-density-solver.hpp
@@ -81 +81 @@ class ConstDensityMatterSolver : public BaseMatterSolver
- void calculateEigenvalues(const Tensor &energies, Tensor &eigenvectors, Tensor &eigenvalues);
+ void calculateEigenvalues(const Tensor &energies, Tensor &eigenvectors, Tensor &eigenvalues) override;
Have any feedback or feature suggestions? Share it here.
nuTens/instrumentation.hpp
Outdated
if (!_stopped) { | ||
stop(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format suggestions
Please remove the line(s)
- 148
uint _profileCount{0}; | ||
}; | ||
|
||
class InstrumentationTimer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
nuTens/instrumentation.hpp:124:7: warning: [cppcoreguidelines-special-member-functions]
class 'InstrumentationTimer' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator
class InstrumentationTimer
^
@@ -91,6 +94,7 @@ class Propagator | |||
/// @param value The new value | |||
inline void setPMNS(const std::vector<int> &indices, std::complex<float> value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
nuTens/propagator/propagator.hpp:95:2: warning: [clang-diagnostic-delete-abstract-non-virtual-dtor]
delete called on 'BaseMatterSolver' that is abstract but has non-virtual destructor
delete __ptr;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:396:4: note: in instantiation of member function 'std::default_delete<BaseMatterSolver>::operator()' requested here
get_deleter()(std::move(__ptr));
^
/home/runner/work/nuTens/nuTens/nuTens/propagator/propagator.hpp:30:5: note: in instantiation of member function 'std::unique_ptr<BaseMatterSolver>::~unique_ptr' requested here
Propagator(int nGenerations, float baseline) : _baseline(baseline), _nGenerations(nGenerations){};
^
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Click here for the full clang-format patch
diff --git a/nuTens/instrumentation.hpp b/nuTens/instrumentation.hpp
index a42c9ac..494e941 100644
--- a/nuTens/instrumentation.hpp
+++ b/nuTens/instrumentation.hpp
@@ -48,2 +48 @@ class ProfileWriter
- ProfileWriter()
- = default;
+ ProfileWriter() = default;
@@ -147 +145,0 @@ class InstrumentationTimer
- }
@@ -148,0 +147 @@ class InstrumentationTimer
+ }
Only 2 out of 4 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/nuTens/propagator/const-density-solver.hpp b/nuTens/propagator/const-density-solver.hpp
index 3ff1e48..e275f02 100644
--- a/nuTens/propagator/const-density-solver.hpp
+++ b/nuTens/propagator/const-density-solver.hpp
@@ -81 +81 @@ class ConstDensityMatterSolver : public BaseMatterSolver
- void calculateEigenvalues(const Tensor &energies, Tensor &eigenvectors, Tensor &eigenvalues);
+ void calculateEigenvalues(const Tensor &energies, Tensor &eigenvectors, Tensor &eigenvalues) override;
Have any feedback or feature suggestions? Share it here.
nuTens/instrumentation.hpp
Outdated
ProfileWriter() | ||
= default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format suggestions
ProfileWriter() | |
= default; | |
ProfileWriter() = default; |
uint _profileCount{0}; | ||
}; | ||
|
||
class InstrumentationTimer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
nuTens/instrumentation.hpp:123:7: warning: [cppcoreguidelines-special-member-functions]
class 'InstrumentationTimer' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator
class InstrumentationTimer
^
@@ -91,6 +94,7 @@ class Propagator | |||
/// @param value The new value | |||
inline void setPMNS(const std::vector<int> &indices, std::complex<float> value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
nuTens/propagator/propagator.hpp:95:2: warning: [clang-diagnostic-delete-abstract-non-virtual-dtor]
delete called on 'BaseMatterSolver' that is abstract but has non-virtual destructor
delete __ptr;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:396:4: note: in instantiation of member function 'std::default_delete<BaseMatterSolver>::operator()' requested here
get_deleter()(std::move(__ptr));
^
/home/runner/work/nuTens/nuTens/nuTens/propagator/propagator.hpp:30:5: note: in instantiation of member function 'std::unique_ptr<BaseMatterSolver>::~unique_ptr' requested here
Propagator(int nGenerations, float baseline) : _baseline(baseline), _nGenerations(nGenerations){};
^
Cpp-Linter Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
No concerns from clang-format.
Only 2 out of 4 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/nuTens/propagator/const-density-solver.hpp b/nuTens/propagator/const-density-solver.hpp
index 3ff1e48..e275f02 100644
--- a/nuTens/propagator/const-density-solver.hpp
+++ b/nuTens/propagator/const-density-solver.hpp
@@ -81 +81 @@ class ConstDensityMatterSolver : public BaseMatterSolver
- void calculateEigenvalues(const Tensor &energies, Tensor &eigenvectors, Tensor &eigenvalues);
+ void calculateEigenvalues(const Tensor &energies, Tensor &eigenvectors, Tensor &eigenvalues) override;
Have any feedback or feature suggestions? Share it here.
uint _profileCount{0}; | ||
}; | ||
|
||
class InstrumentationTimer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
nuTens/instrumentation.hpp:122:7: warning: [cppcoreguidelines-special-member-functions]
class 'InstrumentationTimer' defines a non-default destructor and a copy constructor but does not define a copy assignment operator, a move constructor or a move assignment operator
class InstrumentationTimer
^
@@ -91,6 +94,7 @@ class Propagator | |||
/// @param value The new value | |||
inline void setPMNS(const std::vector<int> &indices, std::complex<float> value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
nuTens/propagator/propagator.hpp:95:2: warning: [clang-diagnostic-delete-abstract-non-virtual-dtor]
delete called on 'BaseMatterSolver' that is abstract but has non-virtual destructor
delete __ptr;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:396:4: note: in instantiation of member function 'std::default_delete<BaseMatterSolver>::operator()' requested here
get_deleter()(std::move(__ptr));
^
/home/runner/work/nuTens/nuTens/nuTens/propagator/propagator.hpp:30:5: note: in instantiation of member function 'std::unique_ptr<BaseMatterSolver>::~unique_ptr' requested here
Propagator(int nGenerations, float baseline) : _baseline(baseline), _nGenerations(nGenerations){};
^
Add in new instrumentation library.
Currently supports instrumented code profiling:
If built with -DNT_PROFILING=ON then tests will output a -profile.json that can be placed into chrome tracing to get something like