Skip to content

Commit 749349d

Browse files
authored
chore(ci): Add CUDA runner for testing device extension (#490)
This PR adds the INFRA-provided runner `["self-hosted", "cuda"]` so that PRs that modify CUDA code get better CI feedback (before this, the extension pretty much was only ever built on my local setup). The self-hosted runner is running an older linux than the usual `ubuntu-latest`, so a few modifications were needed to reflect compiler warning policies. The cache key we were using for Arrow C++ is also no longer sufficient for the device workflow because a cache restore results in an unusable Arrow C++ static library on the self-hosted runner. This shouldn't be necessary for much longer (just until Arrow C++-dependent tests are factored out and run separately).
1 parent 1872799 commit 749349d

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

.github/workflows/build-and-test-device.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
- {runner: ubuntu-latest, label: namespaced-build, cmake_args: "-DNANOARROW_NAMESPACE=SomeUserNamespace"}
4848
- {runner: ubuntu-latest, label: bundled-build, cmake_args: "-DNANOARROW_DEVICE_BUNDLE=ON"}
4949
- {runner: macOS-latest, label: with-metal, cmake_args: "-DNANOARROW_DEVICE_WITH_METAL=ON"}
50+
- {runner: ["self-hosted", "cuda"], label: with-cuda, cmake_args: "-DNANOARROW_DEVICE_WITH_CUDA=ON"}
5051

5152

5253
steps:
@@ -57,13 +58,30 @@ jobs:
5758
run: |
5859
sudo apt-get update && sudo apt-get install -y valgrind
5960
61+
# The self-hosted runner for CUDA does not have cmake preinstalled.
62+
# We need at least CMake 3.17 for FindCUDAToolkit.
63+
- name: Ensure CMake
64+
if: matrix.config.label == 'with-cuda'
65+
run: |
66+
mkdir tmp_cmake && cd tmp_cmake
67+
CMAKE_VERSION="3.22.1"
68+
curl -L https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz |
69+
tar -zxf -
70+
CMAKE_PATH=$(find $(pwd) -name "bin")
71+
echo "PATH=${CMAKE_PATH}:${PATH}" >> $GITHUB_ENV
72+
# Debug install location of cuda toolkit
73+
ldconfig -p | grep libcuda
74+
6075
- name: Cache Arrow C++ Build
6176
id: cache-arrow-build
6277
uses: actions/cache@v4
6378
with:
6479
path: arrow
6580
# Bump the number at the end of this line to force a new Arrow C++ build
66-
key: arrow-${{ runner.os }}-${{ runner.arch }}-1
81+
# The self-hosted runner needs its own Arrow build since it is running
82+
# a much older linux distribution. When the Arrow C++ requirement for tests is
83+
# dropped, we don't have to use this at all as part of the CI configuration.
84+
key: arrow-device-${{ runner.os }}-${{ runner.arch }}-${{ matrix.config.label }}-1
6785

6886
- name: Build Arrow C++
6987
if: steps.cache-arrow-build.outputs.cache-hit != 'true'
@@ -74,8 +92,13 @@ jobs:
7492
- name: Build
7593
run: |
7694
ARROW_PATH="$(pwd)/arrow"
95+
96+
# Debug arrow includes
97+
find "${ARROW_PATH}"
98+
7799
mkdir build
78100
cd build
101+
export VERBOSE=1
79102
cmake .. -DCMAKE_BUILD_TYPE=Debug -DNANOARROW_DEVICE=ON \
80103
-DNANOARROW_BUILD_TESTS=ON -DCMAKE_PREFIX_PATH="${ARROW_PATH}" \
81104
${{ matrix.config.cmake_args }}

src/nanoarrow/common/inline_buffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static inline uint16_t ArrowFloatToHalfFloat(float value) {
9191

9292
uint16_t sn = (uint16_t)((u.b >> 31) & 0x1);
9393
uint16_t exp = (u.b >> 23) & 0xff;
94-
int16_t res = (int16_t)exp - 127 + 15;
94+
int16_t res = (int16_t)(exp - 127 + 15);
9595
uint16_t fc = (uint16_t)(u.b >> 13) & 0x3ff;
9696

9797
if (exp == 0) {

src/nanoarrow/common/inline_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ static inline void ArrowDecimalInit(struct ArrowDecimal* decimal, int32_t bitwid
882882
memset(decimal->words, 0, sizeof(decimal->words));
883883
decimal->precision = precision;
884884
decimal->scale = scale;
885-
decimal->n_words = bitwidth / 8 / sizeof(uint64_t);
885+
decimal->n_words = (int)(bitwidth / 8 / sizeof(uint64_t));
886886

887887
if (_ArrowIsLittleEndian()) {
888888
decimal->low_word_index = 0;

src/nanoarrow/device/cuda_test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
#include <gtest/gtest.h>
2121
#include <tuple>
2222

23-
#include "nanoarrow/nanoarrow_device.h"
24-
#include "nanoarrow/nanoarrow_device_cuda.h"
23+
#include "nanoarrow/nanoarrow_device.hpp"
2524

2625
class CudaTemporaryContext {
2726
public:

0 commit comments

Comments
 (0)