Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/branch-22.12' into fix/byte-ca…
Browse files Browse the repository at this point in the history
…st-sanitized
  • Loading branch information
bdice committed Oct 27, 2022
2 parents 835a0f4 + 1b1ca7c commit d18c557
Show file tree
Hide file tree
Showing 174 changed files with 2,880 additions and 1,683 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/stale.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ junit-cudf.xml
test-results

## Patching
*.diff
*.orig
*.rej

Expand Down Expand Up @@ -166,3 +165,5 @@ dask-worker-space/
# Sphinx docs & build artifacts
docs/cudf/source/api_docs/generated/*
docs/cudf/source/api_docs/api/*
docs/cudf/source/user_guide/example_output/*
docs/cudf/source/user_guide/cudf.*Dtype.*.rst
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ BUILD_BENCHMARKS=OFF
BUILD_ALL_GPU_ARCH=0
BUILD_NVTX=ON
BUILD_TESTS=OFF
BUILD_DISABLE_DEPRECATION_WARNING=ON
BUILD_DISABLE_DEPRECATION_WARNINGS=ON
BUILD_PER_THREAD_DEFAULT_STREAM=OFF
BUILD_REPORT_METRICS=OFF
BUILD_REPORT_INCL_CACHE_STATS=OFF
Expand Down Expand Up @@ -216,7 +216,7 @@ if hasArg --opensource_nvcomp; then
USE_PROPRIETARY_NVCOMP="OFF"
fi
if hasArg --show_depr_warn; then
BUILD_DISABLE_DEPRECATION_WARNING=OFF
BUILD_DISABLE_DEPRECATION_WARNINGS=OFF
fi
if hasArg --ptds; then
BUILD_PER_THREAD_DEFAULT_STREAM=ON
Expand Down Expand Up @@ -285,7 +285,7 @@ if buildAll || hasArg libcudf; then
-DCUDF_USE_PROPRIETARY_NVCOMP=${USE_PROPRIETARY_NVCOMP} \
-DBUILD_TESTS=${BUILD_TESTS} \
-DBUILD_BENCHMARKS=${BUILD_BENCHMARKS} \
-DDISABLE_DEPRECATION_WARNING=${BUILD_DISABLE_DEPRECATION_WARNING} \
-DDISABLE_DEPRECATION_WARNINGS=${BUILD_DISABLE_DEPRECATION_WARNINGS} \
-DCUDF_USE_PER_THREAD_DEFAULT_STREAM=${BUILD_PER_THREAD_DEFAULT_STREAM} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
${EXTRA_CMAKE_ARGS}
Expand Down
49 changes: 27 additions & 22 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ option(
stream to external libraries."
OFF
)
option(DISABLE_DEPRECATION_WARNING "Disable warnings generated from deprecated declarations." OFF)
option(DISABLE_DEPRECATION_WARNINGS "Disable warnings generated from deprecated declarations." OFF)
# Option to enable line info in CUDA device compilation to allow introspection when profiling /
# memchecking
option(CUDA_ENABLE_LINEINFO
Expand All @@ -79,7 +79,7 @@ message(VERBOSE "CUDF: Build and enable S3 filesystem support for Arrow: ${CUDF_
message(VERBOSE "CUDF: Build with per-thread default stream: ${CUDF_USE_PER_THREAD_DEFAULT_STREAM}")
message(
VERBOSE
"CUDF: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNING}"
"CUDF: Disable warnings generated from deprecated declarations: ${DISABLE_DEPRECATION_WARNINGS}"
)
message(
VERBOSE
Expand Down Expand Up @@ -124,12 +124,6 @@ rapids_find_package(
)
include(cmake/Modules/ConfigureCUDA.cmake) # set other CUDA compilation flags

# ctest cuda memcheck
find_program(CUDA_SANITIZER compute-sanitizer)
set(MEMORYCHECK_COMMAND ${CUDA_SANITIZER})
set(MEMORYCHECK_TYPE CudaSanitizer)
set(CUDA_SANITIZER_COMMAND_OPTIONS "--tool memcheck")

# ##################################################################################################
# * dependencies ----------------------------------------------------------------------------------

Expand Down Expand Up @@ -617,9 +611,15 @@ target_compile_definitions(
# Disable Jitify log printing. See https://github.com/NVIDIA/jitify/issues/79
target_compile_definitions(cudf PRIVATE "JITIFY_PRINT_LOG=0")

# Instruct jitify to use the kernel JIT cache
if(JITIFY_USE_CACHE)
target_compile_definitions(cudf PUBLIC JITIFY_USE_CACHE "CUDF_VERSION=${PROJECT_VERSION}")
# Instruct src/jit/cache what version of cudf we are building so it can compute a cal-ver cache
# directory. We isolate this definition to the single source so it doesn't effect compiling
# caching for all of libcudf
set_property(
SOURCE src/jit/cache.cpp
APPEND
PROPERTY COMPILE_DEFINITIONS "JITIFY_USE_CACHE" "CUDF_VERSION=${PROJECT_VERSION}"
)
endif()

# Per-thread default stream
Expand Down Expand Up @@ -732,6 +732,13 @@ add_library(cudf::cudftestutil ALIAS cudftestutil)
if(CUDF_BUILD_TESTS)
# include CTest module -- automatically calls enable_testing()
include(CTest)

# ctest cuda memcheck
find_program(CUDA_SANITIZER compute-sanitizer)
set(MEMORYCHECK_COMMAND ${CUDA_SANITIZER})
set(MEMORYCHECK_TYPE CudaSanitizer)
set(CUDA_SANITIZER_COMMAND_OPTIONS "--tool memcheck")

# Always print verbose output when tests fail if run using `make test`.
list(APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure")
add_subdirectory(tests)
Expand All @@ -742,25 +749,15 @@ endif()

if(CUDF_BUILD_BENCHMARKS)
# Find or install GoogleBench
rapids_cpm_find(
benchmark 1.5.2
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG v1.5.2
GIT_SHALLOW TRUE
OPTIONS "BENCHMARK_ENABLE_TESTING OFF" "BENCHMARK_ENABLE_INSTALL OFF"
)
include(${rapids-cmake-dir}/cpm/gbench.cmake)
rapids_cpm_gbench()

# Find or install NVBench
include(${rapids-cmake-dir}/cpm/nvbench.cmake)
rapids_cpm_nvbench()
add_subdirectory(benchmarks)
endif()

# build pretty-printer load script
if(Thrust_SOURCE_DIR AND rmm_SOURCE_DIR)
configure_file(scripts/load-pretty-printers.in load-pretty-printers @ONLY)
endif()

# ##################################################################################################
# * install targets -------------------------------------------------------------------------------
rapids_cmake_install_lib_dir(lib_dir)
Expand Down Expand Up @@ -924,3 +921,11 @@ add_custom_target(
DEPENDS CUDF_DOXYGEN
COMMENT "Custom command for building cudf doxygen docs."
)

# ##################################################################################################
# * make gdb helper scripts ------------------------------------------------------------------------

# build pretty-printer load script
if(Thrust_SOURCE_DIR AND rmm_SOURCE_DIR)
configure_file(scripts/load-pretty-printers.in load-pretty-printers @ONLY)
endif()
21 changes: 12 additions & 9 deletions cpp/benchmarks/common/generate_input.cu
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ std::unique_ptr<cudf::column> create_random_column(data_profile const& profile,
null_mask.begin());
}

auto [result_bitmask, null_count] =
cudf::detail::valid_if(null_mask.begin(), null_mask.end(), thrust::identity<bool>{});
auto [result_bitmask, null_count] = cudf::detail::valid_if(
null_mask.begin(), null_mask.end(), thrust::identity<bool>{}, cudf::get_default_stream());

return std::make_unique<cudf::column>(
dtype,
Expand Down Expand Up @@ -508,8 +508,8 @@ std::unique_ptr<cudf::column> create_random_utf8_string_column(data_profile cons
thrust::make_zip_iterator(offsets.begin(), offsets.begin() + 1),
num_rows,
string_generator{chars.data(), engine});
auto [result_bitmask, null_count] =
cudf::detail::valid_if(null_mask.begin(), null_mask.end() - 1, thrust::identity<bool>{});
auto [result_bitmask, null_count] = cudf::detail::valid_if(
null_mask.begin(), null_mask.end() - 1, thrust::identity<bool>{}, cudf::get_default_stream());
return cudf::make_strings_column(
num_rows,
std::move(offsets),
Expand Down Expand Up @@ -541,7 +541,8 @@ std::unique_ptr<cudf::column> create_random_column<cudf::string_view>(data_profi
auto str_table = cudf::detail::gather(cudf::table_view{{sample_strings->view()}},
sample_indices,
cudf::out_of_bounds_policy::DONT_CHECK,
cudf::detail::negative_index_policy::NOT_ALLOWED);
cudf::detail::negative_index_policy::NOT_ALLOWED,
cudf::get_default_stream());
return std::move(str_table->release()[0]);
}

Expand Down Expand Up @@ -625,7 +626,8 @@ std::unique_ptr<cudf::column> create_random_column<cudf::struct_view>(data_profi
auto [null_mask, null_count] = [&]() {
if (profile.get_null_probability().has_value()) {
auto valids = valid_dist(engine, num_rows);
return cudf::detail::valid_if(valids.begin(), valids.end(), thrust::identity<bool>{});
return cudf::detail::valid_if(
valids.begin(), valids.end(), thrust::identity<bool>{}, cudf::get_default_stream());
}
return std::pair<rmm::device_buffer, cudf::size_type>{};
}();
Expand Down Expand Up @@ -708,8 +710,8 @@ std::unique_ptr<cudf::column> create_random_column<cudf::list_view>(data_profile
auto offsets_column = std::make_unique<cudf::column>(
cudf::data_type{cudf::type_id::INT32}, num_rows + 1, offsets.release());

auto [null_mask, null_count] =
cudf::detail::valid_if(valids.begin(), valids.end(), thrust::identity<bool>{});
auto [null_mask, null_count] = cudf::detail::valid_if(
valids.begin(), valids.end(), thrust::identity<bool>{}, cudf::get_default_stream());
list_column = cudf::make_lists_column(
num_rows,
std::move(offsets_column),
Expand Down Expand Up @@ -835,7 +837,8 @@ std::pair<rmm::device_buffer, cudf::size_type> create_random_null_mask(
} else {
return cudf::detail::valid_if(thrust::make_counting_iterator<cudf::size_type>(0),
thrust::make_counting_iterator<cudf::size_type>(size),
bool_generator{seed, 1.0 - *null_probability});
bool_generator{seed, 1.0 - *null_probability},
cudf::get_default_stream());
}
}

Expand Down
28 changes: 20 additions & 8 deletions cpp/benchmarks/io/text/multibyte_split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@

temp_directory const temp_dir("cudf_nvbench");

enum class data_chunk_source_type { device, file, host, host_pinned, file_bgzip };
enum class data_chunk_source_type { device, file, file_datasource, host, host_pinned, file_bgzip };

NVBENCH_DECLARE_ENUM_TYPE_STRINGS(
data_chunk_source_type,
[](auto value) {
switch (value) {
case data_chunk_source_type::device: return "device";
case data_chunk_source_type::file: return "file";
case data_chunk_source_type::file_datasource: return "file_datasource";
case data_chunk_source_type::host: return "host";
case data_chunk_source_type::host_pinned: return "host_pinned";
case data_chunk_source_type::file_bgzip: return "file_bgzip";
Expand Down Expand Up @@ -121,6 +122,7 @@ static void bench_multibyte_split(nvbench::state& state,
auto const delim_percent = state.get_int64("delim_percent");
auto const file_size_approx = state.get_int64("size_approx");
auto const byte_range_percent = state.get_int64("byte_range_percent");
auto const strip_delimiters = bool(state.get_int64("strip_delimiters"));

auto const byte_range_factor = static_cast<double>(byte_range_percent) / 100;
CUDF_EXPECTS(delim_percent >= 1, "delimiter percent must be at least 1");
Expand All @@ -133,13 +135,14 @@ static void bench_multibyte_split(nvbench::state& state,
std::iota(delim.begin(), delim.end(), '1');

auto const delim_factor = static_cast<double>(delim_percent) / 100;
auto device_input = create_random_input(file_size_approx, delim_factor, 0.05, delim);
auto host_input = std::vector<char>{};
std::unique_ptr<cudf::io::datasource> datasource;
auto device_input = create_random_input(file_size_approx, delim_factor, 0.05, delim);
auto host_input = std::vector<char>{};
auto host_pinned_input =
thrust::host_vector<char, thrust::system::cuda::experimental::pinned_allocator<char>>{};

if (source_type == data_chunk_source_type::host || source_type == data_chunk_source_type::file ||
source_type == data_chunk_source_type::file_bgzip) {
if (source_type != data_chunk_source_type::device &&
source_type != data_chunk_source_type::host_pinned) {
host_input = cudf::detail::make_std_vector_sync<char>(
{device_input.data(), static_cast<std::size_t>(device_input.size())},
cudf::get_default_stream());
Expand All @@ -154,11 +157,17 @@ static void bench_multibyte_split(nvbench::state& state,

auto source = [&] {
switch (source_type) {
case data_chunk_source_type::file: {
case data_chunk_source_type::file:
case data_chunk_source_type::file_datasource: {
auto const temp_file_name = random_file_in_dir(temp_dir.path());
std::ofstream(temp_file_name, std::ofstream::out)
.write(host_input.data(), host_input.size());
return cudf::io::text::make_source_from_file(temp_file_name);
if (source_type == data_chunk_source_type::file) {
return cudf::io::text::make_source_from_file(temp_file_name);
} else {
datasource = cudf::io::datasource::create(temp_file_name);
return cudf::io::text::make_source(*datasource);
}
}
case data_chunk_source_type::host: //
return cudf::io::text::make_source(host_input);
Expand All @@ -182,12 +191,13 @@ static void bench_multibyte_split(nvbench::state& state,
auto const range_size = static_cast<int64_t>(device_input.size() * byte_range_factor);
auto const range_offset = (device_input.size() - range_size) / 2;
cudf::io::text::byte_range_info range{range_offset, range_size};
cudf::io::text::parse_options options{range, strip_delimiters};
std::unique_ptr<cudf::column> output;

state.set_cuda_stream(nvbench::make_cuda_stream_view(cudf::get_default_stream().value()));
state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) {
try_drop_l3_cache();
output = cudf::io::text::multibyte_split(*source, delim, range);
output = cudf::io::text::multibyte_split(*source, delim, options);
});

state.add_buffer_size(mem_stats_logger.peak_memory_usage(), "pmu", "Peak Memory Usage");
Expand All @@ -197,12 +207,14 @@ static void bench_multibyte_split(nvbench::state& state,

using source_type_list = nvbench::enum_type_list<data_chunk_source_type::device,
data_chunk_source_type::file,
data_chunk_source_type::file_datasource,
data_chunk_source_type::host,
data_chunk_source_type::host_pinned,
data_chunk_source_type::file_bgzip>;

NVBENCH_BENCH_TYPES(bench_multibyte_split, NVBENCH_TYPE_AXES(source_type_list))
.set_name("multibyte_split")
.add_int64_axis("strip_delimiters", {0, 1})
.add_int64_axis("delim_size", {1, 4, 7})
.add_int64_axis("delim_percent", {1, 25})
.add_int64_power_of_two_axis("size_approx", {15, 30})
Expand Down
6 changes: 4 additions & 2 deletions cpp/benchmarks/iterator/iterator.cu
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ void BM_iterator(benchmark::State& state)
cudf::column_view hasnull_F = wrap_hasnull_F;

// Initialize dev_result to false
auto dev_result = cudf::detail::make_zeroed_device_uvector_sync<TypeParam>(1);
auto dev_result =
cudf::detail::make_zeroed_device_uvector_sync<TypeParam>(1, cudf::get_default_stream());
for (auto _ : state) {
cuda_event_timer raii(state, true); // flush_l2_cache = true, stream = 0
if (cub_or_thrust) {
Expand Down Expand Up @@ -208,7 +209,8 @@ void BM_pair_iterator(benchmark::State& state)
cudf::column_view hasnull_T = wrap_hasnull_T;

// Initialize dev_result to false
auto dev_result = cudf::detail::make_zeroed_device_uvector_sync<thrust::pair<T, bool>>(1);
auto dev_result = cudf::detail::make_zeroed_device_uvector_sync<thrust::pair<T, bool>>(
1, cudf::get_default_stream());
for (auto _ : state) {
cuda_event_timer raii(state, true); // flush_l2_cache = true, stream = 0
if (cub_or_thrust) {
Expand Down
4 changes: 3 additions & 1 deletion cpp/benchmarks/join/join_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ static void BM_join(state_type& state, Join JoinFunc)
// roughly 75% nulls
auto validity =
thrust::make_transform_iterator(thrust::make_counting_iterator(0), null75_generator{});
return cudf::detail::valid_if(validity, validity + size, thrust::identity<bool>{}).first;
return cudf::detail::valid_if(
validity, validity + size, thrust::identity<bool>{}, cudf::get_default_stream())
.first;
};

std::unique_ptr<cudf::column> build_key_column0 = [&]() {
Expand Down
Loading

0 comments on commit d18c557

Please sign in to comment.