Skip to content

Commit e1e951c

Browse files
zeroshadeloicalleyne
authored andcommitted
apacheGH-37523: [C++][CI][CUDA] Don't use newer API and add missing CUDA dependencies (apache#37497)
### Rationale for this change apache#37365 was built locally using a newer version of the CUDA driver API than the crossbow builds run with causing the crossbow build to fail due to a change in macro names. This puts the macro name back to allow it to build with the older version of the cuda driver api. * Closes: apache#37523 Authored-by: Matt Topol <[email protected]> Signed-off-by: Matt Topol <[email protected]>
1 parent b9efba5 commit e1e951c

File tree

7 files changed

+19
-15
lines changed

7 files changed

+19
-15
lines changed

cpp/src/arrow/c/bridge_test.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -1222,9 +1222,7 @@ class MyDevice : public Device {
12221222

12231223
virtual ~MySyncEvent() = default;
12241224
Status Wait() override { return Status::OK(); }
1225-
Status Record(const Device::Stream&, const unsigned int) override {
1226-
return Status::OK();
1227-
}
1225+
Status Record(const Device::Stream&) override { return Status::OK(); }
12281226
};
12291227

12301228
protected:

cpp/src/arrow/device.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,9 @@ class ARROW_EXPORT Device : public std::enable_shared_from_this<Device>,
166166
/// @brief Block until sync event is completed.
167167
virtual Status Wait() = 0;
168168

169-
inline Status Record(const Stream& st) { return Record(st, 0); }
170-
171169
/// @brief Record the wrapped event on the stream so it triggers
172170
/// the event when the stream gets to that point in its queue.
173-
virtual Status Record(const Stream&, const unsigned int flags) = 0;
171+
virtual Status Record(const Stream&) = 0;
174172

175173
protected:
176174
/// If creating this with a passed in event, the caller must ensure

cpp/src/arrow/gpu/ArrowCUDAConfig.cmake.in

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ include(CMakeFindDependencyMacro)
3030
find_dependency(Arrow)
3131
if(CMAKE_VERSION VERSION_LESS 3.17)
3232
find_package(CUDA REQUIRED)
33+
add_library(ArrowCUDA::cuda_driver SHARED IMPORTED)
34+
set_target_properties(ArrowCUDA::cuda_driver
35+
PROPERTIES IMPORTED_LOCATION "${CUDA_CUDA_LIBRARY}"
36+
INTERFACE_INCLUDE_DIRECTORIES "${CUDA_INCLUDE_DIRS}")
3337
else()
3438
find_package(CUDAToolkit REQUIRED)
3539
endif()

cpp/src/arrow/gpu/CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ endif()
3232
set(ARROW_CUDA_LINK_LIBS arrow::flatbuffers)
3333
if(CMAKE_VERSION VERSION_LESS 3.17)
3434
find_package(CUDA REQUIRED)
35-
set(ARROW_CUDA_SHARED_LINK_LIBS ${CUDA_CUDA_LIBRARY})
36-
include_directories(SYSTEM ${CUDA_INCLUDE_DIRS})
35+
add_library(ArrowCUDA::cuda_driver SHARED IMPORTED)
36+
set_target_properties(ArrowCUDA::cuda_driver
37+
PROPERTIES IMPORTED_LOCATION "${CUDA_CUDA_LIBRARY}"
38+
INTERFACE_INCLUDE_DIRECTORIES "${CUDA_INCLUDE_DIRS}")
39+
set(ARROW_CUDA_SHARED_LINK_LIBS ArrowCUDA::cuda_driver)
3740
else()
3841
# find_package(CUDA) is deprecated, and for newer CUDA, it doesn't
3942
# recognize that the CUDA driver library is in the "stubs" dir, but
@@ -61,6 +64,7 @@ add_arrow_lib(arrow_cuda
6164
${ARROW_CUDA_SHARED_LINK_LIBS}
6265
SHARED_INSTALL_INTERFACE_LIBS
6366
Arrow::arrow_shared
67+
${ARROW_CUDA_SHARED_LINK_LIBS}
6468
# Static arrow_cuda must also link against CUDA shared libs
6569
STATIC_LINK_LIBS
6670
${ARROW_CUDA_LINK_LIBS}

cpp/src/arrow/gpu/arrow-cuda.pc.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ libdir=@ARROW_PKG_CONFIG_LIBDIR@
2222
Name: Apache Arrow CUDA
2323
Description: CUDA integration library for Apache Arrow
2424
Version: @ARROW_VERSION@
25-
Requires: arrow
25+
Requires: arrow cuda
2626
Libs: -L${libdir} -larrow_cuda
2727
Cflags: -I${includedir}

cpp/src/arrow/gpu/cuda_context.cc

+5-5
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ Status CudaDevice::Stream::WaitEvent(const Device::SyncEvent& event) {
322322
}
323323

324324
ContextSaver set_temporary(reinterpret_cast<CUcontext>(context_.get()->handle()));
325-
CU_RETURN_NOT_OK("cuStreamWaitEvent",
326-
cuStreamWaitEvent(value(), cu_event, CU_EVENT_WAIT_DEFAULT));
325+
// we are currently building with CUDA toolkit 11.0.3 which doesn't have enum
326+
// values for the flags yet. The "flags" param *must* be 0 for now.
327+
CU_RETURN_NOT_OK("cuStreamWaitEvent", cuStreamWaitEvent(value(), cu_event, 0));
327328
return Status::OK();
328329
}
329330

@@ -339,15 +340,14 @@ Status CudaDevice::SyncEvent::Wait() {
339340
return Status::OK();
340341
}
341342

342-
Status CudaDevice::SyncEvent::Record(const Device::Stream& st, const unsigned int flags) {
343+
Status CudaDevice::SyncEvent::Record(const Device::Stream& st) {
343344
auto cuda_stream = checked_cast<const CudaDevice::Stream*, const Device::Stream*>(&st);
344345
if (!cuda_stream) {
345346
return Status::Invalid("CudaDevice::Event cannot record on non-cuda stream");
346347
}
347348

348349
ContextSaver set_temporary(reinterpret_cast<CUcontext>(context_.get()->handle()));
349-
CU_RETURN_NOT_OK("cuEventRecordWithFlags",
350-
cuEventRecordWithFlags(value(), cuda_stream->value(), flags));
350+
CU_RETURN_NOT_OK("cuEventRecord", cuEventRecord(value(), cuda_stream->value()));
351351
return Status::OK();
352352
}
353353

cpp/src/arrow/gpu/cuda_context.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class ARROW_EXPORT CudaDevice : public Device {
212212
///
213213
/// Once the stream completes the tasks previously added to it,
214214
/// it will trigger the event.
215-
Status Record(const Device::Stream&, const unsigned int) override;
215+
Status Record(const Device::Stream&) override;
216216

217217
protected:
218218
friend class CudaMemoryManager;

0 commit comments

Comments
 (0)