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

Ignore nmodes input for type 3 on GPU #580

Merged
merged 1 commit into from
Oct 18, 2024
Merged
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
16 changes: 13 additions & 3 deletions src/cuda/cufinufft.cu
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
#include <cufinufft.h>
#include <cufinufft/impl.h>

inline bool is_invalid_mode_array(int dim, const int64_t *modes64, int32_t modes32[3]) {
inline bool is_invalid_mode_array(int type, int dim, const int64_t *modes64,
int32_t modes32[3]) {
if (type == 3) {
modes32[0] = modes32[1] = modes32[2] = 1;
return false;
}

int64_t tot_size = 1;
for (int i = 0; i < dim; ++i) {
if (modes64[i] > std::numeric_limits<int32_t>::max()) return true;
Expand All @@ -28,7 +34,9 @@ int cufinufftf_makeplan(int type, int dim, const int64_t *nmodes, int iflag, int
}

int nmodes32[3];
if (is_invalid_mode_array(dim, nmodes, nmodes32)) return FINUFFT_ERR_NDATA_NOTVALID;
if (is_invalid_mode_array(type, dim, nmodes, nmodes32)) {
return FINUFFT_ERR_NDATA_NOTVALID;
}

return cufinufft_makeplan_impl(type, dim, nmodes32, iflag, ntransf, tol,
(cufinufft_plan_t<float> **)d_plan_ptr, opts);
Expand All @@ -42,7 +50,9 @@ int cufinufft_makeplan(int type, int dim, const int64_t *nmodes, int iflag, int
}

int nmodes32[3];
if (is_invalid_mode_array(dim, nmodes, nmodes32)) return FINUFFT_ERR_NDATA_NOTVALID;
if (is_invalid_mode_array(type, dim, nmodes, nmodes32)) {
return FINUFFT_ERR_NDATA_NOTVALID;
}

return cufinufft_makeplan_impl(type, dim, nmodes32, iflag, ntransf, tol,
(cufinufft_plan_t<double> **)d_plan_ptr, opts);
Expand Down
Loading