Skip to content
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

Automate C++ include file grouping and ordering using clang-format #5787

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 22 additions & 4 deletions cpp/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
Expand All @@ -27,7 +27,7 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
Expand Down Expand Up @@ -71,8 +71,26 @@ ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"' # quoted includes
Priority: 1
- Regex: '^<(common|benchmarks|tests)/' # benchmark/test includes
Priority: 2
- Regex: '^<cuml/' # cuML includes
Priority: 3
- Regex: '^<(cudf|raft|kvikio|cumlprims)' # Other RAPIDS includes
Priority: 4
- Regex: '^<rmm/' # RMM includes
Priority: 5
- Regex: '^<(thrust|cub|cuda)/' # CCCL includes
Priority: 6
- Regex: '^<(cooperative_groups|cuco|cuda|device_types|driver_types|math_constants|nvtx3)' # CUDA includes
Priority: 6
- Regex: '^<.*\..*' # other system includes (e.g. with a '.')
Priority: 7
- Regex: '^<[^.]+' # STL includes (no '.')
Priority: 8
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
Expand Down
13 changes: 9 additions & 4 deletions cpp/bench/common/ml_benchmark.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,13 +16,18 @@

#pragma once

#include <benchmark/benchmark.h>
#include <cuda_runtime.h>
#include <cuml/common/logger.hpp>
#include <cuml/common/utils.hpp>
#include <memory>

#include <raft/util/cudart_utils.hpp>

#include <rmm/mr/device/per_device_resource.hpp>

#include <cuda_runtime.h>

#include <benchmark/benchmark.h>

#include <memory>
#include <sstream>
#include <string>
#include <vector>
Expand Down
14 changes: 8 additions & 6 deletions cpp/bench/sg/arima_loglikelihood.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,18 +14,20 @@
* limitations under the License.
*/

#include <thrust/execution_policy.h>
#include <thrust/for_each.h>
#include <thrust/iterator/counting_iterator.h>
#include "benchmark.cuh"

#include <cuml/tsa/arima_common.h>
#include <cuml/tsa/batched_arima.hpp>

#include <raft/core/handle.hpp>
#include <raft/random/rng.cuh>
#include <raft/util/cudart_utils.hpp>

#include <rmm/device_uvector.hpp>

#include "benchmark.cuh"
#include <raft/util/cudart_utils.hpp>
#include <thrust/execution_policy.h>
#include <thrust/for_each.h>
#include <thrust/iterator/counting_iterator.h>

namespace ML {
namespace Bench {
Expand Down
10 changes: 7 additions & 3 deletions cpp/bench/sg/benchmark.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,12 +19,16 @@
#include "../common/ml_benchmark.hpp"
#include "dataset.cuh"
#include "dataset_ts.cuh"
#include <benchmark/benchmark.h>
#include <cuda_runtime.h>

#include <cuml/common/logger.hpp>

#include <raft/core/handle.hpp>
#include <raft/util/cudart_utils.hpp>

#include <cuda_runtime.h>

#include <benchmark/benchmark.h>

namespace ML {
namespace Bench {

Expand Down
8 changes: 5 additions & 3 deletions cpp/bench/sg/dataset.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,14 +17,16 @@
#pragma once

#include <cuml/datasets/make_blobs.hpp>
#include <fstream>
#include <iostream>

#include <raft/core/handle.hpp>
#include <raft/linalg/transpose.cuh>
#include <raft/linalg/unary_op.cuh>
#include <raft/random/make_regression.cuh>
#include <raft/util/cuda_utils.cuh>
#include <raft/util/cudart_utils.hpp>

#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
Expand Down
5 changes: 3 additions & 2 deletions cpp/bench/sg/dbscan.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,9 +14,10 @@
* limitations under the License.
*/

#include "benchmark.cuh"

#include <cuml/cluster/dbscan.hpp>

#include "benchmark.cuh"
#include <utility>

namespace ML {
Expand Down
8 changes: 5 additions & 3 deletions cpp/bench/sg/fil.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,14 +14,16 @@
* limitations under the License.
*/

#include <cuml/fil/fil.h>

#include "benchmark.cuh"

#include <cuml/common/logger.hpp>
#include <cuml/ensemble/randomforest.hpp>
#include <cuml/fil/fil.h>
#include <cuml/tree/algo_helper.h>

#include <treelite/c_api.h>
#include <treelite/tree.h>

#include <utility>

namespace ML {
Expand Down
16 changes: 9 additions & 7 deletions cpp/bench/sg/filex.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, NVIDIA CORPORATION.
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,20 +14,22 @@
* limitations under the License.
*/

#include "benchmark.cuh"

#include <cuml/common/logger.hpp>
#include <cuml/ensemble/randomforest.hpp>
#include <cuml/experimental/fil/detail/raft_proto/device_type.hpp>
#include <cuml/experimental/fil/infer_kind.hpp>
#include <cuml/experimental/fil/tree_layout.hpp>
#include <cuml/experimental/fil/treelite_importer.hpp>
#include <cuml/fil/fil.h>

#include "benchmark.cuh"
#include <chrono>
#include <cstdint>
#include <cuml/common/logger.hpp>
#include <cuml/ensemble/randomforest.hpp>
#include <cuml/tree/algo_helper.h>

#include <treelite/c_api.h>
#include <treelite/tree.h>

#include <chrono>
#include <cstdint>
#include <utility>

namespace ML {
Expand Down
5 changes: 4 additions & 1 deletion cpp/bench/sg/kmeans.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,10 +15,13 @@
*/

#include "benchmark.cuh"

#include <cuml/cluster/kmeans.hpp>
#include <cuml/common/logger.hpp>

#include <raft/distance/distance_types.hpp>
#include <raft/random/rng_state.hpp>

#include <utility>

namespace ML {
Expand Down
5 changes: 4 additions & 1 deletion cpp/bench/sg/linkage.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,10 +15,13 @@
*/

#include "benchmark.cuh"

#include <cuml/cluster/linkage.hpp>
#include <cuml/common/logger.hpp>

#include <raft/distance/distance_types.hpp>
#include <raft/sparse/hierarchy/common.h>

#include <utility>

namespace ML {
Expand Down
6 changes: 4 additions & 2 deletions cpp/bench/sg/rf_classifier.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,8 +15,10 @@
*/

#include "benchmark.cuh"
#include <cmath>

#include <cuml/ensemble/randomforest.hpp>

#include <cmath>
#include <utility>

namespace ML {
Expand Down
6 changes: 4 additions & 2 deletions cpp/bench/sg/rf_regressor.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
* Copyright (c) 2019-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,8 +15,10 @@
*/

#include "benchmark.cuh"
#include <cmath>

#include <cuml/ensemble/randomforest.hpp>

#include <cmath>
#include <utility>

namespace ML {
Expand Down
7 changes: 5 additions & 2 deletions cpp/bench/sg/svc.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,11 +15,14 @@
*/

#include "benchmark.cuh"
#include <cmath>

#include <cuml/svm/svc.hpp>
#include <cuml/svm/svm_model.h>
#include <cuml/svm/svm_parameter.h>

#include <raft/distance/kernels.cuh>

#include <cmath>
#include <sstream>
#include <utility>

Expand Down
7 changes: 5 additions & 2 deletions cpp/bench/sg/svr.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,12 +15,15 @@
*/

#include "benchmark.cuh"
#include <cmath>

#include <cuml/svm/svc.hpp>
#include <cuml/svm/svm_model.h>
#include <cuml/svm/svm_parameter.h>
#include <cuml/svm/svr.hpp>

#include <raft/distance/kernels.cuh>

#include <cmath>
#include <utility>

namespace ML {
Expand Down
5 changes: 4 additions & 1 deletion cpp/bench/sg/umap.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
* Copyright (c) 2020-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,9 +15,12 @@
*/

#include "benchmark.cuh"

#include <cuml/manifold/umap.hpp>
#include <cuml/manifold/umapparams.h>

#include <raft/util/cuda_utils.cuh>

#include <utility>

namespace ML {
Expand Down
Loading
Loading