paleolimbot commented on code in PR #484:
URL: https://github.com/apache/arrow-nanoarrow/pull/484#discussion_r1639828662


##########
src/nanoarrow/meson.build:
##########
@@ -202,4 +230,37 @@ if get_option('tests')
           test(name, exc, timeout: config['timeout'])
       endforeach
   endif
+
+  if needs_device
+    device_tests = ['nanoarrow_device', 'nanoarrow_device_hpp']
+    foreach device_test : device_tests
+      exc = executable(
+          device_test.replace('_', '-') + '-test',
+          device_test + '_test.cc',
+          link_with: nanoarrow_device_lib,
+          dependencies: [nanoarrow_dep, gtest_dep],
+      )
+      test(device_test.replace('_', '-'), exc)
+    endforeach
+
+    if get_option('metal')
+      exc = executable(
+          'nanoarrow-device-metal-test',
+          'nanoarrow_device_metal_test.cc',
+          link_with: nanoarrow_device_lib,
+          dependencies: [nanoarrow_dep, gtest_dep, metal_cpp_dep],
+      )
+      test('nanoarrow-device-metal', exc)

Review Comment:
   There also needs to be a compile define here `-DNANOARROW_DEVICE_WITH_METAL` 
(I think the error you were seeing might have happened even with this enabled 
if you don't have a Mac with a GPU; however, I'm seeing it also with the Meson 
build.
   
   Also see https://github.com/apache/arrow-nanoarrow/pull/527 for a few 
updates to the metal build (+ adding it to CI).



##########
src/nanoarrow/meson.build:
##########
@@ -80,6 +80,34 @@ if get_option('ipc')
                                            dependencies: [nanoarrow_dep, 
flatcc_dep])
 endif
 
+needs_device = get_option('device') or get_option('metal') or 
get_option('cuda')
+if needs_device
+  device_deps = [nanoarrow_dep]
+  device_srcs = ['nanoarrow_device.c']
+
+  if get_option('metal')
+    metal_dep = dependency('appleframeworks', modules: ['Foundation', 'Metal'])
+    metal_cpp_dep = dependency('metal-cpp')
+    device_deps += metal_dep
+    device_deps += metal_cpp_dep
+    device_srcs += 'nanoarrow_device_metal.cc'
+  endif
+
+  if get_option('cuda')
+    cuda_dep = dependency('cuda', modules: ['cuda_driver'])
+    device_deps += cuda_dep
+    device_srcs += 'nanoarrow_device_cuda.cc'

Review Comment:
   ```suggestion
       device_srcs += 'nanoarrow_device_cuda.c'
   ```



##########
src/nanoarrow/meson.build:
##########
@@ -80,6 +80,34 @@ if get_option('ipc')
                                            dependencies: [nanoarrow_dep, 
flatcc_dep])
 endif
 
+needs_device = get_option('device') or get_option('metal') or 
get_option('cuda')
+if needs_device
+  device_deps = [nanoarrow_dep]
+  device_srcs = ['nanoarrow_device.c']
+
+  if get_option('metal')
+    metal_dep = dependency('appleframeworks', modules: ['Foundation', 'Metal'])
+    metal_cpp_dep = dependency('metal-cpp')
+    device_deps += metal_dep
+    device_deps += metal_cpp_dep
+    device_srcs += 'nanoarrow_device_metal.cc'
+  endif
+
+  if get_option('cuda')
+    cuda_dep = dependency('cuda', modules: ['cuda_driver'])

Review Comment:
   I tried a number of things here, but ultimately was unable to make the 
linking work properly. We need `libcuda.so`, which I couldn't find in the Meson 
CUDA sources. It's the "driver" library/API, which the `cudart` would also need 
to link; however, I think the Meson CUDA stuff is almost 100% designed for 
`nvcc`, and we're using regular `gcc` (i.e., we're not actually using NVIDIA's 
compiler, we're using a regular compiler and linking to the library).
   
   It's fine to error here for now until somebody with both Meson experience 
and a graphics card feels like debugging this!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to