From 2704a2219c5d16f224ee10ac5f0985a9c19d83b5 Mon Sep 17 00:00:00 2001 From: Alexander Droste Date: Wed, 3 Jun 2026 11:20:39 +0000 Subject: [PATCH] Derive host metadata from exported schema Signed-off-by: Alexander Droste --- .github/workflows/ci.yml | 5 +++-- CMakeLists.txt | 2 +- src/main.cpp | 30 +++++++++++++++++++----------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aedcf11..de1904f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ permissions: jobs: build: name: Build - runs-on: runs-on=${{ github.run_id }}/runner=gpu/tag=cudf-test-harness + runs-on: runs-on=${{ github.run_id }}/family=g5+g4dn+g6.*/cpu=8/image=ubuntu24-gpu-x64/spot=true/extras=s3-cache/tag=cudf-test-harness container: image: nvidia/cuda:13.0.0-devel-ubuntu24.04 @@ -58,7 +58,8 @@ jobs: - name: Build run: | cmake -S . -B build -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CUDA_ARCHITECTURES=90-virtual \ -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc \ -DCMAKE_C_COMPILER_LAUNCHER=sccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ diff --git a/CMakeLists.txt b/CMakeLists.txt index a71cb6b..901d737 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ FetchContent_Declare( GIT_REPOSITORY https://github.com/rapidsai/cudf.git # rapidsai/cudf#22620: fix Arrow Device string-view imports with producer-owned # ArrowArray.private_data. - GIT_TAG 2a2b126f870bb1d1fdad62ac1c726ccad6001ec6 + GIT_TAG 3ad0f0c9aeed6e5a521b07587e97c58943a714f7 SOURCE_SUBDIR cpp ) FetchContent_MakeAvailable(cudf) diff --git a/src/main.cpp b/src/main.cpp index bff5031..26e9b4f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,7 +2,9 @@ #include #include #include +#include #include +#include #include #include @@ -152,27 +154,33 @@ int run_check(const char *library_path) { } } - // Convert to cuDF column view using from_arrow_device_column - std::cout << "\nConverting to cuDF column view...\n"; + std::cout << "\nConverting to cuDF table view...\n"; try { auto table = cudf::from_arrow_device(&schema, &device_array); std::cout << "Conversion successful!\n\n"; - // convert to host array, call the verifier inside of the shared library. + // Round-trip to host Arrow and validate in the producer library. auto host_array = cudf::to_arrow_host(*table); - auto host_metadata = std::vector{ - cudf::column_metadata{"prims"}, - cudf::column_metadata{"decimals"}, - cudf::column_metadata{"strings"}, - cudf::column_metadata{"dates"}, - }; + auto host_metadata = std::vector{}; + auto const num_columns = table->num_columns(); + if (schema.n_children != num_columns || schema.children == nullptr) { + throw std::runtime_error("exported schema does not match imported table"); + } + host_metadata.reserve(num_columns); + for (auto i = 0; i < num_columns; ++i) { + auto const child_schema = schema.children[i]; + if (child_schema == nullptr || child_schema->name == nullptr) { + throw std::runtime_error("exported schema child is missing a name"); + } + host_metadata.push_back(cudf::column_metadata{child_schema->name}); + } auto host_schema = cudf::to_arrow_schema(*table, host_metadata); if (validate_array(host_schema.get(), &host_array->array) != 0) { - std::cerr << "\nValidation failed!\n"; + throw std::runtime_error("validation failed"); } } catch (const std::exception &e) { - std::cerr << "Error: Failed to convert Arrow array to cuDF column: " << e.what() << "\n"; + std::cerr << "Error: Failed to validate Arrow device export with cuDF: " << e.what() << "\n"; // Release the Arrow array if (device_array.array.release) {