Skip to content

Commit

Permalink
Updating Clang Version to 11.0.0 (#426)
Browse files Browse the repository at this point in the history
Follow up PR to: rapidsai/cudf#6695. Performing the same changes but for `rapidsai/cuspatial`

Depends on: rapidsai/integration#304

Authors:
  - Conor Hoekstra (https://github.com/codereport)

Approvers:
  - Dillon Cullinan (https://github.com/dillon-cullinan)
  - H. Thomson Comer (https://github.com/thomcom)

URL: #426
  • Loading branch information
codereport authored Jul 6, 2021
1 parent a470e17 commit 8c31c2c
Show file tree
Hide file tree
Showing 26 changed files with 283 additions and 272 deletions.
4 changes: 2 additions & 2 deletions conda/environments/cuspatial_dev_cuda11.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ channels:
- rapidsai-nightly
- conda-forge
dependencies:
- clang=8.0.1
- clang-tools=8.0.1
- clang=11.0.0
- clang-tools=11.0.0
- cudf=21.08.*
- cudatoolkit=11.0
- gdal>=3.0.2
Expand Down
4 changes: 2 additions & 2 deletions conda/environments/cuspatial_dev_cuda11.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ channels:
- rapidsai-nightly
- conda-forge
dependencies:
- clang=8.0.1
- clang-tools=8.0.1
- clang=11.0.0
- clang-tools=11.0.0
- cudf=21.08.*
- cudatoolkit=11.1
- gdal>=3.0.2
Expand Down
4 changes: 2 additions & 2 deletions conda/environments/cuspatial_dev_cuda11.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ channels:
- rapidsai-nightly
- conda-forge
dependencies:
- clang=8.0.1
- clang-tools=8.0.1
- clang=11.0.0
- clang-tools=11.0.0
- cudf=21.08.*
- cudatoolkit=11.2
- gdal>=3.0.2
Expand Down
20 changes: 14 additions & 6 deletions cpp/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ Language: Cpp
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortLambdasOnASingleLine: true
AllowShortLoopsOnASingleLine: false
# This is deprecated
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
Expand All @@ -40,14 +46,14 @@ BraceWrapping:
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: WebKit
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
Expand All @@ -57,7 +63,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
Expand Down Expand Up @@ -139,18 +145,20 @@ SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
Standard: c++17
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
# Be consistent with indent-width, even for people who use tab for indentation!
TabWidth: 2
UseTab: Never

2 changes: 1 addition & 1 deletion cpp/include/cuspatial/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct logic_error : public std::logic_error {

} // namespace cuspatial

#define STRINGIFY_DETAIL(x) #x
#define STRINGIFY_DETAIL(x) #x
#define CUSPATIAL_STRINGIFY(x) STRINGIFY_DETAIL(x)

/**---------------------------------------------------------------------------*
Expand Down
18 changes: 9 additions & 9 deletions cpp/include/cuspatial/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ struct coord_2d {
*
*/
struct its_timestamp {
uint32_t y : 6;
uint32_t m : 4;
uint32_t d : 5;
uint32_t hh : 5;
uint32_t mm : 6;
uint32_t ss : 6;
uint32_t wd : 3;
uint32_t yd : 9;
uint32_t ms : 10;
uint32_t y : 6;
uint32_t m : 4;
uint32_t d : 5;
uint32_t hh : 5;
uint32_t mm : 6;
uint32_t ss : 6;
uint32_t wd : 3;
uint32_t yd : 9;
uint32_t ms : 10;
uint32_t pid : 10;
};

Expand Down
3 changes: 1 addition & 2 deletions cpp/scripts/run-clang-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import tempfile


EXPECTED_VERSION = "8.0.1"
EXPECTED_VERSION = "11.0.0"
VERSION_REGEX = re.compile(r"clang-format version ([0-9.]+)")
# NOTE: populate this list with more top-level dirs as we add more of them to the cuspatial repo
DEFAULT_DIRS = ["cpp/include",
Expand Down Expand Up @@ -140,4 +140,3 @@ def main():

if __name__ == "__main__":
main()

38 changes: 19 additions & 19 deletions cpp/src/indexing/construction/detail/phase_1.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ namespace detail {
*/
template <typename T>
inline std::pair<rmm::device_uvector<uint32_t>, std::unique_ptr<cudf::column>>
compute_point_keys_and_sorted_indices(cudf::column_view const &x,
cudf::column_view const &y,
compute_point_keys_and_sorted_indices(cudf::column_view const& x,
cudf::column_view const& y,
T x_min,
T x_max,
T y_min,
T y_max,
T scale,
int8_t max_depth,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource *mr)
rmm::mr::device_memory_resource* mr)
{
rmm::device_uvector<uint32_t> keys(x.size(), stream);
thrust::transform(rmm::exec_policy(stream),
thrust::make_zip_iterator(x.begin<T>(), y.begin<T>()),
thrust::make_zip_iterator(x.begin<T>(), y.begin<T>()) + x.size(),
keys.begin(),
[=] __device__(auto const &point) {
[=] __device__(auto const& point) {
T x, y;
thrust::tie(x, y) = point;
if (x < x_min || x > x_max || y < y_min || y > y_max) {
Expand Down Expand Up @@ -187,11 +187,11 @@ inline std::tuple<rmm::device_uvector<uint32_t>,
rmm::device_uvector<uint32_t>,
rmm::device_uvector<uint32_t>,
rmm::device_uvector<uint8_t>>
reverse_tree_levels(rmm::device_uvector<uint32_t> const &quad_keys_in,
rmm::device_uvector<uint32_t> const &quad_point_count_in,
rmm::device_uvector<uint32_t> const &quad_child_count_in,
std::vector<cudf::size_type> const &begin_pos,
std::vector<cudf::size_type> const &end_pos,
reverse_tree_levels(rmm::device_uvector<uint32_t> const& quad_keys_in,
rmm::device_uvector<uint32_t> const& quad_point_count_in,
rmm::device_uvector<uint32_t> const& quad_child_count_in,
std::vector<cudf::size_type> const& begin_pos,
std::vector<cudf::size_type> const& end_pos,
int8_t max_depth,
rmm::cuda_stream_view stream)
{
Expand Down Expand Up @@ -246,8 +246,8 @@ reverse_tree_levels(rmm::device_uvector<uint32_t> const &quad_keys_in,
*
*/
template <typename T>
inline auto make_full_levels(cudf::column_view const &x,
cudf::column_view const &y,
inline auto make_full_levels(cudf::column_view const& x,
cudf::column_view const& y,
T x_min,
T x_max,
T y_min,
Expand All @@ -256,7 +256,7 @@ inline auto make_full_levels(cudf::column_view const &x,
int8_t max_depth,
cudf::size_type min_size,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource *mr)
rmm::mr::device_memory_resource* mr)
{
// Compute point keys and sort into bottom-level quadrants
// (i.e. quads at level `max_depth - 1`)
Expand All @@ -265,8 +265,8 @@ inline auto make_full_levels(cudf::column_view const &x,
auto keys_and_indices = compute_point_keys_and_sorted_indices<T>(
x, y, x_min, x_max, y_min, y_max, scale, max_depth, stream, mr);

auto &point_keys = keys_and_indices.first;
auto &point_indices = keys_and_indices.second;
auto& point_keys = keys_and_indices.first;
auto& point_indices = keys_and_indices.second;

rmm::device_uvector<uint32_t> quad_keys(x.size(), stream);
rmm::device_uvector<uint32_t> quad_point_count(x.size(), stream);
Expand All @@ -284,7 +284,7 @@ inline auto make_full_levels(cudf::column_view const &x,

// Repurpose the `point_keys` vector now the points have been grouped into the
// leaf quadrants
auto &quad_child_count = point_keys;
auto& quad_child_count = point_keys;

quad_keys.resize(num_bottom_quads * (max_depth + 1), stream);
quad_point_count.resize(num_bottom_quads * (max_depth + 1), stream);
Expand Down Expand Up @@ -331,10 +331,10 @@ inline auto make_full_levels(cudf::column_view const &x,
quad_child_count.begin(),
stream);

auto const &num_parent_nodes = std::get<0>(quads);
auto const &quad_tree_size = std::get<1>(quads);
auto const &begin_pos = std::get<2>(quads);
auto const &end_pos = std::get<3>(quads);
auto const& num_parent_nodes = std::get<0>(quads);
auto const& quad_tree_size = std::get<1>(quads);
auto const& begin_pos = std::get<2>(quads);
auto const& end_pos = std::get<3>(quads);

// Shrink vectors' underlying device allocations to reduce peak memory usage
quad_keys.resize(quad_tree_size, stream);
Expand Down
36 changes: 18 additions & 18 deletions cpp/src/indexing/construction/detail/phase_2.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
namespace cuspatial {
namespace detail {

inline rmm::device_uvector<uint32_t> compute_leaf_positions(cudf::column_view const &indicator,
inline rmm::device_uvector<uint32_t> compute_leaf_positions(cudf::column_view const& indicator,
cudf::size_type num_valid_nodes,
rmm::cuda_stream_view stream)
{
Expand All @@ -60,9 +60,9 @@ inline rmm::device_uvector<uint32_t> compute_leaf_positions(cudf::column_view co
}

inline rmm::device_uvector<uint32_t> flatten_point_keys(
rmm::device_uvector<uint32_t> const &quad_keys,
rmm::device_uvector<uint8_t> const &quad_level,
cudf::column_view const &indicator,
rmm::device_uvector<uint32_t> const& quad_keys,
rmm::device_uvector<uint8_t> const& quad_level,
cudf::column_view const& indicator,
cudf::size_type num_valid_nodes,
int8_t max_depth,
rmm::cuda_stream_view stream)
Expand All @@ -74,7 +74,7 @@ inline rmm::device_uvector<uint32_t> flatten_point_keys(
keys_and_levels,
keys_and_levels + num_valid_nodes,
flattened_keys.begin(),
[last_level = max_depth - 1] __device__(auto const &val) {
[last_level = max_depth - 1] __device__(auto const& val) {
bool is_quad{false};
uint32_t key{}, level{};
thrust::tie(key, level, is_quad) = val;
Expand All @@ -93,10 +93,10 @@ inline rmm::device_uvector<uint32_t> flatten_point_keys(
* z-order keys
*/
inline rmm::device_uvector<uint32_t> compute_flattened_first_point_positions(
rmm::device_uvector<uint32_t> const &quad_keys,
rmm::device_uvector<uint8_t> const &quad_level,
rmm::device_uvector<uint32_t> &quad_point_count,
cudf::column_view const &indicator,
rmm::device_uvector<uint32_t> const& quad_keys,
rmm::device_uvector<uint8_t> const& quad_level,
rmm::device_uvector<uint32_t>& quad_point_count,
cudf::column_view const& indicator,
cudf::size_type num_valid_nodes,
int8_t max_depth,
rmm::cuda_stream_view stream)
Expand Down Expand Up @@ -135,8 +135,8 @@ inline rmm::device_uvector<uint32_t> compute_flattened_first_point_positions(
return std::make_pair(std::move(initial_sort_indices), std::move(quad_point_count_tmp));
}();

auto &initial_sort_indices = std::get<0>(sorted_order_and_point_counts);
auto &quad_point_count_tmp = std::get<1>(sorted_order_and_point_counts);
auto& initial_sort_indices = std::get<0>(sorted_order_and_point_counts);
auto& quad_point_count_tmp = std::get<1>(sorted_order_and_point_counts);

auto leaf_offsets = compute_leaf_positions(indicator, num_valid_nodes, stream);

Expand Down Expand Up @@ -177,7 +177,7 @@ inline rmm::device_uvector<uint32_t> compute_flattened_first_point_positions(
}

inline rmm::device_uvector<uint32_t> compute_parent_positions(
rmm::device_uvector<uint32_t> const &quad_child_count,
rmm::device_uvector<uint32_t> const& quad_child_count,
cudf::size_type num_parent_nodes,
cudf::size_type num_child_nodes,
rmm::cuda_stream_view stream)
Expand Down Expand Up @@ -227,10 +227,10 @@ inline rmm::device_uvector<uint32_t> compute_parent_positions(
* @return std::pair<uint32_t, uint32_t>
*/
inline std::pair<uint32_t, uint32_t> remove_unqualified_quads(
rmm::device_uvector<uint32_t> &quad_keys,
rmm::device_uvector<uint32_t> &quad_point_count,
rmm::device_uvector<uint32_t> &quad_child_count,
rmm::device_uvector<uint8_t> &quad_levels,
rmm::device_uvector<uint32_t>& quad_keys,
rmm::device_uvector<uint32_t>& quad_point_count,
rmm::device_uvector<uint32_t>& quad_child_count,
rmm::device_uvector<uint8_t>& quad_levels,
cudf::size_type num_parent_nodes,
cudf::size_type num_child_nodes,
cudf::size_type min_size,
Expand Down Expand Up @@ -300,11 +300,11 @@ inline std::pair<uint32_t, uint32_t> remove_unqualified_quads(
* @return std::unique_ptr<cudf::column>
*/
inline std::unique_ptr<cudf::column> construct_non_leaf_indicator(
rmm::device_uvector<uint32_t> &quad_point_count,
rmm::device_uvector<uint32_t>& quad_point_count,
cudf::size_type num_parent_nodes,
cudf::size_type num_valid_nodes,
cudf::size_type min_size,
rmm::mr::device_memory_resource *mr,
rmm::mr::device_memory_resource* mr,
rmm::cuda_stream_view stream)
{
//
Expand Down
Loading

0 comments on commit 8c31c2c

Please sign in to comment.