Skip to content

Commit

Permalink
Update to use Rapids 24.10 at runtime and build setup (#8)
Browse files Browse the repository at this point in the history
The main change here is the build setup @jameslamb.

The `pylibcudf` changes were started by Matt before, the C change, is
just a very simple change in public API (there is the new stream
parameter).

*~Draft, since the update to 25.01.00.dev should happen first~ Ready for
review, but I suspect tests will fail due to a small (fixed!) legate
issue for another day*.

---------

Signed-off-by: Sebastian Berg <[email protected]>
Co-authored-by: Matthew Roeschke <[email protected]>
  • Loading branch information
seberg and mroeschke authored Dec 12, 2024
1 parent dd9bc3c commit d43d878
Show file tree
Hide file tree
Showing 26 changed files with 108 additions and 104 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,8 @@ if __name__ == "__main__":

int main(int argc, char** argv)
{
// First we initialize Legate and cuPyNumeric
int32_t errcode = legate::start(argc, argv);
if (errcode != 0) {
throw std::runtime_error("legate::start() errorcode: " + std::to_string(errcode));
}
// First we initialize Legate use either `legate` or `LEGATE_CONFIG` to customize launch
legate::start();

// Then let's create a new logical column
legate::dataframe::LogicalColumn col_a = legate::dataframe::sequence(20, -10);
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ if (( NUMARGS == 0 )) || hasArg legate_dataframe; then
cd ${REPODIR}/python/
SKBUILD_CONFIGURE_OPTIONS="-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} -DCMAKE_LIBRARY_PATH=${LIBLEGATE_DATAFRAME_BUILD_DIR} ${EXTRA_CMAKE_ARGS}" \
SKBUILD_BUILD_OPTIONS="-j${PARALLEL_LEVEL:-1}" \
python -m pip install --no-build-isolation --no-deps ${VERBOSE_FLAG} .
python -m pip install --no-build-isolation --no-deps --config-settings rapidsai.disable-cuda=true ${VERBOSE_FLAG} .
fi


Expand Down
17 changes: 9 additions & 8 deletions conda/environments/all_cuda-124_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,28 @@ dependencies:
- cuda-profiler-api
- cuda-sanitizer-api
- cuda-version=12.4
- cudf==24.08.*,>=0.0.0a0
- cudf==24.10.*,>=0.0.0a0
- cupy>=12.0.0
- cupynumeric==25.01.*,>=0.0.0.dev0
- cxx-compiler
- cython>=3.0.0
- dask-cuda==24.08.*
- dask-cudf==24.08.*
- cython>=3.0.3
- dask-cuda==24.10.*
- dask-cudf==24.10.*
- gcc_linux-64=11.*
- legate==25.01.*,>=0.0.0.dev0
- libcudf==24.08.*,>=0.0.0a0
- librmm==24.08.*,>=0.0.0a0
- libcudf==24.10.*,>=0.0.0a0
- librmm==24.10.*,>=0.0.0a0
- make
- myst-parser>=4.0
- ninja
- numpy >=1.23,<3.0.0a0
- openssh
- pydata-sphinx-theme>=0.16.0
- pylibcudf==24.10.*,>=0.0.0a0
- pytest>=7.0
- python>=3.10,<3.13
- scikit-build>=0.18.0
- setuptools>=70.0
- rapids-build-backend>=0.3.2,<0.4.0.dev0
- scikit-build-core>=0.10.0
- sphinx>=8.0
- sysroot_linux-64==2.17
- valgrind
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/legate-dataframe/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ legate_version:
- "=25.01.*,>=0.0.0.dev0"

rapids_version:
- =24.08.*
- =24.10.*
7 changes: 4 additions & 3 deletions conda/recipes/legate-dataframe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ requirements:
# is compatible with an existing cupynumeric version.
# (may also stabilize not using debug/sanitizer builds)
- cupynumeric
- cython>=3.0.0
- python
- pip
- scikit-build >=0.18.0
- setuptools >=70.0
- cython >=3.0.3
- rapids-build-backend >=0.3.0,<0.4.0.dev0
- scikit-build-core >=0.10.0
- cudf {{ rapids_version }} # pulls in pyarrow?
- libcudf {{ rapids_version }}
- librmm {{ rapids_version }}
- pylibcudf {{ rapids_version }}
run:
- python
# cuda-version is used to constrain __cuda
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake/fetch_rapids.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# the License.
# =============================================================================
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/LEGATE_DATAFRAME_RAPIDS.cmake)
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-24.08/RAPIDS.cmake
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-24.10/RAPIDS.cmake
${CMAKE_CURRENT_BINARY_DIR}/LEGATE_DATAFRAME_RAPIDS.cmake
)
endif()
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake/thirdparty/get_cudf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ function(find_and_configure_cudf)
endfunction()

find_and_configure_cudf(
VERSION 24.08 GIT_REPO https://github.com/rapidsai/cudf.git GIT_TAG branch-24.08
VERSION 24.10 GIT_REPO https://github.com/rapidsai/cudf.git GIT_TAG branch-24.10
)
9 changes: 3 additions & 6 deletions cpp/examples/hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@
#include <legate_dataframe/parquet.hpp>
#include <legate_dataframe/unaryop.hpp>

int main(int argc, char** argv)
int main(void)
{
// First we initialize Legate
int32_t errcode = legate::start(argc, argv);
if (errcode != 0) {
throw std::runtime_error("legate::start() errorcode: " + std::to_string(errcode));
}
// First we initialize Legate use either `legate` or `LEGATE_CONFIG` to customize launch
legate::start();

// Then let's create a new logical column
legate::dataframe::LogicalColumn col_a = legate::dataframe::sequence(20, -10);
Expand Down
7 changes: 2 additions & 5 deletions cpp/examples/third_party/third_party_hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@

int main(int argc, char** argv)
{
// First we initialize Legate
int32_t errcode = legate::start(argc, argv);
if (errcode != 0) {
throw std::runtime_error("legate::start() errorcode: " + std::to_string(errcode));
}
// First we initialize Legate use either `legate` or `LEGATE_CONFIG` to customize launch
legate::start();

// Then let's create a new logical column
legate::dataframe::LogicalColumn col_a = legate::dataframe::sequence(10, 0);
Expand Down
15 changes: 2 additions & 13 deletions cpp/tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,13 @@

class Environment : public ::testing::Environment {
public:
Environment(int argc, char** argv) : argc_(argc), argv_(argv) {}

void SetUp() override
{
const char* argv[] = {"./test", "--gpus", "2"}; // TODO: make configurable
int argc = 3;
EXPECT_EQ(legate::start(argc, (char**)argv), 0);
}
void SetUp() override { legate::start(); }
void TearDown() override { EXPECT_EQ(legate::finish(), 0); }

private:
int argc_;
char** argv_;
};

int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
::testing::AddGlobalTestEnvironment(new Environment(argc, argv));
::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
8 changes: 5 additions & 3 deletions cpp/tests/test_join.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ template <std::pair<std::unique_ptr<rmm::device_uvector<cudf::size_type>>,
cudf::table_view const& left_keys,
cudf::table_view const& right_keys,
cudf::null_equality compare_nulls,
rmm::cuda_stream_view stream,
rmm::device_async_resource_ref mr),
cudf::out_of_bounds_policy oob_policy = cudf::out_of_bounds_policy::DONT_CHECK>
std::unique_ptr<cudf::table> join_and_gather(
Expand All @@ -77,21 +78,22 @@ std::unique_ptr<cudf::table> join_and_gather(
std::vector<cudf::size_type> const& left_on,
std::vector<cudf::size_type> const& right_on,
cudf::null_equality compare_nulls,
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource())
{
auto left_selected = left_input.select(left_on);
auto right_selected = right_input.select(right_on);
auto const [left_join_indices, right_join_indices] =
join_impl(left_selected, right_selected, compare_nulls, mr);
join_impl(left_selected, right_selected, compare_nulls, stream, mr);

auto left_indices_span = cudf::device_span<cudf::size_type const>{*left_join_indices};
auto right_indices_span = cudf::device_span<cudf::size_type const>{*right_join_indices};

auto left_indices_col = cudf::column_view{left_indices_span};
auto right_indices_col = cudf::column_view{right_indices_span};

auto left_result = cudf::gather(left_input, left_indices_col, oob_policy);
auto right_result = cudf::gather(right_input, right_indices_col, oob_policy);
auto left_result = cudf::gather(left_input, left_indices_col, oob_policy, stream, mr);
auto right_result = cudf::gather(right_input, right_indices_col, oob_policy, stream, mr);

return std::make_unique<cudf::table>(
legate::dataframe::concat(left_result->release(), right_result->release()));
Expand Down
43 changes: 32 additions & 11 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ files:
arch: [x86_64]
includes:
- build
- rapids_build_skbuild
- cuda
- cuda_version
- depends_on_cudf
Expand Down Expand Up @@ -34,6 +35,14 @@ files:
pyproject_dir: python
extras:
table: build-system
includes:
- rapids_build_skbuild
py_rapids_build:
output: pyproject
pyproject_dir: python/
extras:
table: tool.rapids-build-backend
key: requires
includes:
- build
- depends_on_legate
Expand Down Expand Up @@ -68,10 +77,8 @@ dependencies:
- output_types: [conda, requirements, pyproject]
packages:
- cmake>=3.26.4,!=3.30.0
- cython>=3.0.0
- cython>=3.0.3
- ninja
- scikit-build>=0.18.0
- setuptools>=70.0
- output_types: [conda]
packages:
- c-compiler
Expand All @@ -92,6 +99,18 @@ dependencies:
packages:
- cuda-nvcc

rapids_build_skbuild:
common:
- output_types: [conda, requirements, pyproject]
packages:
- rapids-build-backend>=0.3.2,<0.4.0.dev0
- output_types: conda
packages:
- scikit-build-core>=0.10.0
- output_types: [requirements, pyproject]
packages:
- scikit-build-core[pyproject]>=0.10.0

cuda_version:
specific:
- output_types: conda
Expand Down Expand Up @@ -156,8 +175,8 @@ dependencies:
packages:
- cupynumeric==25.01.*,>=0.0.0.dev0
- pytest>=7.0
- dask-cuda==24.08.*
- dask-cudf==24.08.*
- dask-cuda==24.10.*
- dask-cudf==24.10.*
- output_types: conda
packages:
- cuda-sanitizer-api
Expand All @@ -168,15 +187,17 @@ dependencies:
common:
- output_types: conda
packages:
- &cudf_unsuffixed cudf==24.08.*,>=0.0.0a0
- &cudf_unsuffixed cudf==24.10.*,>=0.0.0a0
- &pylibcudf_unsuffixed pylibcudf==24.10.*,>=0.0.0a0
specific:
- output_types: [requirements, pyproject]
matrices:
- matrix:
cuda: "12.*"
cuda_suffixed: "true"
packages:
- cudf-cu12==24.08.*,>=0.0.0a0
- cudf-cu12==24.10.*,>=0.0.0a0
- pylibcudf-cu12==24.10.*,>=0.0.0a0
- {matrix: null, packages: [*cudf_unsuffixed]}

depends_on_cupy:
Expand All @@ -202,30 +223,30 @@ dependencies:
common:
- output_types: conda
packages:
- &libcudf_unsuffixed libcudf==24.08.*,>=0.0.0a0
- &libcudf_unsuffixed libcudf==24.10.*,>=0.0.0a0
specific:
- output_types: [requirements, pyproject]
matrices:
- matrix:
cuda: "12.*"
cuda_suffixed: "true"
packages:
- libcudf-cu12==24.08.*,>=0.0.0a0
- libcudf-cu12==24.10.*,>=0.0.0a0
- {matrix: null, packages: [*libcudf_unsuffixed]}

depends_on_librmm:
common:
- output_types: conda
packages:
- &librmm_unsuffixed librmm==24.08.*,>=0.0.0a0
- &librmm_unsuffixed librmm==24.10.*,>=0.0.0a0
specific:
- output_types: [requirements, pyproject]
matrices:
- matrix:
cuda: "12.*"
cuda_suffixed: "true"
packages:
- librmm-cu12==24.08.*,>=0.0.0a0
- librmm-cu12==24.10.*,>=0.0.0a0
- matrix:
packages:
- *librmm_unsuffixed
2 changes: 1 addition & 1 deletion python/legate_dataframe/lib/binaryop.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from libc.stdint cimport int32_t

from cudf._lib.pylibcudf.types cimport data_type
from pylibcudf.types cimport data_type

from legate_dataframe.lib.core.column cimport LogicalColumn, cpp_LogicalColumn
from legate_dataframe.lib.core.data_type cimport as_data_type
Expand Down
4 changes: 2 additions & 2 deletions python/legate_dataframe/lib/core/column.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ from libcpp cimport bool
from libcpp.memory cimport unique_ptr
from libcpp.string cimport string

from cudf._lib.pylibcudf.libcudf.column.column cimport column, column_view
from cudf._lib.pylibcudf.types cimport data_type
from pylibcudf.libcudf.column.column cimport column, column_view
from pylibcudf.types cimport data_type

from legate_dataframe.lib.core.legate_task cimport cpp_AutoTask
from legate_dataframe.lib.core.logical_array cimport cpp_LogicalArray
Expand Down
2 changes: 1 addition & 1 deletion python/legate_dataframe/lib/core/column.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ from libcpp.string cimport string
from libcpp.utility cimport move

from cudf._lib.column cimport Column as cudfColumn
from cudf._lib.pylibcudf.libcudf.column.column cimport column
from pylibcudf.libcudf.column.column cimport column

from legate_dataframe.lib.core.legate_task cimport get_auto_task_handle
from legate_dataframe.lib.core.logical_array cimport cpp_LogicalArray
Expand Down
2 changes: 1 addition & 1 deletion python/legate_dataframe/lib/core/data_type.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# distutils: language = c++
# cython: language_level=3

from cudf._lib.pylibcudf.types cimport data_type as cpp_cudf_type
from pylibcudf.types cimport data_type as cpp_cudf_type


cdef cpp_cudf_type as_data_type(data_type_like)
Expand Down
6 changes: 3 additions & 3 deletions python/legate_dataframe/lib/core/data_type.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# cython: language_level=3


from cudf._lib.pylibcudf.types cimport DataType
from cudf._lib.pylibcudf.types cimport data_type as cpp_cudf_type
from cudf._lib.types cimport underlying_type_t_type_id
from pylibcudf.types cimport DataType
from pylibcudf.types cimport data_type as cpp_cudf_type

import cudf
from cudf._lib import pylibcudf
import pylibcudf
from cudf._lib.types import PYLIBCUDF_TO_SUPPORTED_NUMPY_TYPES, dtype_to_pylibcudf_type
from numpy.typing import DTypeLike

Expand Down
2 changes: 1 addition & 1 deletion python/legate_dataframe/lib/core/scalar.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from libcpp cimport bool
from libcpp.memory cimport unique_ptr

from cudf._lib.pylibcudf.libcudf.scalar.scalar cimport scalar as cudf_cpp_scalar
from pylibcudf.libcudf.scalar.scalar cimport scalar as cudf_cpp_scalar


cdef extern from "legate.h" nogil:
Expand Down
4 changes: 2 additions & 2 deletions python/legate_dataframe/lib/groupby_aggregation.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
from libcpp.string cimport string
from libcpp.vector cimport vector

from cudf._lib.pylibcudf.aggregation cimport aggregation as cudf_agg
from pylibcudf.aggregation cimport aggregation as cudf_agg

from legate_dataframe.lib.core.table cimport LogicalTable, cpp_LogicalTable

from typing import Iterable, Tuple

from cudf._lib.pylibcudf.libcudf.aggregation import Kind as AggregationKind
from pylibcudf.libcudf.aggregation import Kind as AggregationKind

from legate_dataframe.utils import _track_provenance

Expand Down
Loading

0 comments on commit d43d878

Please sign in to comment.