Skip to content

Commit 901f320

Browse files
committed
GH-46165: [C++] Add cuda option to Meson configuration
1 parent 586ed92 commit 901f320

File tree

4 files changed

+89
-1
lines changed

4 files changed

+89
-1
lines changed

cpp/meson.build

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ needs_s3 = get_option('s3')
6565
needs_filesystem = get_option('filesystem') or needs_azure or needs_gcs or needs_hdfs or needs_s3
6666
needs_integration = get_option('integration')
6767
needs_tests = get_option('tests')
68-
needs_ipc = get_option('ipc') or needs_tests or needs_benchmarks
68+
needs_cuda = get_option('cuda')
69+
needs_ipc = get_option('ipc') or needs_tests or needs_benchmarks or needs_cuda
6970
needs_testing = get_option('testing') or needs_tests or needs_benchmarks or needs_integration
7071
needs_json = get_option('json') or needs_testing
7172

cpp/meson.options

+7
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ option(
3636
value: false,
3737
)
3838

39+
option(
40+
'cuda',
41+
type: 'boolean',
42+
description: 'Build the Arrow CUDA extensions (requires CUDA toolkit)',
43+
value: false,
44+
)
45+
3946
option(
4047
'filesystem',
4148
type: 'boolean',

cpp/src/arrow/gpu/meson.build

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
cuda_dep = dependency('cuda')
19+
20+
arrow_cuda_srcs = [
21+
'cuda_arrow_ipc.cc',
22+
'cuda_context.cc',
23+
'cuda_internal.cc',
24+
'cuda_memory.cc',
25+
]
26+
27+
arrow_cuda_lib = library(
28+
'arrow-cuda',
29+
sources: [arrow_cuda_srcs],
30+
dependencies: [arrow_dep, cuda_dep, flatbuffers_dep],
31+
cpp_args: ['-DARROW_CUDA_EXPORTING'],
32+
)
33+
34+
arrow_cuda_dep = declare_dependency(
35+
link_with: [arrow_cuda_lib],
36+
dependencies: [cuda_dep],
37+
)
38+
39+
cuda_version = cuda_dep.version()
40+
cuda_split_version = cuda_version.split('.')
41+
cuda_conf_data = configuration_data()
42+
cuda_conf_data.set('CUDA_VERSION_MAJOR', cuda_split_version[0])
43+
cuda_conf_data.set('CUDA_VERSION_MINOR', cuda_split_version[1])
44+
45+
configure_file(
46+
input: 'cuda_version.h.in',
47+
output: 'cuda_version.h',
48+
configuration: cuda_conf_data,
49+
install_dir: 'arrow/gpu',
50+
)
51+
52+
install_headers(
53+
[
54+
'cuda_api.h',
55+
'cuda_arrow_ipc.h',
56+
'cuda_context.h',
57+
'cuda_internal.h',
58+
'cuda_memory.h',
59+
'visibility.h',
60+
],
61+
subdir: 'arrow/gpu',
62+
)
63+
64+
exc = executable(
65+
'arrow-cuda-test',
66+
sources: ['cuda_test.cc'],
67+
dependencies: [arrow_test_dep, arrow_cuda_dep],
68+
)
69+
test('arrow-cuda-test', exc)
70+
71+
exc = executable(
72+
'arrow-cuda-benchmark',
73+
sources: ['cuda_benchmark.cc'],
74+
dependencies: [arrow_benchmark_dep, arrow_cuda_dep],
75+
)
76+
benchmark('arrow-gpu-cuda-benchmark', exc)

cpp/src/arrow/meson.build

+4
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,10 @@ if needs_csv
621621
subdir('csv')
622622
endif
623623

624+
if needs_cuda
625+
subdir('gpu')
626+
endif
627+
624628
if needs_filesystem
625629
subdir('filesystem')
626630
endif

0 commit comments

Comments
 (0)