Skip to content
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

cuda: update interface to take 64-bit M #411

Merged
merged 6 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ If not stated, FINUFFT is assumed (cuFINUFFT <=1.3 is listed separately).
Created a .clang-format file to define the style similar to the existing style.
Applied clang-format to all cmake, C, C++, and CUDA code. Ignored the blame
using .git-blame-ignore-revs. Added a contributing.md for developers.
* cuFINUFFT interface update: number of nonuniform points M is now a 64-bit integer
as opposed to 32-bit. While this does modify the ABI, most code will just need to
recompile against the new library as compilers will silently upcast any 32-bit
integers to 64-bit when calling cufinufft(f)_setpts. Note that internally, 32-bit
integers are still used, so calling cufinufft with more than 2e9 points will fail.
This restriction may be listed in the future.
blackwer marked this conversation as resolved.
Show resolved Hide resolved

>>>>>>> 3d9f5a2e (cuda: update CHANGELOG wrt new setpts API)

V 2.2.0 (12/12/23)

Expand Down
10 changes: 5 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ pipeline {
sh '${PYBIN}/python3 -m venv $HOME'
sh '''#!/bin/bash -ex
source $HOME/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pycuda cupy-cuda112 numba
python3 -m pip install torch==1.10.2+cu111 -f https://download.pytorch.org/whl/torch_stable.html
python3 -m pip install python/cufinufft
python3 -m pip install pytest
python3 -m pip install --no-cache-dir --upgrade pip
python3 -m pip install --no-cache-dir --upgrade pycuda cupy-cuda112 numba
python3 -m pip install --no-cache-dir torch==1.10.2+cu111 -f https://download.pytorch.org/whl/torch_stable.html
python3 -m pip install --no-cache-dir python/cufinufft
python3 -m pip install --no-cache-dir pytest
python -c "from numba import cuda; cuda.cudadrv.libs.test()"
python3 -m pytest --framework=pycuda python/cufinufft
python3 -m pytest --framework=numba python/cufinufft
Expand Down
8 changes: 4 additions & 4 deletions include/cufinufft.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ int cufinufft_makeplan(int type, int dim, const int64_t *n_modes, int iflag, int
int cufinufftf_makeplan(int type, int dim, const int64_t *n_modes, int iflag, int ntr,
float eps, cufinufftf_plan *d_plan_ptr, cufinufft_opts *opts);

int cufinufft_setpts(cufinufft_plan d_plan, int M, double *d_x, double *d_y, double *d_z,
int N, double *d_s, double *d_t, double *d_u);
int cufinufftf_setpts(cufinufftf_plan d_plan, int M, float *d_x, float *d_y, float *d_z,
int N, float *d_s, float *d_t, float *d_u);
int cufinufft_setpts(cufinufft_plan d_plan, const int64_t M, double *d_x, double *d_y,
blackwer marked this conversation as resolved.
Show resolved Hide resolved
double *d_z, int N, double *d_s, double *d_t, double *d_u);
int cufinufftf_setpts(cufinufftf_plan d_plan, const int64_t M, float *d_x, float *d_y,
float *d_z, int N, float *d_s, float *d_t, float *d_u);

int cufinufft_execute(cufinufft_plan d_plan, cuDoubleComplex *d_c, cuDoubleComplex *d_fk);
int cufinufftf_execute(cufinufftf_plan d_plan, cuFloatComplex *d_c, cuFloatComplex *d_fk);
Expand Down
4 changes: 2 additions & 2 deletions python/cufinufft/cufinufft/_cufinufft.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ class NufftOpts(ctypes.Structure):

_set_pts = lib.cufinufft_setpts
_set_pts.argtypes = [
c_void_p, c_int, c_void_p, c_void_p, c_void_p, ctypes.c_int, c_double_p,
c_void_p, c_int64, c_void_p, c_void_p, c_void_p, ctypes.c_int, c_double_p,
c_double_p, c_double_p]
_set_pts.restype = c_int

_set_ptsf = lib.cufinufftf_setpts
_set_ptsf.argtypes = [
c_void_p, c_int, c_void_p, c_void_p, c_void_p, ctypes.c_int, c_float_p,
c_void_p, c_int64, c_void_p, c_void_p, c_void_p, ctypes.c_int, c_float_p,
c_float_p, c_float_p]
_set_ptsf.restype = c_int

Expand Down
16 changes: 10 additions & 6 deletions src/cuda/cufinufft.cu
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@ int cufinufft_makeplan(int type, int dim, const int64_t *nmodes, int iflag, int
(cufinufft_plan_t<double> **)d_plan_ptr, opts);
}

int cufinufftf_setpts(cufinufftf_plan d_plan, int M, float *d_x, float *d_y, float *d_z,
int N, float *d_s, float *d_t, float *d_u) {
return cufinufft_setpts_impl(M, d_x, d_y, d_z, N, d_s, d_t, d_u,
int cufinufftf_setpts(cufinufftf_plan d_plan, const int64_t M, float *d_x, float *d_y,
float *d_z, int N, float *d_s, float *d_t, float *d_u) {
if (M > std::numeric_limits<int32_t>::max()) return FINUFFT_ERR_NDATA_NOTVALID;

return cufinufft_setpts_impl((int)M, d_x, d_y, d_z, N, d_s, d_t, d_u,
(cufinufft_plan_t<float> *)d_plan);
}

int cufinufft_setpts(cufinufft_plan d_plan, int M, double *d_x, double *d_y, double *d_z,
int N, double *d_s, double *d_t, double *d_u) {
return cufinufft_setpts_impl(M, d_x, d_y, d_z, N, d_s, d_t, d_u,
int cufinufft_setpts(cufinufft_plan d_plan, const int64_t M, double *d_x, double *d_y,
double *d_z, int N, double *d_s, double *d_t, double *d_u) {
if (M > std::numeric_limits<int32_t>::max()) return FINUFFT_ERR_NDATA_NOTVALID;

return cufinufft_setpts_impl((int)M, d_x, d_y, d_z, N, d_s, d_t, d_u,
(cufinufft_plan_t<double> *)d_plan);
}

Expand Down
Loading