Skip to content

Commit b6d9118

Browse files
authored
Merge pull request #39 from steppi/cupy-submodule
ENH:TST Make changes needed to make xsf work as CuPy submodule and add proof of concept CuPy tests.
2 parents 6062500 + 714dec2 commit b6d9118

File tree

6 files changed

+1309
-3
lines changed

6 files changed

+1309
-3
lines changed

.github/workflows/gpu_tests.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: GPU jobs
2+
3+
on: [ push, pull_request ]
4+
5+
permissions:
6+
contents: read # to fetch code (actions/checkout)
7+
8+
env:
9+
CCACHE_DIR: "${{ github.workspace }}/.ccache"
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
cupy_tests:
17+
name: CuPy GPU
18+
runs-on: ghcr.io/cirruslabs/ubuntu-runner-amd64-gpu:22.04
19+
steps:
20+
- name: Checkout xsf repo
21+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
22+
with:
23+
submodules: recursive
24+
25+
- name: Setup compiler cache
26+
uses: cirruslabs/cache@v4 #caa3ad0624c6c2acd8ba50ad452d1f44bba078bb # v4
27+
with:
28+
path: ${{ env.CCACHE_DIR }}
29+
# Make primary key unique by using `run_id`, this ensures the cache
30+
# is always saved at the end.
31+
key: ${{ runner.os }}-gpu-ccache-${{ github.run_id }}
32+
restore-keys: |
33+
${{ runner.os }}-gpu-ccache
34+
35+
- name: run nvidia-smi
36+
run: nvidia-smi
37+
38+
- name: run nvidia-smi --query
39+
run: nvidia-smi --query
40+
41+
- uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1
42+
with:
43+
pixi-version: v0.39.2
44+
manifest-path: pixi.toml
45+
cache: false
46+
47+
- name: Run CuPy tests
48+
run: pixi run test-cupy

include/xsf/config.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ XSF_HOST_DEVICE inline bool signbit(double x) { return cuda::std::signbit(x); }
108108
XSF_HOST_DEVICE inline double hypot(double x, double y) { return cuda::std::hypot(x, y); }
109109

110110
// Fallback to global namespace for functions unsupported on NVRTC
111-
#ifndef _LIBCUDACXX_COMPILER_NVRTC
111+
#ifndef __CUDACC_RTC__
112112
XSF_HOST_DEVICE inline double ceil(double x) { return cuda::std::ceil(x); }
113113
XSF_HOST_DEVICE inline double floor(double x) { return cuda::std::floor(x); }
114114
XSF_HOST_DEVICE inline double round(double x) { return cuda::std::round(x); }
@@ -210,8 +210,13 @@ using enable_if = cuda::std::enable_if<Cond, T>;
210210
template <typename T>
211211
using decay = cuda::std::decay<T>;
212212

213-
template <typename T>
214-
using invoke_result = cuda::std::invoke_result<T>;
213+
template <typename F>
214+
struct invoke_result {
215+
using type = decltype(cuda::std::declval<F>()());
216+
};
217+
218+
template <typename F>
219+
using invoke_result_t = typename invoke_result<F>::type;
215220

216221
template <typename T1, typename T2>
217222
using pair = cuda::std::pair<T1, T2>;

0 commit comments

Comments
 (0)