From 838245b77ee33f6611cc5bdffc05e3755722259d Mon Sep 17 00:00:00 2001 From: Chaithya G R Date: Tue, 26 Nov 2024 11:03:49 +0100 Subject: [PATCH 1/9] WIP --- include/finufft_opts.h | 1 + src/finufft_core.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/finufft_opts.h b/include/finufft_opts.h index 372bbbb6f..d8334ffba 100644 --- a/include/finufft_opts.h +++ b/include/finufft_opts.h @@ -12,6 +12,7 @@ typedef struct finufft_opts { // defaults see finufft_core.cpp:finufft_default_o int modeord; // (type 1,2 only): 0 CMCL-style increasing mode order // 1 FFT-style mode order int chkbnds; // [DEPRECATED] 0 don't check NU pts in [-3pi,3pi), 1 do (spread_kerpad = 1; o->upsampfac = 0.0; o->spread_thread = 0; + o->spreadinterponly = 0; o->maxbatchsize = 0; o->spread_nthr_atomic = -1; o->spread_max_sp_size = 0; @@ -1047,7 +1048,8 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { deconvolveBatch(thisBatchSize, this, fkb); t_deconv += timer.elapsedsec(); } - + if (opts.spreadinterponly) + continue; // STEP 2: call the FFT on this batch timer.restart(); do_fft(this); From a033f3b410662810515ba35d47b15e318aab25cb Mon Sep 17 00:00:00 2001 From: Chaithya G R Date: Fri, 6 Dec 2024 11:11:13 +0100 Subject: [PATCH 2/9] Added support to do spread interp only --- src/finufft_core.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/finufft_core.cpp b/src/finufft_core.cpp index c8b78c86a..2b6a99476 100644 --- a/src/finufft_core.cpp +++ b/src/finufft_core.cpp @@ -1044,18 +1044,21 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { if (type == 1) { // type 1: spread NU pts X, weights cj, to fw grid spreadinterpSortedBatch(thisBatchSize, this, cjb); t_sprint += timer.elapsedsec(); - } else { // type 2: amplify Fourier coeffs fk into 0-padded fw + // Stop here if it is spread interp only. + if (opts.spreadinterponly) + continue; + } else if(!opts.spreadinterponly) { // type 2: amplify Fourier coeffs fk into 0-padded fw, but dont do it if it is spread interp only. deconvolveBatch(thisBatchSize, this, fkb); t_deconv += timer.elapsedsec(); } - if (opts.spreadinterponly) - continue; - // STEP 2: call the FFT on this batch - timer.restart(); - do_fft(this); - t_fft += timer.elapsedsec(); - if (opts.debug > 1) printf("\tFFT exec:\t\t%.3g s\n", timer.elapsedsec()); - + if (!opts.spreadinterponly) // Do FFT only if its not spread interp only. + { + // STEP 2: call the FFT on this batch + timer.restart(); + do_fft(this); + t_fft += timer.elapsedsec(); + if (opts.debug > 1) printf("\tFFT exec:\t\t%.3g s\n", timer.elapsedsec()); + } // STEP 3: (varies by type) timer.restart(); if (type == 1) { // type 1: deconvolve (amplify) fw and shuffle to fk From a67b7172f0248e5517a84d69ffce369cf18e90dd Mon Sep 17 00:00:00 2001 From: Chaithya G R Date: Fri, 6 Dec 2024 12:05:03 +0100 Subject: [PATCH 3/9] double free and wrap --- include/finufft/utils.h | 16 ++++++++++++++++ src/finufft_core.cpp | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/finufft/utils.h b/include/finufft/utils.h index 0b875fdfe..426502753 100644 --- a/include/finufft/utils.h +++ b/include/finufft/utils.h @@ -12,6 +12,22 @@ namespace finufft { namespace utils { +// Simple helper to wrap pointer in std::vector and release it later +template +void wrapArrayInVector( T *sourceArray, size_t arraySize, std::vector > &targetVector ) { + typename std::_Vector_base >::_Vector_impl *vectorPtr = + (typename std::_Vector_base >::_Vector_impl *)((void *) &targetVector); + vectorPtr->_M_start = sourceArray; + vectorPtr->_M_finish = vectorPtr->_M_end_of_storage = vectorPtr->_M_start + arraySize; +} + +template +void releaseVectorWrapper( std::vector > &targetVector ) { + typename std::_Vector_base >::_Vector_impl *vectorPtr = + (typename std::_Vector_base >::_Vector_impl *)((void *) &targetVector); + vectorPtr->_M_start = vectorPtr->_M_finish = vectorPtr->_M_end_of_storage = NULL; +} + // ahb's low-level array helpers template FINUFFT_EXPORT T FINUFFT_CDECL relerrtwonorm(BIGINT n, const std::complex *a, diff --git a/src/finufft_core.cpp b/src/finufft_core.cpp index 2b6a99476..3d1c82a19 100644 --- a/src/finufft_core.cpp +++ b/src/finufft_core.cpp @@ -1042,6 +1042,10 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { // STEP 1: (varies by type) timer.restart(); if (type == 1) { // type 1: spread NU pts X, weights cj, to fw grid + if (opts.spreadinterponly) + { + wrapArrayInVector(fkb, thisBatchSize*N, this->fwBatch); + } spreadinterpSortedBatch(thisBatchSize, this, cjb); t_sprint += timer.elapsedsec(); // Stop here if it is spread interp only. @@ -1059,6 +1063,8 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { t_fft += timer.elapsedsec(); if (opts.debug > 1) printf("\tFFT exec:\t\t%.3g s\n", timer.elapsedsec()); } + else + wrapArrayInVector(cjb, thisBatchSize*nj, this->fwBatch); // STEP 3: (varies by type) timer.restart(); if (type == 1) { // type 1: deconvolve (amplify) fw and shuffle to fk @@ -1068,6 +1074,10 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { spreadinterpSortedBatch(thisBatchSize, this, cjb); t_sprint += timer.elapsedsec(); } + // Release the fwBatch vector to prevent double freeing of memory. + if(opts.spreadinterponly) + releaseVectorWrapper(this->fwBatch); + } // ........end b loop if (opts.debug) { // report total times in their natural order... From d77cbb1200c0b005d7dd4f25855c508df8197460 Mon Sep 17 00:00:00 2001 From: Chaithya G R Date: Fri, 6 Dec 2024 12:17:18 +0100 Subject: [PATCH 4/9] Remove unwanted creation --- src/finufft_core.cpp | 71 +++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/src/finufft_core.cpp b/src/finufft_core.cpp index 3d1c82a19..5ea3fbb98 100644 --- a/src/finufft_core.cpp +++ b/src/finufft_core.cpp @@ -561,8 +561,9 @@ FINUFFT_PLAN_T::FINUFFT_PLAN_T(int type_, int dim_, const BIGINT *n_modes, i printf("[%s] new plan: FINUFFT version " FINUFFT_VER " .................\n", __func__); - fftPlan = std::make_unique>( - opts.fftw_lock_fun, opts.fftw_unlock_fun, opts.fftw_lock_data); + if (!opts.spreadinterponly) // Dont make plans if only spread or interpolate + fftPlan = std::make_unique>( + opts.fftw_lock_fun, opts.fftw_unlock_fun, opts.fftw_lock_data); if ((type != 1) && (type != 2) && (type != 3)) { fprintf(stderr, "[%s] Invalid type (%d), should be 1, 2 or 3.\n", __func__, type); @@ -696,39 +697,41 @@ FINUFFT_PLAN_T::FINUFFT_PLAN_T(int type_, int dim_, const BIGINT *n_modes, i printf(" spread_thread=%d\n", opts.spread_thread); } - // STEP 0: get Fourier coeffs of spreading kernel along each fine grid dim - CNTime timer; - timer.start(); - onedim_fseries_kernel(nf1, phiHat1, spopts); - if (dim > 1) onedim_fseries_kernel(nf2, phiHat2, spopts); - if (dim > 2) onedim_fseries_kernel(nf3, phiHat3, spopts); - if (opts.debug) - printf("[%s] kernel fser (ns=%d):\t\t%.3g s\n", __func__, spopts.nspread, - timer.elapsedsec()); - - nf = nf1 * nf2 * nf3; // fine grid total number of points - if (nf * batchSize > MAX_NF) { - fprintf( - stderr, - "[%s] fwBatch would be bigger than MAX_NF, not attempting memory allocation!\n", - __func__); - throw int(FINUFFT_ERR_MAXNALLOC); + if(!opts.spreadinterponly) // We dont need fseries if it is spreadinterponly. + { + // STEP 0: get Fourier coeffs of spreading kernel along each fine grid dim + CNTime timer; + timer.start(); + onedim_fseries_kernel(nf1, phiHat1, spopts); + if (dim > 1) onedim_fseries_kernel(nf2, phiHat2, spopts); + if (dim > 2) onedim_fseries_kernel(nf3, phiHat3, spopts); + if (opts.debug) + printf("[%s] kernel fser (ns=%d):\t\t%.3g s\n", __func__, spopts.nspread, + timer.elapsedsec()); + + nf = nf1 * nf2 * nf3; // fine grid total number of points + if (nf * batchSize > MAX_NF) { + fprintf( + stderr, + "[%s] fwBatch would be bigger than MAX_NF, not attempting memory allocation!\n", + __func__); + throw int(FINUFFT_ERR_MAXNALLOC); + } + + timer.restart(); + fwBatch.resize(nf * batchSize); // the big workspace + if (opts.debug) + printf("[%s] fwBatch %.2fGB alloc: \t%.3g s\n", __func__, + (double)1E-09 * sizeof(std::complex) * nf * batchSize, + timer.elapsedsec()); + + timer.restart(); // plan the FFTW + const auto ns = gridsize_for_fft(this); + fftPlan->plan(ns, batchSize, fwBatch.data(), fftSign, opts.fftw, nthr_fft); + if (opts.debug) + printf("[%s] FFT plan (mode %d, nthr=%d):\t%.3g s\n", __func__, opts.fftw, nthr_fft, + timer.elapsedsec()); } - - timer.restart(); - fwBatch.resize(nf * batchSize); // the big workspace - if (opts.debug) - printf("[%s] fwBatch %.2fGB alloc: \t%.3g s\n", __func__, - (double)1E-09 * sizeof(std::complex) * nf * batchSize, - timer.elapsedsec()); - - timer.restart(); // plan the FFTW - const auto ns = gridsize_for_fft(this); - fftPlan->plan(ns, batchSize, fwBatch.data(), fftSign, opts.fftw, nthr_fft); - if (opts.debug) - printf("[%s] FFT plan (mode %d, nthr=%d):\t%.3g s\n", __func__, opts.fftw, nthr_fft, - timer.elapsedsec()); - } else { // -------------------------- type 3 (no planning) ------------ if (opts.debug) printf("[%s] %dd%d: ntrans=%d\n", __func__, dim, type, ntrans); From 2094338674cbde669595f305888c49d8dd46a5bc Mon Sep 17 00:00:00 2001 From: Chaithya G R Date: Fri, 6 Dec 2024 12:18:44 +0100 Subject: [PATCH 5/9] Remove unwanted resizing --- src/finufft_core.cpp | 54 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/finufft_core.cpp b/src/finufft_core.cpp index 5ea3fbb98..552cb0d47 100644 --- a/src/finufft_core.cpp +++ b/src/finufft_core.cpp @@ -670,35 +670,35 @@ FINUFFT_PLAN_T::FINUFFT_PLAN_T(int type_, int dim_, const BIGINT *n_modes, i __func__, (double)(EPSILON * mu)); } - // determine fine grid sizes, sanity check.. - int nfier = set_nf_type12(ms, opts, spopts, &nf1); - if (nfier) throw nfier; // nf too big; we're done - phiHat1.resize(nf1 / 2 + 1); - if (dim > 1) { - nfier = set_nf_type12(mt, opts, spopts, &nf2); - if (nfier) throw nfier; - phiHat2.resize(nf2 / 2 + 1); - } - if (dim > 2) { - nfier = set_nf_type12(mu, opts, spopts, &nf3); - if (nfier) throw nfier; - phiHat3.resize(nf3 / 2 + 1); - } - - if (opts.debug) { // "long long" here is to avoid warnings with printf... - printf("[%s] %dd%d: (ms,mt,mu)=(%lld,%lld,%lld) " - "(nf1,nf2,nf3)=(%lld,%lld,%lld)\n ntrans=%d nthr=%d " - "batchSize=%d ", - __func__, dim, type, (long long)ms, (long long)mt, (long long)mu, - (long long)nf1, (long long)nf2, (long long)nf3, ntrans, nthr, batchSize); - if (batchSize == 1) // spread_thread has no effect in this case - printf("\n"); - else - printf(" spread_thread=%d\n", opts.spread_thread); - } - if(!opts.spreadinterponly) // We dont need fseries if it is spreadinterponly. { + // determine fine grid sizes, sanity check.. + int nfier = set_nf_type12(ms, opts, spopts, &nf1); + if (nfier) throw nfier; // nf too big; we're done + phiHat1.resize(nf1 / 2 + 1); + if (dim > 1) { + nfier = set_nf_type12(mt, opts, spopts, &nf2); + if (nfier) throw nfier; + phiHat2.resize(nf2 / 2 + 1); + } + if (dim > 2) { + nfier = set_nf_type12(mu, opts, spopts, &nf3); + if (nfier) throw nfier; + phiHat3.resize(nf3 / 2 + 1); + } + + if (opts.debug) { // "long long" here is to avoid warnings with printf... + printf("[%s] %dd%d: (ms,mt,mu)=(%lld,%lld,%lld) " + "(nf1,nf2,nf3)=(%lld,%lld,%lld)\n ntrans=%d nthr=%d " + "batchSize=%d ", + __func__, dim, type, (long long)ms, (long long)mt, (long long)mu, + (long long)nf1, (long long)nf2, (long long)nf3, ntrans, nthr, batchSize); + if (batchSize == 1) // spread_thread has no effect in this case + printf("\n"); + else + printf(" spread_thread=%d\n", opts.spread_thread); + } + // STEP 0: get Fourier coeffs of spreading kernel along each fine grid dim CNTime timer; timer.start(); From d0d60feadb393be59917f47c4635f7a1daf66755 Mon Sep 17 00:00:00 2001 From: Chaithya G R Date: Fri, 6 Dec 2024 14:39:33 +0100 Subject: [PATCH 6/9] Working codes with mri-nufft --- python/finufft/finufft/_finufft.py | 1 + src/finufft_core.cpp | 24 ++++++++++++++---------- src/spreadinterp.cpp | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/python/finufft/finufft/_finufft.py b/python/finufft/finufft/_finufft.py index 10af6829c..7b52b43e4 100644 --- a/python/finufft/finufft/_finufft.py +++ b/python/finufft/finufft/_finufft.py @@ -73,6 +73,7 @@ class FinufftOpts(ctypes.Structure): FinufftOpts._fields_ = [('modeord', c_int), ('chkbnds', c_int), + ('spreadinterponly', c_int), ('debug', c_int), ('spread_debug', c_int), ('showwarn', c_int), diff --git a/src/finufft_core.cpp b/src/finufft_core.cpp index 552cb0d47..958474de1 100644 --- a/src/finufft_core.cpp +++ b/src/finufft_core.cpp @@ -670,20 +670,24 @@ FINUFFT_PLAN_T::FINUFFT_PLAN_T(int type_, int dim_, const BIGINT *n_modes, i __func__, (double)(EPSILON * mu)); } + int nfier = set_nf_type12(ms, opts, spopts, &nf1); + if (nfier) throw nfier; // nf too big; we're done + if (dim > 1) { + nfier = set_nf_type12(mt, opts, spopts, &nf2); + if (nfier) throw nfier; + } + if (dim > 2) { + nfier = set_nf_type12(mu, opts, spopts, &nf3); + if (nfier) throw nfier; + } if(!opts.spreadinterponly) // We dont need fseries if it is spreadinterponly. { // determine fine grid sizes, sanity check.. - int nfier = set_nf_type12(ms, opts, spopts, &nf1); - if (nfier) throw nfier; // nf too big; we're done phiHat1.resize(nf1 / 2 + 1); if (dim > 1) { - nfier = set_nf_type12(mt, opts, spopts, &nf2); - if (nfier) throw nfier; phiHat2.resize(nf2 / 2 + 1); } if (dim > 2) { - nfier = set_nf_type12(mu, opts, spopts, &nf3); - if (nfier) throw nfier; phiHat3.resize(nf3 / 2 + 1); } @@ -1046,14 +1050,15 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { timer.restart(); if (type == 1) { // type 1: spread NU pts X, weights cj, to fw grid if (opts.spreadinterponly) - { wrapArrayInVector(fkb, thisBatchSize*N, this->fwBatch); - } spreadinterpSortedBatch(thisBatchSize, this, cjb); t_sprint += timer.elapsedsec(); // Stop here if it is spread interp only. if (opts.spreadinterponly) + { + releaseVectorWrapper(this->fwBatch); continue; + } } else if(!opts.spreadinterponly) { // type 2: amplify Fourier coeffs fk into 0-padded fw, but dont do it if it is spread interp only. deconvolveBatch(thisBatchSize, this, fkb); t_deconv += timer.elapsedsec(); @@ -1067,7 +1072,7 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { if (opts.debug > 1) printf("\tFFT exec:\t\t%.3g s\n", timer.elapsedsec()); } else - wrapArrayInVector(cjb, thisBatchSize*nj, this->fwBatch); + wrapArrayInVector(fkb, thisBatchSize*N, this->fwBatch); // STEP 3: (varies by type) timer.restart(); if (type == 1) { // type 1: deconvolve (amplify) fw and shuffle to fk @@ -1080,7 +1085,6 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { // Release the fwBatch vector to prevent double freeing of memory. if(opts.spreadinterponly) releaseVectorWrapper(this->fwBatch); - } // ........end b loop if (opts.debug) { // report total times in their natural order... diff --git a/src/spreadinterp.cpp b/src/spreadinterp.cpp index f6cf925e0..be1abfeb0 100644 --- a/src/spreadinterp.cpp +++ b/src/spreadinterp.cpp @@ -2160,7 +2160,7 @@ FINUFFT_EXPORT int FINUFFT_CDECL setup_spreader(finufft_spread_opts &opts, T eps upsampfac); return FINUFFT_ERR_HORNER_WRONG_BETA; } - if (upsampfac <= 1.0) { // no digits would result + if (upsampfac < 1.0) { // no digits would result fprintf(stderr, "FINUFFT setup_spreader: error, upsampfac=%.3g is <=1.0\n", upsampfac); return FINUFFT_ERR_UPSAMPFAC_TOO_SMALL; From 305482bec3d934bf855b580d35e9e38ba889c44f Mon Sep 17 00:00:00 2001 From: Chaithya G R Date: Mon, 9 Dec 2024 15:46:05 +0100 Subject: [PATCH 7/9] Fixes, update API --- include/finufft/finufft_core.h | 1 + src/finufft_core.cpp | 20 +++++--------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/include/finufft/finufft_core.h b/include/finufft/finufft_core.h index 92237b707..d34f60b8f 100644 --- a/include/finufft/finufft_core.h +++ b/include/finufft/finufft_core.h @@ -62,6 +62,7 @@ #include #include #include +#include // All indexing in library that potentially can exceed 2^31 uses 64-bit signed. // This includes all calling arguments (eg M,N) that could be huge someday. diff --git a/src/finufft_core.cpp b/src/finufft_core.cpp index 958474de1..ad4b8155f 100644 --- a/src/finufft_core.cpp +++ b/src/finufft_core.cpp @@ -424,8 +424,7 @@ static void deconvolveshuffle3d(int dir, T prefac, std::vector &ker1, // --------- batch helper functions for t1,2 exec: --------------------------- template -static int spreadinterpSortedBatch(int batchSize, FINUFFT_PLAN_T *p, - std::complex *cBatch) +static int spreadinterpSortedBatch(int batchSize, FINUFFT_PLAN_T *p, std::complex *fwBatch, std::complex *cBatch) /* Spreads (or interpolates) a batch of batchSize strength vectors in cBatch to (or from) the batch of fine working grids p->fwBatch, using the same set of @@ -447,7 +446,7 @@ static int spreadinterpSortedBatch(int batchSize, FINUFFT_PLAN_T *p, #endif #pragma omp parallel for num_threads(nthr_outer) for (int i = 0; i < batchSize; i++) { - std::complex *fwi = p->fwBatch.data() + i * p->nf; // start of i'th fw array in + std::complex *fwi = fwBatch + i * p->nf; // start of i'th fw array in // wkspace std::complex *ci = cBatch + i * p->nj; // start of i'th c array in cBatch spreadinterpSorted(p->sortIndices, p->nf1, p->nf2, p->nf3, (T *)fwi, p->nj, p->X, @@ -1049,16 +1048,11 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { // STEP 1: (varies by type) timer.restart(); if (type == 1) { // type 1: spread NU pts X, weights cj, to fw grid - if (opts.spreadinterponly) - wrapArrayInVector(fkb, thisBatchSize*N, this->fwBatch); - spreadinterpSortedBatch(thisBatchSize, this, cjb); + spreadinterpSortedBatch(thisBatchSize, this, opts.spreadinterponly? fkb: this->fwBatch.data(), cjb); t_sprint += timer.elapsedsec(); // Stop here if it is spread interp only. if (opts.spreadinterponly) - { - releaseVectorWrapper(this->fwBatch); continue; - } } else if(!opts.spreadinterponly) { // type 2: amplify Fourier coeffs fk into 0-padded fw, but dont do it if it is spread interp only. deconvolveBatch(thisBatchSize, this, fkb); t_deconv += timer.elapsedsec(); @@ -1071,20 +1065,16 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { t_fft += timer.elapsedsec(); if (opts.debug > 1) printf("\tFFT exec:\t\t%.3g s\n", timer.elapsedsec()); } - else - wrapArrayInVector(fkb, thisBatchSize*N, this->fwBatch); // STEP 3: (varies by type) timer.restart(); if (type == 1) { // type 1: deconvolve (amplify) fw and shuffle to fk deconvolveBatch(thisBatchSize, this, fkb); t_deconv += timer.elapsedsec(); } else { // type 2: interpolate unif fw grid to NU target pts - spreadinterpSortedBatch(thisBatchSize, this, cjb); + spreadinterpSortedBatch(thisBatchSize, this, opts.spreadinterponly? fkb: this->fwBatch.data(), cjb); t_sprint += timer.elapsedsec(); } // Release the fwBatch vector to prevent double freeing of memory. - if(opts.spreadinterponly) - releaseVectorWrapper(this->fwBatch); } // ........end b loop if (opts.debug) { // report total times in their natural order... @@ -1135,7 +1125,7 @@ int FINUFFT_PLAN_T::execute(std::complex *cj, std::complex *fk) { // STEP 1: spread c'_j batch (x'_j NU pts) into fw batch grid... timer.restart(); spopts.spread_direction = 1; // spread - spreadinterpSortedBatch(thisBatchSize, this, CpBatch.data()); // X are primed + spreadinterpSortedBatch(thisBatchSize, this, this->fwBatch.data(), CpBatch.data()); // X are primed t_spr += timer.elapsedsec(); // STEP 2: type 2 NUFFT from fw batch to user output fk array batch... From 09a9d0c4479accb81ed309b7bb65abc8c2c083bf Mon Sep 17 00:00:00 2001 From: Chaithya G R Date: Tue, 10 Dec 2024 08:49:35 +0100 Subject: [PATCH 8/9] remove unwanted changes --- include/finufft/utils.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/include/finufft/utils.h b/include/finufft/utils.h index 426502753..0b875fdfe 100644 --- a/include/finufft/utils.h +++ b/include/finufft/utils.h @@ -12,22 +12,6 @@ namespace finufft { namespace utils { -// Simple helper to wrap pointer in std::vector and release it later -template -void wrapArrayInVector( T *sourceArray, size_t arraySize, std::vector > &targetVector ) { - typename std::_Vector_base >::_Vector_impl *vectorPtr = - (typename std::_Vector_base >::_Vector_impl *)((void *) &targetVector); - vectorPtr->_M_start = sourceArray; - vectorPtr->_M_finish = vectorPtr->_M_end_of_storage = vectorPtr->_M_start + arraySize; -} - -template -void releaseVectorWrapper( std::vector > &targetVector ) { - typename std::_Vector_base >::_Vector_impl *vectorPtr = - (typename std::_Vector_base >::_Vector_impl *)((void *) &targetVector); - vectorPtr->_M_start = vectorPtr->_M_finish = vectorPtr->_M_end_of_storage = NULL; -} - // ahb's low-level array helpers template FINUFFT_EXPORT T FINUFFT_CDECL relerrtwonorm(BIGINT n, const std::complex *a, From 90a067516d895d180006eff3a0818da2d144b1b3 Mon Sep 17 00:00:00 2001 From: Chaithya G R Date: Tue, 10 Dec 2024 08:50:21 +0100 Subject: [PATCH 9/9] remove span --- include/finufft/finufft_core.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/finufft/finufft_core.h b/include/finufft/finufft_core.h index d34f60b8f..92237b707 100644 --- a/include/finufft/finufft_core.h +++ b/include/finufft/finufft_core.h @@ -62,7 +62,6 @@ #include #include #include -#include // All indexing in library that potentially can exceed 2^31 uses 64-bit signed. // This includes all calling arguments (eg M,N) that could be huge someday.