Skip to content

Commit

Permalink
fix compiler warnings; update comments; switch to ducc 0.35
Browse files Browse the repository at this point in the history
  • Loading branch information
mreineck committed Oct 21, 2024
1 parent 8f27480 commit 29817e9
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 77 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ if(FINUFFT_USE_CPU)
set(XTL_VERSION 0.7.7)
set(XSIMD_VERSION 13.0.0)
# using latest ducc0 version for now as it fixes MacOS GCC build
set(DUCC0_VERSION b0beb85e03982344a31ebb119758d7aa3ef5d362)
set(DUCC0_VERSION ducc0_0_35_0)
set(FINUFFT_FFTW_LIBRARIES)
include(cmake/setupXSIMD.cmake)
if(FINUFFT_USE_DUCC0)
Expand Down
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ XSIMD_DIR := $(DEPS_ROOT)/xsimd

# DUCC sources optional dependency repo
DUCC_URL := https://gitlab.mpcdf.mpg.de/mtr/ducc.git
DUCC_VERSION := ducc0_0_34_0
DUCC_VERSION := ducc0_0_35_0
DUCC_DIR := $(DEPS_ROOT)/ducc
# this dummy file used as empty target by make...
DUCC_COOKIE := $(DUCC_DIR)/.finufft_has_ducc
Expand Down Expand Up @@ -420,7 +420,7 @@ endif

# python ---------------------------------------------------------------------
python: $(STATICLIB) $(DYNLIB)
FINUFFT_DIR=$(FINUFFT) $(PYTHON) -m pip -v install python/finufft
FINUFFT_DIR=$(FINUFFT) $(PYTHON) -m pip -v install --user --break-system-packages python/finufft
# note to devs: if trouble w/ NumPy, use: pip install ./python --no-deps
$(PYTHON) python/finufft/test/run_accuracy_tests.py
$(PYTHON) python/finufft/examples/simple1d1.py
Expand Down
10 changes: 0 additions & 10 deletions src/c_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ using namespace std;
As of v1.2 these simply invoke the guru interface, through a helper layer.
See ../docs/usage.rst or http://finufft.readthedocs.io for documentation
all routines here.
This compiles in either double or single precision (based on -DSINGLE),
producing functions finufft?d?{many} or finufftf?1?{many} respectively.
Authors: Andrea Malleo and Alex Barnett, 2019-2020.
Safe namespacing, Barnett, May 2022.
Expand Down Expand Up @@ -82,9 +80,6 @@ int finufftf_destroy(finufftf_plan p)
}
// Helper layer ...........................................................

namespace finufft {
namespace common {

template<typename T>
static int guru(int n_dims, int type, int n_transf, i64 nj, const std::array<T *, 3> &xyz,
std::complex<T> *cj, int iflag, T eps, const std::array<i64, 3> &n_modes,
Expand Down Expand Up @@ -121,11 +116,6 @@ static int guru(int n_dims, int type, int n_transf, i64 nj, const std::array<T *
return max(max(ier, ier2), ier3); // in case any one gave a (positive!) warning
}

} // namespace common
} // namespace finufft

using namespace finufft::common;

// Dimension 1111111111111111111111111111111111111111111111111111111111111111

int finufft1d1many(int n_transf, i64 nj, f64 *xj, c128 *cj, int iflag, f64 eps, i64 ms,
Expand Down
24 changes: 11 additions & 13 deletions src/finufft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ Algorithm summaries taken from old finufft?d?() documentation, Feb-Jun 2017:
Design notes for guru interface implementation:
* Since finufft_plan is C-compatible, we need to use malloc/free for its
allocatable arrays, keeping it quite low-level. We can't use std::vector
since that would only survive in the scope of each function.
* Thread-safety: FINUFFT plans are passed as pointers, so it has no global
state apart from that associated with FFTW (and the did_fftw_init).
*/
Expand All @@ -93,8 +89,8 @@ static int set_nf_type12(BIGINT ms, const finufft_opts &opts,
return 0;
} else {
fprintf(stderr,
"[%s] nf=%.3g exceeds MAX_NF of %.3g, so exit without attempting even a "
"malloc\n",
"[%s] nf=%.3g exceeds MAX_NF of %.3g, so exit without attempting "
"memory allocation\n",
__func__, (double)*nf, (double)MAX_NF);
return FINUFFT_ERR_MAXNALLOC;
}
Expand Down Expand Up @@ -713,9 +709,10 @@ FINUFFT_PLAN_T<TF>::FINUFFT_PLAN_T(int type_, int dim_, const BIGINT *n_modes, i

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 malloc!\n",
__func__);
fprintf(
stderr,
"[%s] fwBatch would be bigger than MAX_NF, not attempting memory allocation!\n",
__func__);
// FIXME: this error causes memory leaks. We should free phiHat1, phiHat2, phiHat3
throw int(FINUFFT_ERR_MAXNALLOC);
}
Expand All @@ -726,8 +723,8 @@ FINUFFT_PLAN_T<TF>::FINUFFT_PLAN_T(int type_, int dim_, const BIGINT *n_modes, i
printf("[%s] fwBatch %.2fGB alloc: \t%.3g s\n", __func__,
(double)1E-09 * sizeof(std::complex<TF>) * nf * batchSize,
timer.elapsedsec());
if (!fwBatch) { // we don't catch all such mallocs, just this big one
fprintf(stderr, "[%s] FFTW malloc failed for fwBatch (working fine grids)!\n",
if (!fwBatch) { // we don't catch all such allocs, just this big one
fprintf(stderr, "[%s] FFT allocation failed for fwBatch (working fine grids)!\n",
__func__);
throw int(FINUFFT_ERR_ALLOC);
}
Expand Down Expand Up @@ -868,7 +865,8 @@ int FINUFFT_PLAN_T<TF>::setpts(BIGINT nj, TF *xj, TF *yj, TF *zj, BIGINT nk, TF
nf = nf1 * nf2 * nf3; // fine grid total number of points
if (nf * batchSize > MAX_NF) {
fprintf(stderr,
"[%s t3] fwBatch would be bigger than MAX_NF, not attempting malloc!\n",
"[%s t3] fwBatch would be bigger than MAX_NF, not attempting memory "
"allocation!\n",
__func__);
return FINUFFT_ERR_MAXNALLOC;
}
Expand All @@ -882,7 +880,7 @@ int FINUFFT_PLAN_T<TF>::setpts(BIGINT nj, TF *xj, TF *yj, TF *zj, BIGINT nk, TF
(double)1E-09 * sizeof(std::complex<TF>) * (nf + nj) * batchSize,
timer.elapsedsec());
if (!fwBatch) {
fprintf(stderr, "[%s t3] malloc fail for fwBatch or CpBatch!\n", __func__);
fprintf(stderr, "[%s t3] allocation fail for fwBatch or CpBatch!\n", __func__);
return FINUFFT_ERR_ALLOC;
}
// printf("fwbatch, cpbatch ptrs: %llx %llx\n",fwBatch,CpBatch);
Expand Down
Loading

0 comments on commit 29817e9

Please sign in to comment.