Skip to content

Commit 0b523c1

Browse files
committed
update
Signed-off-by: Andrew Duffy <andrew@a10y.dev>
1 parent bf87ef3 commit 0b523c1

File tree

7 files changed

+99
-145
lines changed

7 files changed

+99
-145
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,13 +537,13 @@ jobs:
537537
--no-fail-fast \
538538
--target x86_64-unknown-linux-gnu \
539539
--verbose
540-
- name: Build cudf-test library
541-
run: cargo +nightly build --locked -p vortex-cudf-test --target x86_64-unknown-linux-gnu
540+
- name: Build cudf test library
541+
run: cargo +nightly build --locked -p vortex-test-e2e-cuda --target x86_64-unknown-linux-gnu
542542
- name: Download and run cudf-test-harness
543543
run: |
544544
curl -fsSL https://github.com/vortex-data/cudf-test-harness/releases/latest/download/cudf-test-harness-x86_64.tar.gz | tar -xz
545545
cd cudf-test-harness-x86_64
546-
./cudf-test-harness check $GITHUB_WORKSPACE/target/x86_64-unknown-linux-gnu/debug/libvortex_cudf_test.so
546+
./cudf-test-harness check $GITHUB_WORKSPACE/target/x86_64-unknown-linux-gnu/debug/libvortex_test_e2e_cuda.so
547547
548548
rust-test-other:
549549
name: "Rust tests (${{ matrix.os }})"

Cargo.lock

Lines changed: 3 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ members = [
2626
"vortex-duckdb",
2727
"vortex-cuda",
2828
"vortex-cuda/cub",
29-
"vortex-cuda/cudf-test",
3029
"vortex-cuda/macros",
3130
"vortex-cuda/nvcomp",
3231
"vortex-cxx",

vortex-cuda/cudf-test/Cargo.toml

Lines changed: 0 additions & 30 deletions
This file was deleted.

vortex-cuda/cudf-test/src/lib.rs

Lines changed: 0 additions & 90 deletions
This file was deleted.

vortex-test/e2e-cuda/Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ repository = { workspace = true }
1212
rust-version = { workspace = true }
1313
version = { workspace = true }
1414

15+
[lib]
16+
crate-type = ["cdylib"]
17+
1518
[lints]
1619
workspace = true
1720

1821
[dependencies]
19-
cudarc = { workspace = true }
20-
rstest = { workspace = true }
21-
tokio = { workspace = true, features = ["rt", "macros"] }
22-
vortex-array = { workspace = true, features = ["_test-harness"] }
22+
arrow-schema = { workspace = true, features = ["ffi"] }
23+
futures = { workspace = true, features = ["executor"] }
24+
vortex = { workspace = true }
2325
vortex-cuda = { workspace = true, features = ["_test-harness"] }
24-
vortex-error = { workspace = true }

vortex-test/e2e-cuda/src/lib.rs

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,90 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
//! End-to-end CUDA tests for Vortex.
4+
//! This file is a simple C-compatible API that is called from the cudf-test-harness at CI time.
5+
//!
6+
//! The flow is
7+
//!
8+
//! * test harness calls `dlopen` in this library
9+
//! * invokes the `export_array` function to get back the device array
10+
//! * pass the arrays to `cudf`'s `from_arrow_device_column`
11+
//! * run some operations on the loaded column view
12+
//! * call `array->release()` to drop the data allocated from the Rust side
13+
14+
#![allow(clippy::unwrap_used, clippy::expect_used)]
15+
16+
use std::sync::LazyLock;
17+
18+
use arrow_schema::ffi::FFI_ArrowSchema;
19+
use futures::executor::block_on;
20+
use vortex::array::Array;
21+
use vortex::array::IntoArray;
22+
use vortex::array::arrays::DecimalArray;
23+
use vortex::array::arrays::PrimitiveArray;
24+
use vortex::array::arrays::StructArray;
25+
use vortex::array::arrays::VarBinViewArray;
26+
use vortex::array::session::ArraySession;
27+
use vortex::array::validity::Validity;
28+
use vortex::dtype::DecimalDType;
29+
use vortex::dtype::FieldNames;
30+
use vortex::expr::session::ExprSession;
31+
use vortex::io::session::RuntimeSession;
32+
use vortex::layout::session::LayoutSession;
33+
use vortex::metrics::VortexMetrics;
34+
use vortex::session::VortexSession;
35+
use vortex_cuda::CudaSession;
36+
use vortex_cuda::arrow::ArrowDeviceArray;
37+
use vortex_cuda::arrow::DeviceArrayExt;
38+
39+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
40+
VortexSession::empty()
41+
.with::<VortexMetrics>()
42+
.with::<ArraySession>()
43+
.with::<LayoutSession>()
44+
.with::<ExprSession>()
45+
.with::<RuntimeSession>()
46+
.with::<CudaSession>()
47+
});
48+
49+
#[unsafe(no_mangle)]
50+
pub extern "C" fn export_array(
51+
schema_ptr: &mut FFI_ArrowSchema,
52+
array_ptr: &mut ArrowDeviceArray,
53+
) -> i32 {
54+
let mut ctx = CudaSession::create_execution_ctx(&SESSION).unwrap();
55+
56+
let primitive = PrimitiveArray::from_iter(0u32..1024);
57+
let string =
58+
VarBinViewArray::from_iter_str((0..1024).map(|idx| format!("this is string {idx}")));
59+
let decimal = DecimalArray::from_iter(0i64..1024, DecimalDType::new(19, 2));
60+
61+
let array = StructArray::new(
62+
FieldNames::from_iter(["prims", "strings", "decimals"]),
63+
vec![
64+
primitive.into_array(),
65+
string.into_array(),
66+
decimal.into_array(),
67+
],
68+
1024,
69+
Validity::NonNullable,
70+
)
71+
.into_array();
72+
73+
let data_type = array
74+
.dtype()
75+
.to_arrow_dtype()
76+
.expect("converting schema to Arrow DataType");
77+
78+
*schema_ptr = FFI_ArrowSchema::try_from(data_type).expect("data_type to FFI_ArrowSchema");
79+
80+
match block_on(array.export_device_array(&mut ctx)) {
81+
Ok(exported) => {
82+
*array_ptr = exported;
83+
0
84+
}
85+
Err(err) => {
86+
eprintln!("error in export_device_array: {err}");
87+
1
88+
}
89+
}
90+
}

0 commit comments

Comments
 (0)