-
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 benchmarking #37
Conversation
…gle benchmark tool as a dependency
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index bd0a15c..43c0288 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -10 +10,3 @@ Tensor buildPMNS(const Tensor &theta12, const Tensor &theta13, const Tensor &the
- Tensor M1, M2, M3;
+ Tensor M1;
+ Tensor M2;
+ Tensor M3;
@@ -73 +75,4 @@ static void BM_vacuumOscillations(benchmark::State &state)
- Tensor theta23, theta13, theta12, deltaCP;
+ Tensor theta23;
+ Tensor theta13;
+ Tensor theta12;
+ Tensor deltaCP;
Have any feedback or feature suggestions? Share it here.
@@ -0,0 +1,99 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:97:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
^
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
No concerns from clang-format.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index bd0a15c..43c0288 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -10 +10,3 @@ Tensor buildPMNS(const Tensor &theta12, const Tensor &theta13, const Tensor &the
- Tensor M1, M2, M3;
+ Tensor M1;
+ Tensor M2;
+ Tensor M3;
@@ -73 +75,4 @@ static void BM_vacuumOscillations(benchmark::State &state)
- Tensor theta23, theta13, theta12, deltaCP;
+ Tensor theta23;
+ Tensor theta13;
+ Tensor theta12;
+ Tensor deltaCP;
Have any feedback or feature suggestions? Share it here.
Tensor buildPMNS(const Tensor &theta12, const Tensor &theta13, const Tensor &theta23, const Tensor &deltaCP) | ||
{ | ||
// set up the three matrices to build the PMNS matrix | ||
Tensor M1; |
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 diagnostics
- multiple declarations in a single statement reduces readability [readability-isolate-declaration]
Tensor M1; | |
Tensor M1; | |
Tensor M2; | |
Tensor M3; |
masses.ones({1, 3}, NTdtypes::kFloat).requiresGrad(false); | ||
masses.setValue({0, 0}, 0.1); | ||
masses.setValue({0, 1}, 0.2); | ||
masses.setValue({0, 2}, 0.3); |
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 diagnostics
- multiple declarations in a single statement reduces readability [readability-isolate-declaration]
masses.setValue({0, 2}, 0.3); | |
Tensor theta23; | |
Tensor theta13; | |
Tensor theta12; | |
Tensor deltaCP; |
@@ -0,0 +1,104 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
for (auto _ : state) | ||
{ | ||
// This code gets timed | ||
batchedOscProbs(vacuumProp, energies, state.range(0), state.range(1)); |
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
benchmarks/benchmarks.cpp:97:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
^
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.
Have any feedback or feature suggestions? Share it here.
@@ -0,0 +1,104 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:102:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
^
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.
Have any feedback or feature suggestions? Share it here.
@@ -0,0 +1,104 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:102:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 3f15833..73765b7 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
^
benchmarks/benchmarks.cpp
Outdated
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 3f15833..73765b7 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
^
benchmarks/benchmarks.cpp
Outdated
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 3f15833..73765b7 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10});
^
benchmarks/benchmarks.cpp
Outdated
BENCHMARK(BM_vacuumOscillations)->Name("Vacuum Osc")->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Osc")->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
^
benchmarks/benchmarks.cpp
Outdated
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
^
benchmarks/benchmarks.cpp
Outdated
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
^
benchmarks/benchmarks.cpp
Outdated
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
^
benchmarks/benchmarks.cpp
Outdated
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
^
benchmarks/benchmarks.cpp
Outdated
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
^
benchmarks/benchmarks.cpp
Outdated
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
^
benchmarks/benchmarks.cpp
Outdated
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 22848af..b1c069e 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
benchmarks/benchmarks.cpp
Outdated
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10});
^
benchmarks/benchmarks.cpp
Outdated
BENCHMARK(BM_vacuumOscillations)->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Args({1 << 10, 1 << 10});
^
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.
Click here for the full clang-tidy patch
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index e866ee4..1a8fe0a 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -127 +127 @@ static void BM_constMatterOscillations(benchmark::State &state)
- std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
+ std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6);
Have any feedback or feature suggestions? Share it here.
|
||
// set up the propagator | ||
Propagator matterProp(3, 100.0); | ||
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
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 diagnostics
- variable 'matterSolver' is not initialized [cppcoreguidelines-init-variables]
std::unique_ptr<BaseMatterSolver> matterSolver = std::make_unique<ConstDensityMatterSolver>(3, 2.6); | |
std::unique_ptr<BaseMatterSolver> matterSolver = 0 = std::make_unique<ConstDensityMatterSolver>(3, 2.6); |
@@ -0,0 +1,149 @@ | |||
|
|||
#include <benchmark/benchmark.h> |
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
benchmarks/benchmarks.cpp:2:10: error: [clang-diagnostic-error]
'benchmark/benchmark.h' file not found
#include <benchmark/benchmark.h>
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:53:80: warning: 10000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
energies.setValue({i, 0}, ((float)std::rand() / (float)RAND_MAX) * 10000.0);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:71:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:72:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:73:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:79:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:80:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:81:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:82:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:92:16: warning: 123 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
std::srand(123);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:110:29: warning: 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 0}, 0.1);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:111:29: warning: 0.2 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 1}, 0.2);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:112:29: warning: 0.3 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
masses.setValue({0, 2}, 0.3);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:118:82: warning: 0.23 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta23.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.23);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:119:82: warning: 0.13 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta13.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.13);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:120:82: warning: 0.12 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
theta12.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.12);
^
/home/runner/work/nuTens/nuTens/benchmarks/benchmarks.cpp:121:82: warning: 0.5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
deltaCP.ones({1}, NTdtypes::kComplexFloat).requiresGrad(false).setValue({0}, 0.5);
^
} | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_vacuumOscillations)->Name("Vacuul Oscillations")->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:143:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_vacuumOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_vacuumOscillations)->Name("Vacuul Oscillations")->Args({1 << 10, 1 << 10});
^
BENCHMARK(BM_vacuumOscillations)->Name("Vacuul Oscillations")->Args({1 << 10, 1 << 10}); | ||
|
||
// Register the function as a benchmark | ||
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Oscillations")->Args({1 << 10, 1 << 10}); |
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
benchmarks/benchmarks.cpp:146:11: warning: [cppcoreguidelines-avoid-non-const-global-variables]
variable 'BM_constMatterOscillations' is non-const and globally accessible, consider making it const
BENCHMARK(BM_constMatterOscillations)->Name("Const Density Oscillations")->Args({1 << 10, 1 << 10});
^
Add benchmarking and integrate it using actions so it gets run on every pull request to main. Currently benchmark is pretty simple and consists of just calculating osc probabilities for 1024 batches of 1024 neutrino energies in vacuum and in constant density matter.
For some reason nuTens cannot link with the benchmark library when running in Github actions. This works fine locally so I can't figure out what's going on. Leaving as is for now and will fix in future so that benchmarking can be done in CI.