@@ -51,8 +51,6 @@ use vortex_array::validity::Validity;
5151use vortex_buffer:: Buffer ;
5252use vortex_buffer:: ByteBufferMut ;
5353use vortex_buffer:: buffer;
54- #[ cfg( unix) ]
55- use vortex_cuda_macros:: cuda_tests;
5654use vortex_dtype:: DType ;
5755use vortex_dtype:: DecimalDType ;
5856use vortex_dtype:: Nullability ;
@@ -1636,130 +1634,3 @@ async fn main_test() -> Result<(), Box<dyn std::error::Error>> {
16361634
16371635 Ok ( ( ) )
16381636}
1639-
1640- #[ cfg( unix) ]
1641- #[ cuda_tests]
1642- mod cuda_tests {
1643- use std:: sync:: Arc ;
1644- use std:: sync:: LazyLock ;
1645-
1646- use futures:: StreamExt ;
1647- use vortex_array:: IntoArray ;
1648- use vortex_array:: arrays:: PrimitiveArray ;
1649- use vortex_array:: arrays:: StructArray ;
1650- use vortex_array:: arrays:: VarBinViewArray ;
1651- use vortex_array:: expr:: session:: ExprSession ;
1652- use vortex_array:: session:: ArraySession ;
1653- use vortex_array:: validity:: Validity ;
1654- use vortex_buffer:: buffer;
1655- use vortex_cuda:: CanonicalCudaExt ;
1656- use vortex_cuda:: CopyDeviceReadAt ;
1657- use vortex_cuda:: CudaSession ;
1658- use vortex_cuda:: CudaSessionExt ;
1659- use vortex_cuda:: executor:: CudaArrayExt ;
1660- use vortex_dtype:: FieldNames ;
1661- use vortex_error:: VortexResult ;
1662- use vortex_io:: session:: RuntimeSession ;
1663- use vortex_io:: session:: RuntimeSessionExt ;
1664- use vortex_io:: std_file:: FileReadAt ;
1665- use vortex_layout:: layouts:: flat:: writer:: FlatLayoutStrategy ;
1666- use vortex_layout:: session:: LayoutSession ;
1667- use vortex_session:: VortexSession ;
1668-
1669- use crate :: OpenOptionsSessionExt ;
1670- use crate :: WriteOptionsSessionExt ;
1671-
1672- static SESSION : LazyLock < VortexSession > = LazyLock :: new ( || {
1673- let mut session = VortexSession :: empty ( )
1674- . with :: < ArraySession > ( )
1675- . with :: < LayoutSession > ( )
1676- . with :: < ExprSession > ( )
1677- . with :: < RuntimeSession > ( )
1678- . with :: < CudaSession > ( ) ;
1679-
1680- vortex_cuda:: initialize_cuda ( & session. cuda_session ( ) ) ;
1681- crate :: register_default_encodings ( & mut session) ;
1682-
1683- session
1684- } ) ;
1685-
1686- #[ tokio:: test]
1687- async fn gpu_scan ( ) -> VortexResult < ( ) > {
1688- use vortex_alp:: alp_encode;
1689-
1690- assert ! (
1691- std:: env:: var( "FLAT_LAYOUT_INLINE_ARRAY_NODE" ) . is_ok( ) ,
1692- "gpu_scan test must be run with FLAT_LAYOUT_INLINE_ARRAY_NODE=1"
1693- ) ;
1694-
1695- // Create an ALP-encoded array from primitive f64 values
1696- let primitive = PrimitiveArray :: from_iter ( ( 0 ..100 ) . map ( |i| i as f64 * 1.1 ) ) ;
1697- let alp_array = alp_encode ( & primitive, None ) ?;
1698- let str_array = VarBinViewArray :: from_iter_str ( ( 0 ..100 ) . map ( |i| format ! ( "number {i}" ) ) ) ;
1699- let array = StructArray :: new (
1700- FieldNames :: from ( vec ! [ "float_col" , "int_col" , "str_col" ] ) ,
1701- vec ! [
1702- primitive. into_array( ) ,
1703- alp_array. into_array( ) ,
1704- str_array. into_array( ) ,
1705- ] ,
1706- 100 ,
1707- Validity :: NonNullable ,
1708- ) ;
1709-
1710- let flat_strategy = Arc :: new ( FlatLayoutStrategy :: default ( ) ) ;
1711-
1712- // Write to a buffer, then to a temp file
1713- let temp_path = std:: env:: temp_dir ( ) . join ( "gpu_scan_test.vortex" ) ;
1714- let mut buf = Vec :: new ( ) ;
1715- SESSION
1716- . write_options ( )
1717- // write with flat strategy, don't try and compress
1718- . with_strategy ( flat_strategy)
1719- . write ( & mut buf, array. to_array_stream ( ) )
1720- . await ?;
1721- std:: fs:: write ( & temp_path, & buf) ?;
1722-
1723- // Read back via GPU
1724- let handle = SESSION . handle ( ) ;
1725- let source = Arc :: new ( FileReadAt :: open ( & temp_path, handle) ?) ;
1726- let gpu_reader =
1727- CopyDeviceReadAt :: new ( source. clone ( ) , SESSION . cuda_session ( ) . new_stream ( ) ?) ;
1728- let cpu_reader = source;
1729-
1730- let cpu_file = SESSION . open_options ( ) . open_read ( cpu_reader) . await ?;
1731- let gpu_file = SESSION
1732- . open_options ( )
1733- . with_footer ( cpu_file. footer )
1734- . open_read ( gpu_reader)
1735- . await ?;
1736-
1737- let mut cuda_ctx = CudaSession :: create_execution_ctx ( & SESSION ) ?;
1738-
1739- let mut res = Vec :: new ( ) ;
1740- let mut stream = gpu_file
1741- . scan ( ) ?
1742- // filter with a predefined mask
1743- . with_row_indices ( buffer ! [ 0 , 10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 ] )
1744- . into_array_stream ( ) ?;
1745- while let Some ( a) = stream. next ( ) . await {
1746- let a = a?;
1747- let array = a
1748- . execute_cuda ( & mut cuda_ctx)
1749- . await ?
1750- . into_host ( )
1751- . await ?
1752- . into_array ( ) ;
1753- res. push ( array) ;
1754- }
1755-
1756- for a in res {
1757- println ! ( "a {} " , a. display_tree( ) )
1758- }
1759-
1760- // Cleanup
1761- std:: fs:: remove_file ( & temp_path) ?;
1762-
1763- Ok ( ( ) )
1764- }
1765- }
0 commit comments