Skip to content

Commit 374b6b8

Browse files
committed
nolint
1 parent 93fc440 commit 374b6b8

2 files changed

Lines changed: 22 additions & 16 deletions

File tree

include/boost/multi/adaptors/thrust/test/for_each.cu

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,21 @@ auto main()
6363

6464
using T = double;
6565
{
66-
auto cpu = multi::array<T, 2>({64, 1048576}, 0);
67-
auto cpu_par = multi::array<T, 2>({64, 1048576});
66+
auto cpu_own = multi::array<T, 3>({64, 64, 64}, 0);
6867

68+
auto&& cpu = cpu_own();
6969
{
70-
auto_timer t{"std::for_each"};
71-
std::for_each(cpu.begin(), cpu.end(), [](auto&& row) {
72-
for(auto&& e : row) {
73-
e += std::sqrt(std::pow(e, 1.5) + std::sin(e));
70+
auto_timer const _{"std::for_each"};
71+
std::for_each(cpu.begin(), cpu.end(), [](auto&& plane) {
72+
for(auto&& row : plane) { // NOLINT(altera-unroll-loops)
73+
for(auto&& elem : row) {
74+
elem += std::sqrt(std::pow(elem, 1.5) + std::sin(elem));
75+
}
7476
}
7577
});
7678
}
7779

78-
auto gpu_par = multi::thrust::device_array<T, 2>({64, 1048576});
80+
auto gpu_par = multi::thrust::device_array<T, 3>({64, 64, 64}, 0);
7981
// {
8082
// auto_timer t{"thrust::for_each(thrust::cuda::par)"};
8183
// thrust::for_each(gpu_par.begin(), gpu_par.end(), [] __device__ (auto&& row) {
@@ -85,7 +87,7 @@ auto main()
8587
// });
8688
// }
8789
{
88-
auto_timer t{"thrust::for_each(thrust::cuda::par, elements)"};
90+
auto_timer const _{"thrust::for_each(thrust::cuda::par, elements)"};
8991
thrust::for_each(thrust::cuda::par, gpu_par.elements().begin(), gpu_par.elements().end(), [] __device__(auto& e) {
9092
e += std::sqrt(std::pow(e, 1.5) + std::sin(e));
9193
});

test/for_each.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,16 @@ auto main() -> int { // NOLINT(bugprone-exception-escape)
5959

6060
using T = double;
6161
{
62-
auto cpu = multi::array<T, 2>({64, 1048576}, 0);
63-
auto cpu_par = multi::array<T, 2>({64, 1048576});
62+
auto cpu_own = multi::array<T, 3>({64, 64, 64}, 0);
6463

64+
auto&& cpu = cpu_own();
6565
{
6666
auto_timer const _{"std::for_each"};
67-
std::for_each(cpu.begin(), cpu.end(), [](auto&& row) {
68-
for(auto&& elem : row) { // NOLINT(altera-unroll-loops)
69-
elem += std::sqrt(std::pow(elem, 1.5) + std::sin(elem));
67+
std::for_each(cpu.begin(), cpu.end(), [](auto&& plane) { // NOLINT(modernize-use-ranges)
68+
for(auto&& row : plane) { // NOLINT(altera-unroll-loops)
69+
for(auto&& elem : row) { // NOLINT(altera-unroll-loops)
70+
elem += std::sqrt(std::pow(elem, 1.5) + std::sin(elem));
71+
}
7072
}
7173
});
7274
}
@@ -75,9 +77,11 @@ auto main() -> int { // NOLINT(bugprone-exception-escape)
7577
#if !defined(__clang__)
7678
{
7779
auto_timer const _{"std::for_each(std::par)"};
78-
std::for_each(std::execution::par, cpu.begin(), cpu.end(), [](auto&& row) {
79-
for(auto&& elem : row) { // NOLINT(altera-unroll-loops)
80-
elem += std::sqrt(std::pow(elem, 1.5) + std::sin(elem));
80+
std::for_each(std::execution::par, cpu.begin(), cpu.end(), [](auto&& plane) {
81+
for(auto&& row : plane) { // NOLINT(altera-unroll-loops)
82+
for(auto&& elem : row) {
83+
elem += std::sqrt(std::pow(elem, 1.5) + std::sin(elem));
84+
}
8185
}
8286
});
8387
}

0 commit comments

Comments
 (0)