Skip to content

Commit 000f8dc

Browse files
authored
cuda: update interface to take 64-bit M (#411)
* cuda: change to int64_t for number of pts While the interface changes, we still won't allow more than 2e9 points (for now) since this will complicate the code quite a bit with little tangible benefits (transforms these size are currently out of range for most GPUs in terms of memory consumption). * cuda+py: update py interface to deal with 64-bit M * cuda: update CHANGELOG wrt new setpts API * ci: no cache for Jenkins * docs: fix typos in CHANGELOG * cuda: remove const qualifiers for setpts
1 parent 684a447 commit 000f8dc

File tree

5 files changed

+27
-17
lines changed

5 files changed

+27
-17
lines changed

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ V 2.3.0beta (6/21/24)
2929
Created a .clang-format file to define the style similar to the existing style.
3030
Applied clang-format to all cmake, C, C++, and CUDA code. Ignored the blame
3131
using .git-blame-ignore-revs. Added a contributing.md for developers.
32+
* cuFINUFFT interface update: number of nonuniform points M is now a 64-bit integer
33+
as opposed to 32-bit. While this does modify the ABI, most code will just need to
34+
recompile against the new library as compilers will silently upcast any 32-bit
35+
integers to 64-bit when calling cufinufft(f)_setpts. Note that internally, 32-bit
36+
integers are still used, so calling cufinufft with more than 2e9 points will fail.
37+
This restriction may be lifted in the future.
3238

3339
V 2.2.0 (12/12/23)
3440

Jenkinsfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ pipeline {
4646
sh '${PYBIN}/python3 -m venv $HOME'
4747
sh '''#!/bin/bash -ex
4848
source $HOME/bin/activate
49-
python3 -m pip install --upgrade pip
50-
python3 -m pip install --upgrade pycuda cupy-cuda112 numba
51-
python3 -m pip install torch==1.10.2+cu111 -f https://download.pytorch.org/whl/torch_stable.html
52-
python3 -m pip install python/cufinufft
53-
python3 -m pip install pytest
49+
python3 -m pip install --no-cache-dir --upgrade pip
50+
python3 -m pip install --no-cache-dir --upgrade pycuda cupy-cuda112 numba
51+
python3 -m pip install --no-cache-dir torch==1.10.2+cu111 -f https://download.pytorch.org/whl/torch_stable.html
52+
python3 -m pip install --no-cache-dir python/cufinufft
53+
python3 -m pip install --no-cache-dir pytest
5454
python -c "from numba import cuda; cuda.cudadrv.libs.test()"
5555
python3 -m pytest --framework=pycuda python/cufinufft
5656
python3 -m pytest --framework=numba python/cufinufft

include/cufinufft.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ int cufinufft_makeplan(int type, int dim, const int64_t *n_modes, int iflag, int
1919
int cufinufftf_makeplan(int type, int dim, const int64_t *n_modes, int iflag, int ntr,
2020
float eps, cufinufftf_plan *d_plan_ptr, cufinufft_opts *opts);
2121

22-
int cufinufft_setpts(cufinufft_plan d_plan, int M, double *d_x, double *d_y, double *d_z,
23-
int N, double *d_s, double *d_t, double *d_u);
24-
int cufinufftf_setpts(cufinufftf_plan d_plan, int M, float *d_x, float *d_y, float *d_z,
25-
int N, float *d_s, float *d_t, float *d_u);
22+
int cufinufft_setpts(cufinufft_plan d_plan, int64_t M, double *d_x, double *d_y,
23+
double *d_z, int N, double *d_s, double *d_t, double *d_u);
24+
int cufinufftf_setpts(cufinufftf_plan d_plan, int64_t M, float *d_x, float *d_y,
25+
float *d_z, int N, float *d_s, float *d_t, float *d_u);
2626

2727
int cufinufft_execute(cufinufft_plan d_plan, cuDoubleComplex *d_c, cuDoubleComplex *d_fk);
2828
int cufinufftf_execute(cufinufftf_plan d_plan, cuFloatComplex *d_c, cuFloatComplex *d_fk);

python/cufinufft/cufinufft/_cufinufft.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ class NufftOpts(ctypes.Structure):
102102

103103
_set_pts = lib.cufinufft_setpts
104104
_set_pts.argtypes = [
105-
c_void_p, c_int, c_void_p, c_void_p, c_void_p, ctypes.c_int, c_double_p,
105+
c_void_p, c_int64, c_void_p, c_void_p, c_void_p, ctypes.c_int, c_double_p,
106106
c_double_p, c_double_p]
107107
_set_pts.restype = c_int
108108

109109
_set_ptsf = lib.cufinufftf_setpts
110110
_set_ptsf.argtypes = [
111-
c_void_p, c_int, c_void_p, c_void_p, c_void_p, ctypes.c_int, c_float_p,
111+
c_void_p, c_int64, c_void_p, c_void_p, c_void_p, ctypes.c_int, c_float_p,
112112
c_float_p, c_float_p]
113113
_set_ptsf.restype = c_int
114114

src/cuda/cufinufft.cu

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,19 @@ int cufinufft_makeplan(int type, int dim, const int64_t *nmodes, int iflag, int
4848
(cufinufft_plan_t<double> **)d_plan_ptr, opts);
4949
}
5050

51-
int cufinufftf_setpts(cufinufftf_plan d_plan, int M, float *d_x, float *d_y, float *d_z,
52-
int N, float *d_s, float *d_t, float *d_u) {
53-
return cufinufft_setpts_impl(M, d_x, d_y, d_z, N, d_s, d_t, d_u,
51+
int cufinufftf_setpts(cufinufftf_plan d_plan, const int64_t M, float *d_x, float *d_y,
52+
float *d_z, int N, float *d_s, float *d_t, float *d_u) {
53+
if (M > std::numeric_limits<int32_t>::max()) return FINUFFT_ERR_NDATA_NOTVALID;
54+
55+
return cufinufft_setpts_impl((int)M, d_x, d_y, d_z, N, d_s, d_t, d_u,
5456
(cufinufft_plan_t<float> *)d_plan);
5557
}
5658

57-
int cufinufft_setpts(cufinufft_plan d_plan, int M, double *d_x, double *d_y, double *d_z,
58-
int N, double *d_s, double *d_t, double *d_u) {
59-
return cufinufft_setpts_impl(M, d_x, d_y, d_z, N, d_s, d_t, d_u,
59+
int cufinufft_setpts(cufinufft_plan d_plan, const int64_t M, double *d_x, double *d_y,
60+
double *d_z, int N, double *d_s, double *d_t, double *d_u) {
61+
if (M > std::numeric_limits<int32_t>::max()) return FINUFFT_ERR_NDATA_NOTVALID;
62+
63+
return cufinufft_setpts_impl((int)M, d_x, d_y, d_z, N, d_s, d_t, d_u,
6064
(cufinufft_plan_t<double> *)d_plan);
6165
}
6266

0 commit comments

Comments
 (0)