Skip to content

Using generateExportHeadrs #605

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

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fortran/examples/nufft2dmany_demof
fortran/examples/nufft3d_demof
test/dumbinputs
test/finufft1d_basicpassfail
test/testutils
test/testlib
__pycache__*

docs/_build
Expand Down
32 changes: 16 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ project(
# windows MSVC runtime flags policy
cmake_policy(SET CMP0091 NEW)

include(GenerateExportHeader)
include(CMakeDependentOption)

# cmake-format: off
Expand Down Expand Up @@ -234,7 +235,10 @@ function(set_finufft_options target)
set_target_properties(
${target}
PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
POSITION_INDEPENDENT_CODE ${FINUFFT_POSITION_INDEPENDENT_CODE})
POSITION_INDEPENDENT_CODE ${FINUFFT_POSITION_INDEPENDENT_CODE}
CXX_VISIBILITY_PRESET hidden
C_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON)
enable_asan(${target})
if(FINUFFT_USE_OPENMP)
target_link_libraries(${target} PRIVATE OpenMP::OpenMP_CXX)
Expand All @@ -248,30 +252,26 @@ function(set_finufft_options target)
endfunction()

if(FINUFFT_USE_CPU)
# Main finufft libraries
if(NOT FINUFFT_STATIC_LINKING)
add_library(
finufft SHARED
set(FINUFFT_SOURCES
src/spreadinterp.cpp
src/utils.cpp
contrib/legendre_rule_fast.cpp
src/fft.cpp
src/finufft_core.cpp
src/c_interface.cpp
src/finufft_utils.cpp
fortran/finufftfort.cpp)
# Main finufft libraries
if(NOT FINUFFT_STATIC_LINKING)
add_library(finufft SHARED ${FINUFFT_SOURCES})
else()
add_library(
finufft STATIC
src/spreadinterp.cpp
src/utils.cpp
contrib/legendre_rule_fast.cpp
src/fft.cpp
src/finufft_core.cpp
src/c_interface.cpp
fortran/finufftfort.cpp)
add_library(finufft STATIC ${FINUFFT_SOURCES})
endif()
set_finufft_options(finufft)

generate_export_header(
finufft EXPORT_FILE_NAME
"${CMAKE_CURRENT_BINARY_DIR}/include/finufft_export.h" BASE_NAME "finufft")
target_include_directories(finufft
PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include")
if(WIN32 AND FINUFFT_SHARED_LINKING)
target_compile_definitions(finufft PRIVATE dll_EXPORTS FINUFFT_DLL)
endif()
Expand Down
19 changes: 8 additions & 11 deletions devel/foldrescale.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "finufft/defs.h"
#include "finufft/test_defs.h"
#include <benchmark/benchmark.h>
#include <cmath>
#include <immintrin.h>
#include <iostream>
#include <random>
// no vectorize
Expand All @@ -17,22 +16,22 @@
This should be done in C++ not as a macro, someday.
*/
#define FOLDRESCALE(x, N, p) \
(p ? (x + (x >= -PI ? (x < PI ? PI : -PI) : 3 * PI)) * ((FLT)M_1_2PI * N) \
(p ? (x + (x >= -PI ? (x < PI ? PI : -PI) : 3 * PI)) * ((FLT)INV_2PI * N) \
: (x >= 0.0 ? (x < (FLT)N ? x : x - (FLT)N) : x + (FLT)N))

#define FOLDRESCALE04(x, N, p) \
(p ? ((x * FLT(M_1_2PI) + FLT(0.5)) - floor(x * FLT(M_1_2PI) + FLT(0.5))) * FLT(N) \
(p ? ((x * FLT(INV_2PI) + FLT(0.5)) - floor(x * FLT(INV_2PI) + FLT(0.5))) * FLT(N) \
: ((x / FLT(N)) - floor(x / FLT(N))) * FLT(N))

#define FOLDRESCALE05(x, N, p) \
FLT(N) * (p ? ((x * FLT(M_1_2PI) + FLT(0.5)) - floor(x * FLT(M_1_2PI) + FLT(0.5))) \
FLT(N) * (p ? ((x * FLT(INV_2PI) + FLT(0.5)) - floor(x * FLT(INV_2PI) + FLT(0.5))) \
: ((x / FLT(N)) - floor(x / FLT(N))))

inline __attribute__((always_inline)) FLT foldRescale00(FLT x, BIGINT N, bool p) {
FLT result;
FLT fN = FLT(N);
if (p) {
static constexpr FLT x2pi = FLT(M_1_2PI);
static constexpr FLT x2pi = FLT(INV_2PI);
result = x * x2pi + FLT(0.5);
result -= floor(result);
} else {
Expand All @@ -44,14 +43,14 @@ inline __attribute__((always_inline)) FLT foldRescale00(FLT x, BIGINT N, bool p)
}

inline __attribute__((always_inline)) FLT foldRescale01(FLT x, BIGINT N, bool p) {
return p ? (x + (x >= -PI ? (x < PI ? PI : -PI) : 3 * PI)) * ((FLT)M_1_2PI * N)
return p ? (x + (x >= -PI ? (x < PI ? PI : -PI) : 3 * PI)) * ((FLT)INV_2PI * N)
: (x >= 0.0 ? (x < (FLT)N ? x : x - (FLT)N) : x + (FLT)N);
}

template<bool p>
inline __attribute__((always_inline)) FLT foldRescale02(FLT x, BIGINT N) {
if constexpr (p) {
return (x + (x >= -PI ? (x < PI ? PI : -PI) : 3 * PI)) * ((FLT)M_1_2PI * N);
return (x + (x >= -PI ? (x < PI ? PI : -PI) : 3 * PI)) * ((FLT)INV_2PI * N);
} else {
return (x >= 0.0 ? (x < (FLT)N ? x : x - (FLT)N) : x + (FLT)N);
}
Expand All @@ -62,7 +61,7 @@ inline __attribute__((always_inline)) FLT foldRescale03(FLT x, BIGINT N) {
FLT result;
FLT fN = FLT(N);
if constexpr (p) {
static constexpr FLT x2pi = FLT(M_1_2PI);
static constexpr FLT x2pi = FLT(INV_2PI);
result = std::fma(x, x2pi, FLT(0.5));
result -= floor(result);
} else {
Expand All @@ -73,7 +72,6 @@ inline __attribute__((always_inline)) FLT foldRescale03(FLT x, BIGINT N) {
return result * fN;
}


static std::mt19937_64 gen;
static std::uniform_real_distribution<> dis(-10, 10);
static const auto N = std::uniform_int_distribution<>{0, 1000}(gen);
Expand Down Expand Up @@ -185,7 +183,6 @@ static void BM_FoldRescale05N(benchmark::State &state) {
}
}


BENCHMARK(BM_BASELINE)->Iterations(10000000);
BENCHMARK(BM_FoldRescaleMacro)->Iterations(1000000);
BENCHMARK(BM_FoldRescale00)->Iterations(1000000);
Expand Down
37 changes: 22 additions & 15 deletions include/cufinufft.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <stdint.h>

#include <cufinufft_export.h>
#include <cufinufft_opts.h>
#include <finufft_errors.h>

Expand All @@ -14,21 +15,27 @@ extern "C" {
#endif
void cufinufft_default_opts(cufinufft_opts *opts);

int cufinufft_makeplan(int type, int dim, const int64_t *n_modes, int iflag, int ntr,
double eps, cufinufft_plan *d_plan_ptr, cufinufft_opts *opts);
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, int64_t 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, 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);

int cufinufft_destroy(cufinufft_plan d_plan);
int cufinufftf_destroy(cufinufftf_plan d_plan);
CUFINUFFT_EXPORT int cufinufft_makeplan(int type, int dim, const int64_t *n_modes,
int iflag, int ntr, double eps,
cufinufft_plan *d_plan_ptr, cufinufft_opts *opts);
CUFINUFFT_EXPORT 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);

CUFINUFFT_EXPORT int cufinufft_setpts(cufinufft_plan d_plan, int64_t M, double *d_x,
double *d_y, double *d_z, int N, double *d_s,
double *d_t, double *d_u);
CUFINUFFT_EXPORT int cufinufftf_setpts(cufinufftf_plan d_plan, int64_t M, float *d_x,
float *d_y, float *d_z, int N, float *d_s,
float *d_t, float *d_u);

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

CUFINUFFT_EXPORT int cufinufft_destroy(cufinufft_plan d_plan);
CUFINUFFT_EXPORT int cufinufftf_destroy(cufinufftf_plan d_plan);
#ifdef __cplusplus
}
#endif
25 changes: 9 additions & 16 deletions include/cufinufft/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
#include <cuComplex.h>
#include <cufinufft/types.h>

#include <cuda_runtime.h>

#include <sys/time.h>

#include <cuda.h>
#include <cuda_runtime.h>
#include <type_traits>

#include <thrust/extrema.h>

#include <cufinufft_export.h>

#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cmath>

#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 600 || defined(__clang__)
#else
__inline__ __device__ double atomicAdd(double *address, double val) {
Expand Down Expand Up @@ -87,19 +91,8 @@ class WithCudaDevice {
}
};

// jfm timer class
class CNTime {
public:
void start();
double restart();
double elapsedsec();

private:
struct timeval initial;
};

// ahb math helpers
CUFINUFFT_BIGINT next235beven(CUFINUFFT_BIGINT n, CUFINUFFT_BIGINT b);
CUFINUFFT_EXPORT CUFINUFFT_BIGINT next235beven(CUFINUFFT_BIGINT n, CUFINUFFT_BIGINT b);

template<typename T> T infnorm(int n, std::complex<T> *a) {
T nrm = 0.0;
Expand Down
2 changes: 1 addition & 1 deletion include/finufft.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
#define FINUFFT_H

// prec-indep stuff. both these are thus made public-facing
#include <finufft_export.h>
#include <finufft_opts.h>
#include <finufft_spread_opts.h>

// Public error numbers
#include <finufft_errors.h>

Expand Down
36 changes: 0 additions & 36 deletions include/finufft/dirft.h

This file was deleted.

20 changes: 11 additions & 9 deletions include/finufft/finufft_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
these defines.The main reason is that if msvc changes the way it deals
with it in the future we just need to update cmake for it to work
instead of having a check on the msvc version. */
#if defined(FINUFFT_DLL) && (defined(_WIN32) || defined(__WIN32__))
#if defined(dll_EXPORTS)
#define FINUFFT_EXPORT __declspec(dllexport)
#else
#define FINUFFT_EXPORT __declspec(dllimport)
#endif
#else
#define FINUFFT_EXPORT
#endif
// #if defined(FINUFFT_DLL) && (defined(_WIN32) || defined(__WIN32__))
// #if defined(dll_EXPORTS)
// #define FINUFFT_EXPORT __declspec(dllexport)
// #else
// #define FINUFFT_EXPORT __declspec(dllimport)
// #endif
// #else
// #define FINUFFT_EXPORT
// #endif

#include "finufft_export.h"

/* specify calling convention (Windows only)
The cdecl calling convention is actually not the default in all but a very
Expand Down
75 changes: 75 additions & 0 deletions include/finufft/finufft_utils.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Header for utils.cpp, a little library of low-level array stuff.
// These are just the functions which depend on single/double precision (FLT)

#pragma once

#include <chrono>
#include <cmath>

#include "finufft_core.h"

// for CNTime...
// using chrono since the interface is portable between linux and windows

namespace finufft::utils {

template<typename T>
FINUFFT_EXPORT FINUFFT_ALWAYS_INLINE void FINUFFT_CDECL arrayrange(BIGINT n, const T *a,

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 17 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once
T *lo, T *hi)
// With a a length-n array, writes out min(a) to lo and max(a) to hi,
// so that all a values lie in [lo,hi].
// If n==0, lo and hi are not finite.
{
*lo = INFINITY;
*hi = -INFINITY;
for (BIGINT m = 0; m < n; ++m) {
if (a[m] < *lo) *lo = a[m];
if (a[m] > *hi) *hi = a[m];
}
}
template<typename T>
FINUFFT_EXPORT FINUFFT_ALWAYS_INLINE void FINUFFT_CDECL arraywidcen(BIGINT n, const T *a,

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, On, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:SSE2, Off, Release, cl, cl, Off)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, /arch:AVX2, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once

Check warning on line 31 in include/finufft/finufft_utils.hpp

View workflow job for this annotation

GitHub Actions / cmake-ci (windows-2022, msvc, native, Off, Release, cl, cl, On)

'inline': used more than once
T *w, T *c)
// Writes out w = half-width and c = center of an interval enclosing all a[n]'s
// Only chooses a nonzero center if this increases w by less than fraction
// ARRAYWIDCEN_GROWFRAC defined in finufft_core.h.
// This prevents rephasings which don't grow nf by much. 6/8/17
// If n==0, w and c are not finite.
{
T lo, hi;
arrayrange(n, a, &lo, &hi);
*w = (hi - lo) / 2;
*c = (hi + lo) / 2;
if (std::abs(*c) < ARRAYWIDCEN_GROWFRAC * (*w)) {
*w += std::abs(*c);
*c = 0.0;
}
}

FINUFFT_EXPORT BIGINT next235even(BIGINT n);

// jfm's timer class
class FINUFFT_EXPORT CNTime {
public:
FINUFFT_NEVER_INLINE void start();
FINUFFT_NEVER_INLINE double restart();
FINUFFT_NEVER_INLINE double elapsedsec() const;

private:
double initial;
};

// openmp helpers
int get_num_threads_parallel_block();

} // namespace finufft::utils

// thread-safe rand number generator for Windows platform
#ifdef _WIN32
#include <random>
namespace finufft {
namespace utils {
FINUFFT_EXPORT int FINUFFT_CDECL rand_r(unsigned int *seedp);
} // namespace utils
} // namespace finufft
#endif
Loading
Loading