diff --git a/.clang-tidy b/.clang-tidy index 1337ec49861d18d60e5121a8468c187ba21a99a6..6969c92ffe4eb775af2c89b3ef5dfe68ec49b006 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,-performance-inefficient-string-concatenation,mpi-*,modernize-*,-modernize-pass-by-value,readability-*,-readability-braces-around-statements,-readability-named-parameter' +Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,-performance-inefficient-string-concatenation,mpi-*,modernize-*,-modernize-pass-by-value,-modernize-use-trailing-return-type,-modernize-avoid-c-arrays,readability-*,-readability-braces-around-statements,-readability-named-parameter,-readability-magic-numbers,-readability-uppercase-literal-suffix' WarningsAsErrors: '' HeaderFilterRegex: '' AnalyzeTemporaryDtors: false diff --git a/.jenkins b/.jenkins index a39d4ba85662d66e7f82c296f75014db93a5ed2e..4bda0fb1ef1cf1d0b1f82755003842c2ad546278 100644 --- a/.jenkins +++ b/.jenkins @@ -218,6 +218,7 @@ pipeline { -D CMAKE_CXX_COMPILER=clang++ \ -D CMAKE_CXX_EXTENSIONS=OFF \ -D CMAKE_CXX_FLAGS="-Wpedantic -Wall -Wextra" \ + -D CMAKE_CXX_CLANG_TIDY="$LLVM_DIR/bin/clang-tidy" \ -D CMAKE_PREFIX_PATH="$KOKKOS_DIR;$BOOST_DIR;$BENCHMARK_DIR" \ -D ARBORX_ENABLE_MPI=ON \ -D MPIEXEC_PREFLAGS="--allow-run-as-root" \ diff --git a/benchmarks/bvh_driver/bvh_driver.cpp b/benchmarks/bvh_driver/bvh_driver.cpp index 15b87d5c8d14263bfad64f294b13166ed0916a9f..eb0ff2ef5db32e7387a146a103cb762c8abc27f0 100644 --- a/benchmarks/bvh_driver/bvh_driver.cpp +++ b/benchmarks/bvh_driver/bvh_driver.cpp @@ -255,7 +255,7 @@ public: ~CmdLineArgs() { - for (auto p : _owner_ptrs) + for (auto *p : _owner_ptrs) { delete[] p; } diff --git a/benchmarks/distributed_tree_driver/distributed_tree_driver.cpp b/benchmarks/distributed_tree_driver/distributed_tree_driver.cpp index 53b43b1851ed862917f6f9f1dc6843031cb0e1b3..99f374d3515d1b92f62dbe2ffac44bc3956495ad 100644 --- a/benchmarks/distributed_tree_driver/distributed_tree_driver.cpp +++ b/benchmarks/distributed_tree_driver/distributed_tree_driver.cpp @@ -83,6 +83,7 @@ public: _data.emplace_back(std::move(name), 0.); return std::make_unique<Timer>(_data.back()); } + void summarize(MPI_Comm comm, std::ostream &os = std::cout) { int comm_size; @@ -483,7 +484,7 @@ int main(int argc, char *argv[]) // multiply. if (comm_rank != 0) { - auto help_it = std::find_if(argv, argv + argc, [](std::string const &x) { + auto *help_it = std::find_if(argv, argv + argc, [](std::string const &x) { return x == "--help" || x == "--kokkos-help"; }); if (help_it != argv + argc) @@ -528,6 +529,9 @@ int main(int argc, char *argv[]) std::cout << desc << '\n'; } + if (node != "serial" && node != "openmp" && node != "cuda") + throw std::runtime_error("Unrecognized node type: \"" + node + "\""); + if (node == "serial") { #ifdef KOKKOS_ENABLE_SERIAL @@ -537,7 +541,7 @@ int main(int argc, char *argv[]) throw std::runtime_error("Serial node type is disabled"); #endif } - else if (node == "openmp") + if (node == "openmp") { #ifdef KOKKOS_ENABLE_OPENMP using Node = Kokkos::OpenMP; @@ -546,7 +550,7 @@ int main(int argc, char *argv[]) throw std::runtime_error("OpenMP node type is disabled"); #endif } - else if (node == "cuda") + if (node == "cuda") { #ifdef KOKKOS_ENABLE_CUDA using Node = Kokkos::Device<Kokkos::Cuda, Kokkos::CudaSpace>; @@ -555,10 +559,6 @@ int main(int argc, char *argv[]) throw std::runtime_error("CUDA node type is disabled"); #endif } - else - { - throw std::runtime_error("Unrecognized node type"); - } } catch (HelpPrinted const &) { diff --git a/test/tstLinearBVH.cpp b/test/tstLinearBVH.cpp index 9ff5803acfcdecbaecf11a69c5e43303a9f3c242..b1e8708a28c9592bd829a7d74489ab13e472fbc1 100644 --- a/test/tstLinearBVH.cpp +++ b/test/tstLinearBVH.cpp @@ -798,20 +798,17 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(structured_grid, DeviceType, ARBORX_DEVICE_TYPES) using ExecutionSpace = typename DeviceType::execution_space; Kokkos::View<ArborX::Box *, DeviceType> bounding_boxes("bounding_boxes", n); - Kokkos::parallel_for("fill_bounding_boxes", - Kokkos::RangePolicy<ExecutionSpace>(0, nx), - KOKKOS_LAMBDA(int i) { - [[gnu::unused]] double x, y, z; - for (int j = 0; j < ny; ++j) - for (int k = 0; k < nz; ++k) - { - x = i * Lx / (nx - 1); - y = j * Ly / (ny - 1); - z = k * Lz / (nz - 1); - bounding_boxes[i + j * nx + k * (nx * ny)] = { - {{x, y, z}}, {{x, y, z}}}; - } - }); + Kokkos::parallel_for( + "fill_bounding_boxes", Kokkos::RangePolicy<ExecutionSpace>(0, nx), + KOKKOS_LAMBDA(int i) { + for (int j = 0; j < ny; ++j) + for (int k = 0; k < nz; ++k) + { + ArborX::Point p{ + {i * Lx / (nx - 1), j * Ly / (ny - 1), k * Lz / (nz - 1)}}; + bounding_boxes[i + j * nx + k * (nx * ny)] = {p, p}; + } + }); ArborX::BVH<DeviceType> bvh(bounding_boxes); @@ -1027,15 +1024,12 @@ make_stuctured_cloud(double Lx, double Ly, double Lz, int nx, int ny, int nz) std::function<int(int, int, int)> ind = [nx, ny](int i, int j, int k) { return i + j * nx + k * (nx * ny); }; - double x, y, z; for (int i = 0; i < nx; ++i) for (int j = 0; j < ny; ++j) for (int k = 0; k < nz; ++k) { - x = i * Lx / (nx - 1); - y = j * Ly / (ny - 1); - z = k * Lz / (nz - 1); - cloud[ind(i, j, k)] = {{x, y, z}}; + cloud[ind(i, j, k)] = { + {i * Lx / (nx - 1), j * Ly / (ny - 1), k * Lz / (nz - 1)}}; } return cloud; }