Skip to content

ENH:TST Make changes needed to make xsf work as CuPy submodule and add proof of concept CuPy tests. #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/gpu_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: GPU jobs

on: [ push, pull_request ]

permissions:
contents: read # to fetch code (actions/checkout)

env:
CCACHE_DIR: "${{ github.workspace }}/.ccache"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
cupy_tests:
name: CuPy GPU
runs-on: ghcr.io/cirruslabs/ubuntu-runner-amd64-gpu:22.04
steps:
- name: Checkout xsf repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive

- name: Setup compiler cache
uses: cirruslabs/cache@v4 #caa3ad0624c6c2acd8ba50ad452d1f44bba078bb # v4
with:
path: ${{ env.CCACHE_DIR }}
# Make primary key unique by using `run_id`, this ensures the cache
# is always saved at the end.
key: ${{ runner.os }}-gpu-ccache-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-gpu-ccache

- name: run nvidia-smi
run: nvidia-smi

- name: run nvidia-smi --query
run: nvidia-smi --query

- uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1
with:
pixi-version: v0.39.2
manifest-path: pixi.toml
cache: false

- name: Run CuPy tests
run: pixi run test-cupy
11 changes: 8 additions & 3 deletions include/xsf/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ XSF_HOST_DEVICE inline bool signbit(double x) { return cuda::std::signbit(x); }
XSF_HOST_DEVICE inline double hypot(double x, double y) { return cuda::std::hypot(x, y); }

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

template <typename T>
using invoke_result = cuda::std::invoke_result<T>;
template <typename F>
struct invoke_result {
using type = decltype(cuda::std::declval<F>()());
};

template <typename F>
using invoke_result_t = typename invoke_result<F>::type;

template <typename T1, typename T2>
using pair = cuda::std::pair<T1, T2>;
Expand Down
Loading
Loading