Skip to content

Commit

Permalink
Replace as_device_scalar with cudf.Scalar.device_value (#9)
Browse files Browse the repository at this point in the history
I'm slowly working on replacing cudf's `DeviceScalar` with pylibcudf's
`Scalar` eventually. The first step is slimming down the old API so
replacing `as_device_scalar` with an equivalent
`cudf.Scalar.device_value` (which _should_ be API stable)

Additionally added a commit to remove `task_target` which was removed from legate.

---------

Signed-off-by: Sebastian Berg <[email protected]>
Co-authored-by: Sebastian Berg <[email protected]>
  • Loading branch information
mroeschke and seberg authored Dec 30, 2024
1 parent d43d878 commit 6a123cb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
7 changes: 0 additions & 7 deletions cpp/src/core/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ class Mapper : public legate::mapping::Mapper {
Mapper(const Mapper& rhs) = delete;
Mapper& operator=(const Mapper& rhs) = delete;

legate::mapping::TaskTarget task_target(
const legate::mapping::Task& task,
const std::vector<legate::mapping::TaskTarget>& options) override
{
return *options.begin(); // Choose first priority
}

std::vector<legate::mapping::StoreMapping> store_mappings(
const legate::mapping::Task& task,
const std::vector<legate::mapping::StoreTarget>& options) override
Expand Down
3 changes: 1 addition & 2 deletions python/legate_dataframe/lib/core/scalar.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import numbers
import cudf
import legate.core
import numpy
from cudf._lib.scalar import as_device_scalar

ScalarLike = numpy.number | numbers.Number | cudf.Scalar | legate.core.Scalar

Expand All @@ -39,5 +38,5 @@ cdef cpp_ScalarArg cpp_scalar_arg_from_python(scalar: ScalarLike):

# NOTE: Converting to a cudf scalar isn't really ideal, as we copy
# to the device, just to copy it back again to get a legate one.
cdef DeviceScalar cudf_scalar = <DeviceScalar>as_device_scalar(scalar)
cdef DeviceScalar cudf_scalar = <DeviceScalar>(cudf.Scalar(scalar).device_value)
return cpp_ScalarArg(dereference(cudf_scalar.get_raw_ptr()))

0 comments on commit 6a123cb

Please sign in to comment.