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

Converts cudf over to supporting thrust existing in a nested namespace #11440

Closed
Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ target_include_directories(
target_compile_definitions(
cudf PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:${CUDF_CXX_DEFINITIONS}>"
"$<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CUDA>:${CUDF_CUDA_DEFINITIONS}>>"
PRIVATE "THRUST_WRAPPED_NAMESPACE=rapids"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This currently is PRIVATE on purpose since making it public would break consumers that use Thrust and don't call cudf API that have thrust types.

)

# Disable Jitify log printing. See https://github.com/NVIDIA/jitify/issues/79
Expand Down
15 changes: 15 additions & 0 deletions cpp/cmake/thirdparty/get_rmm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@
# This function finds rmm and sets any additional necessary environment variables.
function(find_and_configure_rmm)
include(${rapids-cmake-dir}/cpm/rmm.cmake)
include(${rapids-cmake-dir}/cpm/package_override.cmake)

file(
WRITE "${CMAKE_CURRENT_BINARY_DIR}/rmm_override.json"
[=[
{
"packages" : {
"rmm" : {
"git_url" : "https://github.com/robertmaynard/rmm.git",
"git_tag" : "support_custom_thrust_namespaces"
}
}
}
]=])
rapids_cpm_package_override("${CMAKE_CURRENT_BINARY_DIR}/rmm_override.json")

# Find or install RMM
rapids_cpm_rmm(BUILD_EXPORT_SET cudf-exports INSTALL_EXPORT_SET cudf-exports)
Expand Down
11 changes: 6 additions & 5 deletions cpp/include/cudf/io/types.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

/*
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
Expand All @@ -23,11 +24,11 @@

#include <cudf/types.hpp>

#include <thrust/optional.h>

#include <map>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>

// Forward declarations
Expand Down Expand Up @@ -383,12 +384,12 @@ class table_input_metadata;
class column_in_metadata {
friend table_input_metadata;
std::string _name = "";
thrust::optional<bool> _nullable;
std::optional<bool> _nullable;
bool _list_column_is_map = false;
bool _use_int96_timestamp = false;
bool _output_as_binary = false;
thrust::optional<uint8_t> _decimal_precision;
thrust::optional<int32_t> _parquet_field_id;
std::optional<uint8_t> _decimal_precision;
std::optional<int32_t> _parquet_field_id;
std::vector<column_in_metadata> children;

public:
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/cudf/strings/string_view.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ __device__ inline size_type characters_in_string(const char* str, size_type byte
if ((str == nullptr) || (bytes == 0)) return 0;
auto ptr = reinterpret_cast<uint8_t const*>(str);
#ifndef CUDF_JIT_UDF
return thrust::count_if(
thrust::seq, ptr, ptr + bytes, [](uint8_t chr) { return is_begin_utf8_char(chr); });
return THRUST_NS_QUALIFIER::count_if(
THRUST_NS_QUALIFIER::seq, ptr, ptr + bytes, [](uint8_t chr) { return is_begin_utf8_char(chr); });
#else
size_type chars = 0;
auto const end = ptr + bytes;
Expand Down
1 change: 1 addition & 0 deletions cpp/src/aggregation/aggregation.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <rmm/cuda_stream_view.hpp>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {
void initialize_with_identity(mutable_table_view& table,
Expand Down
1 change: 1 addition & 0 deletions cpp/src/aggregation/result_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <cudf/detail/aggregation/result_cache.hpp>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {

Expand Down
1 change: 1 addition & 0 deletions cpp/src/ast/expression_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <functional>
#include <iterator>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {

namespace ast {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/ast/expressions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <cudf/types.hpp>
#include <cudf/utilities/error.hpp>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace ast {

Expand Down
1 change: 1 addition & 0 deletions cpp/src/binaryop/binaryop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

#include <thrust/optional.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace binops {

Expand Down
1 change: 1 addition & 0 deletions cpp/src/binaryop/compiled/binary_ops.cu
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <thrust/iterator/counting_iterator.h>
#include <thrust/transform.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace binops {
namespace compiled {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/bitmask/is_element_valid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <cudf/utilities/bit.hpp>
#include <cudf/utilities/error.hpp>

// using namespace THRUST_WRAPPED_NAMESPACE;
#include <rmm/cuda_stream_view.hpp>

namespace cudf {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/bitmask/null_mask.cu
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <numeric>
#include <type_traits>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
size_type state_null_count(mask_state state, size_type size)
{
Expand Down
1 change: 1 addition & 0 deletions cpp/src/column/column.cu
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <numeric>
#include <vector>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {

// Copy ctor w/ optional stream/mr
Expand Down
1 change: 1 addition & 0 deletions cpp/src/column/column_device_view.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <numeric>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
// Trivially copy all members but the children
column_device_view::column_device_view(column_view source)
Expand Down
1 change: 1 addition & 0 deletions cpp/src/column/column_factories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <thrust/iterator/constant_iterator.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace {
struct size_of_helper {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/column/column_factories.cu
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <thrust/iterator/constant_iterator.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {

namespace {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/column/column_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <numeric>
#include <vector>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {
column_view_base::column_view_base(data_type type,
Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/concatenate.cu
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <numeric>
#include <utility>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {

Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/contiguous_split.cu
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <cstddef>
#include <numeric>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace {

Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <algorithm>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {
namespace {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/copy.cu
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <thrust/distance.h>
#include <thrust/iterator/counting_iterator.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {
namespace {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/copy_range.cu
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ std::unique_ptr<cudf::column> out_of_place_copy_range_dispatch::operator()<cudf:

} // namespace

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {
void copy_range_in_place(column_view const& source,
Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/gather.cu
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <thrust/iterator/transform_iterator.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {

Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/get_element.cu
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <rmm/cuda_stream_view.hpp>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {

Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <rmm/cuda_stream_view.hpp>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {

Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/purge_nonempty_nulls.cu
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <thrust/iterator/counting_iterator.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {

Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/reverse.cu
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <thrust/iterator/transform_output_iterator.h>
#include <thrust/scan.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {
std::unique_ptr<table> reverse(table_view const& source_table,
Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/sample.cu
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <thrust/random/uniform_int_distribution.h>
#include <thrust/shuffle.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {

Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/scatter.cu
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <thrust/scatter.h>
#include <thrust/sequence.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {
namespace {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/segmented_shift.cu
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <thrust/execution_policy.h>
#include <thrust/iterator/transform_iterator.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {

Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/shift.cu
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <iterator>
#include <memory>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace {
inline bool __device__ out_of_bounds(size_type size, size_type idx)
Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/slice.cu
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <algorithm>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {
std::vector<column_view> slice(column_view const& input,
Expand Down
1 change: 1 addition & 0 deletions cpp/src/copying/split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <algorithm>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace detail {
namespace {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/datetime/datetime_ops.cu
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <thrust/iterator/permutation_iterator.h>
#include <thrust/transform.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace datetime {
namespace detail {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/dictionary/add_keys.cu
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <cudf/table/table_view.hpp>
#include <cudf/utilities/default_stream.hpp>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace dictionary {
namespace detail {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/dictionary/decode.cu
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <rmm/cuda_stream_view.hpp>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace dictionary {
namespace detail {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/dictionary/detail/concatenate.cu
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <algorithm>
#include <vector>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace dictionary {
namespace detail {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/dictionary/detail/merge.cu
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <thrust/transform.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace dictionary {
namespace detail {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/dictionary/dictionary_column_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <cudf/dictionary/dictionary_column_view.hpp>
#include <cudf/utilities/error.hpp>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
//
dictionary_column_view::dictionary_column_view(column_view const& dictionary_column)
Expand Down
1 change: 1 addition & 0 deletions cpp/src/dictionary/dictionary_factories.cu
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <rmm/cuda_stream_view.hpp>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace {
struct dispatch_create_indices {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/dictionary/encode.cu
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <rmm/cuda_stream_view.hpp>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace dictionary {
namespace detail {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/dictionary/remove_keys.cu
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <thrust/sequence.h>
#include <thrust/transform.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace dictionary {
namespace detail {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/dictionary/replace.cu
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <rmm/cuda_stream_view.hpp>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace dictionary {
namespace detail {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/dictionary/search.cu
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <thrust/distance.h>
#include <thrust/execution_policy.h>

using namespace THRUST_WRAPPED_NAMESPACE;
namespace cudf {
namespace dictionary {
namespace detail {
Expand Down
Loading