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

Refactor scatter for list columns #8255

Merged
merged 23 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d858787
Fixed width refactor
isVoid May 14, 2021
b271ea4
remove debug header
isVoid May 14, 2021
a112573
Merge branch 'branch-21.06' of https://github.com/rapidsai/cudf into …
isVoid May 20, 2021
f39965a
.
isVoid May 20, 2021
dd50750
Move detailed implementations into scatter_helper
isVoid May 21, 2021
96de835
Strings spec working
isVoid May 21, 2021
309299f
make lists spec work
isVoid May 21, 2021
4847b52
Add benchmark scatter lists
isVoid May 22, 2021
ff36c9d
Merge branch 'list_scatter' of github.com:isVoid/cudf into list_scatter
isVoid May 22, 2021
d8c96ed
Merge branch 'branch-21.06' of https://github.com/rapidsai/cudf into…
isVoid May 25, 2021
a5fdd98
Fixing bad merges and applying #8314 fix
isVoid May 25, 2021
0720714
structs refactor
isVoid May 25, 2021
e1b82e9
cleanups
isVoid May 25, 2021
b293cb0
Merge branch 'list_scatter' of github.com:isVoid/cudf into list_scatter
isVoid May 25, 2021
a8d6678
remove debug_printer
isVoid May 25, 2021
262ad60
Merge branch 'branch-21.08' of https://github.com/rapidsai/cudf into …
isVoid May 25, 2021
2840347
Rename function
isVoid May 25, 2021
976a522
style and conda scripts cleanup
isVoid May 25, 2021
a497394
Fixes bad rename
isVoid May 26, 2021
0b3bfb8
removing anonymous np, license
isVoid May 26, 2021
f27c670
Merge branch 'branch-21.08' of https://github.com/rapidsai/cudf into …
isVoid Jun 1, 2021
bf666c5
address reviews
isVoid Jun 5, 2021
3c8cb01
null_mask move semantics
isVoid Jun 7, 2021
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 conda/recipes/libcudf/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ test:
- test -f $PREFIX/include/cudf/lists/detail/drop_list_duplicates.hpp
- test -f $PREFIX/include/cudf/lists/detail/interleave_columns.hpp
- test -f $PREFIX/include/cudf/lists/detail/sorting.hpp
- test -f $PREFIX/include/cudf/lists/detail/scatter_helper.cuh
- test -f $PREFIX/include/cudf/lists/concatenate_rows.hpp
- test -f $PREFIX/include/cudf/lists/count_elements.hpp
- test -f $PREFIX/include/cudf/lists/explode.hpp
Expand Down
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ add_library(cudf
src/lists/copying/copying.cu
src/lists/copying/gather.cu
src/lists/copying/segmented_gather.cu
src/lists/copying/scatter_helper.cu
src/lists/count_elements.cu
src/lists/drop_list_duplicates.cu
src/lists/explode.cu
Expand Down
96 changes: 96 additions & 0 deletions cpp/include/cudf/debug_printers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#pragma once

#include <cudf/column/column_view.hpp>
#include <cudf/utilities/error.hpp>

#include <rmm/thrust_rmm_allocator.h>
#include <rmm/device_buffer.hpp>
#include <rmm/device_uvector.hpp>

#include <thrust/copy.h>
#include <thrust/device_ptr.h>
#include <thrust/execution_policy.h>
#include <thrust/fill.h>

#include <iostream>
#include <string>

namespace cudf {
namespace debug {

template <typename T>
void print(std::vector<T> const& vec,
std::ostream& os = std::cout,
std::string const& delimiter = ",")
{
std::vector<double> f64s(vec.size());
std::copy(vec.begin(), vec.end(), f64s.begin());
os << "size: " << vec.size() << " [" << std::endl << " ";
std::copy(f64s.begin(), f64s.end(), std::ostream_iterator<double>(os, delimiter.data()));
os << std::endl << "]" << std::endl;
}

template <typename T>
void print(rmm::device_vector<T> const& vec,
std::ostream& os = std::cout,
std::string const& delimiter = ",",
cudaStream_t stream = 0)
{
CUDA_TRY(cudaStreamSynchronize(stream));
std::vector<T> hvec(vec.size());
std::fill(hvec.begin(), hvec.end(), T{0});
thrust::copy(vec.begin(), vec.end(), hvec.begin());
print<T>(hvec, os, delimiter);
}

template <typename T>
void print(rmm::device_uvector<T> const& uvec,
std::ostream& os = std::cout,
std::string const& delimiter = ",",
cudaStream_t stream = 0)
{
rmm::device_vector<T> dvec(uvec.size());
std::fill(dvec.begin(), dvec.end(), T{0});
thrust::copy(rmm::exec_policy(stream)->on(stream), uvec.begin(), uvec.end(), dvec.begin());
print<T>(dvec, os, delimiter, stream);
}

template <typename T>
void print(rmm::device_buffer const& buf,
std::ostream& os = std::cout,
std::string const& delimiter = ",",
cudaStream_t stream = 0)
{
auto ptr = thrust::device_pointer_cast<const T>(buf.data());
rmm::device_vector<T> dvec(buf.size() / sizeof(T));
thrust::fill(dvec.begin(), dvec.end(), T{0});
thrust::copy(rmm::exec_policy(stream)->on(stream), ptr, ptr + dvec.size(), dvec.begin());
print<T>(dvec, os, delimiter, stream);
}

template <typename T>
void print(cudf::column_view const& col,
std::ostream& os = std::cout,
std::string const& delimiter = ",",
cudaStream_t stream = 0)
{
rmm::device_vector<T> dvec(col.size());
std::fill(dvec.begin(), dvec.end(), T{0});
thrust::copy(rmm::exec_policy(stream)->on(stream), col.begin<T>(), col.end<T>(), dvec.begin());
print<T>(dvec, os, delimiter, stream);
}

template <typename T>
void print(thrust::device_ptr<T> const& ptr,
cudf::size_type size,
std::ostream& os = std::cout,
std::string const& delimiter = ",",
cudaStream_t stream = 0)
{
rmm::device_vector<T> dvec(size);
std::fill(dvec.begin(), dvec.end(), T{0});
thrust::copy(rmm::exec_policy(stream)->on(stream), ptr, ptr + size, dvec.begin());
print<T>(dvec, os, delimiter, stream);
}
} // namespace debug
} // namespace cudf
Loading