Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/src/core/column.cu
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ std::unique_ptr<cudf::scalar> LogicalColumn::get_cudf_scalar(
if (col->size() != 1) {
throw std::invalid_argument("only length 1/scalar columns can be converted to scalar.");
}
return std::move(cudf::get_element(col->view(), 0));
return std::move(cudf::get_element(col->view(), 0, stream, mr));
}

namespace task {
Expand Down Expand Up @@ -367,7 +367,7 @@ std::unique_ptr<cudf::scalar> PhysicalColumn::cudf_scalar() const
if (num_rows() != 1) {
throw std::invalid_argument("can only convert length one columns to scalar.");
}
return cudf::get_element(column_view(), 0);
return cudf::get_element(column_view(), 0, ctx_->stream(), ctx_->mr());
}

void PhysicalColumn::copy_into(std::unique_ptr<cudf::column> column)
Expand Down
17 changes: 11 additions & 6 deletions cpp/src/sort.cu
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ std::unique_ptr<cudf::column> create_column(cudf::size_type num_rows,
{
if (num_rows == 0) { return cudf::make_empty_column(cudf::data_type{cudf::type_to_id<T>()}); }
return cudf::sequence(num_rows,
*cudf::make_fixed_width_scalar(fill_value),
*cudf::make_fixed_width_scalar(int32_t{0}));
*cudf::make_fixed_width_scalar(fill_value, ctx.stream(), ctx.mr()),
*cudf::make_fixed_width_scalar(int32_t{0}, ctx.stream(), ctx.mr()),
ctx.stream(),
ctx.mr());
}

template <typename T>
Expand Down Expand Up @@ -270,15 +272,18 @@ std::vector<cudf::size_type> find_splits_for_distribution(
ctx, sorted_table, global_split_values->view(), keys_idx, column_order, null_precedence);
}

static std::unique_ptr<cudf::table> apply_limit(std::unique_ptr<cudf::table> tbl, int64_t limit)
static std::unique_ptr<cudf::table> apply_limit(TaskContext& ctx,
std::unique_ptr<cudf::table> tbl,
int64_t limit)
{
if (limit != INT64_MIN && std::abs(limit) < tbl->num_rows()) {
cudf::size_type cudf_limit = static_cast<cudf::size_type>(limit);
cudf::table_view slice;
if (limit < 0) {
slice = cudf::slice(tbl->view(), {tbl->num_rows() + cudf_limit, tbl->num_rows()})[0];
slice =
cudf::slice(tbl->view(), {tbl->num_rows() + cudf_limit, tbl->num_rows()}, ctx.stream())[0];
} else {
slice = cudf::slice(tbl->view(), {0, cudf_limit})[0];
slice = cudf::slice(tbl->view(), {0, cudf_limit}, ctx.stream())[0];
}
tbl = std::make_unique<cudf::table>(slice);
}
Expand Down Expand Up @@ -324,7 +329,7 @@ static std::unique_ptr<cudf::table> apply_limit(std::unique_ptr<cudf::table> tbl
auto sorted_table =
sort_func(cudf_tbl, key, column_order, null_precedence, ctx.stream(), ctx.mr());

sorted_table = apply_limit(std::move(sorted_table), limit);
sorted_table = apply_limit(ctx, std::move(sorted_table), limit);

if (ctx.nranks == 1) {
output.move_into(sorted_table->release());
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/strings.cu
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace legate::dataframe::task {
}

std::unique_ptr<cudf::column> ret;
auto cudf_pattern = cudf::string_scalar(pattern);
auto cudf_pattern = cudf::string_scalar(pattern, true, ctx.stream(), ctx.mr());

if (match_func == "starts_with") {
ret = cudf::strings::starts_with(input.column_view(), cudf_pattern, ctx.stream(), ctx.mr());
Expand Down