Xmipp  v3.23.11-Nereus
Macros | Functions | Variables
reconstruct_fourier_util.h File Reference
#include <cstdint>
Include dependency graph for reconstruct_fourier_util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CHECK_STARPU(operationWithReturnCode)
 
#define CHECK_MPI(operationWithReturnCode)
 

Functions

uint32_t alignmentOf (size_t ptr)
 
uint32_t alignmentOf (void *ptr)
 
template<typename T >
align (T number, uint32_t alignment)
 

Variables

const uint32_t ALIGNMENT = 32
 

Macro Definition Documentation

◆ CHECK_MPI

#define CHECK_MPI (   operationWithReturnCode)
Value:
do {\
int check_result = (operationWithReturnCode);\
if (STARPU_UNLIKELY(check_result != 0)) {\
fprintf(stderr, "Unexpected value: <%d> returned for %s\n", check_result, #operationWithReturnCode);\
fprintf(stderr, "[abort][%s:%d]\n", __FILE__, __LINE__);\
STARPU_DUMP_BACKTRACE(); _starpu_abort();\
}}while(0)

Wrap calls to error-returning MPI functions with this to error on non-zero values.

Definition at line 73 of file reconstruct_fourier_util.h.

◆ CHECK_STARPU

#define CHECK_STARPU (   operationWithReturnCode)
Value:
do {\
int check_result = (operationWithReturnCode);\
STARPU_CHECK_RETURN_VALUE(check_result, #operationWithReturnCode);\
} while (0)

Wrap calls to error-returning StarPU functions with this to error on non-zero values.

Definition at line 67 of file reconstruct_fourier_util.h.

Function Documentation

◆ align()

template<typename T >
T align ( number,
uint32_t  alignment 
)
inline

Definition at line 57 of file reconstruct_fourier_util.h.

57  {
58  T off = number % alignment;
59  if (off == 0) {
60  return number;
61  } else {
62  return number + alignment - off;
63  }
64 }

◆ alignmentOf() [1/2]

uint32_t alignmentOf ( size_t  ptr)
inline

Definition at line 38 of file reconstruct_fourier_util.h.

38  {
39  uintptr_t p = (uintptr_t) ptr;
40  uint32_t alignment = 1;
41  while (true) {
42  uint32_t nextAlignment = alignment << 1;
43  if (nextAlignment == 0)
44  break;
45  if ((p & nextAlignment) != 0)
46  return nextAlignment;
47  alignment = nextAlignment;
48  }
49  return alignment;
50 }

◆ alignmentOf() [2/2]

uint32_t alignmentOf ( void *  ptr)
inline

Definition at line 52 of file reconstruct_fourier_util.h.

52  {
53  return alignmentOf((size_t) ptr);
54 }
uint32_t alignmentOf(size_t ptr)

Variable Documentation

◆ ALIGNMENT

const uint32_t ALIGNMENT = 32

Default alignment of most StarPU buffers. Required mostly by FFTW, which mentions the need for 16 byte alignment, but does not specify any upper bound. So, just to be sure, we require 32 byte alignment. http://fftw.org/fftw3_doc/SIMD-alignment-and-fftw_005fmalloc.html

Definition at line 36 of file reconstruct_fourier_util.h.