Skip to content

Commit

Permalink
document fftw_alignment_of (since I found it useful in Julia, other p…
Browse files Browse the repository at this point in the history
…eople may too)
  • Loading branch information
stevengj committed Jan 16, 2014
1 parent 7dbc706 commit 53e1fdb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion api/fftw3.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ FFTW_EXTERN void X(flops)(const X(plan) p, \
FFTW_EXTERN double X(estimate_cost)(const X(plan) p); \
FFTW_EXTERN double X(cost)(const X(plan) p); \
\
FFTW_EXTERN const char X(version)[]; \
FFTW_EXTERN int X(alignment_of)(R *p); \
FFTW_EXTERN const char X(version)[]; \
FFTW_EXTERN const char X(cc)[]; \
FFTW_EXTERN const char X(codelet_optim)[];

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dnl REVISION is the same as the FFTW minor version number.
dnl fftw-3.1.x was 4:X:1
dnl fftw-3.2.x was 5:X:2
dnl fftw-3.3.x was 6:X:3
SHARED_VERSION_INFO="6:FFTW_MINOR_VERSION:3" # CURRENT:REVISION:AGE
SHARED_VERSION_INFO="7:FFTW_MINOR_VERSION:4" # CURRENT:REVISION:AGE

AM_INIT_AUTOMAKE(1.7)
AM_CONFIG_HEADER(config.h)
Expand Down
18 changes: 17 additions & 1 deletion doc/reference.texi
Original file line number Diff line number Diff line change
Expand Up @@ -514,14 +514,17 @@ input-preserving algorithms are implemented and the planner will return
@item
@ctindex FFTW_UNALIGNED
@cindex alignment
@findex fftw_malloc
@findex fftw_alignment_of
@code{FFTW_UNALIGNED} specifies that the algorithm may not impose any
unusual alignment requirements on the input/output arrays (i.e. no
SIMD may be used). This flag is normally @emph{not necessary}, since
the planner automatically detects misaligned arrays. The only use for
this flag is if you want to use the new-array execute interface to
execute a given plan on a different array that may not be aligned like
the original. (Using @code{fftw_malloc} makes this flag unnecessary
even then.)
even then. You can also use @code{fftw_alignment_of} to detect
whether two arrays are equivalently aligned.)

@end itemize

Expand Down Expand Up @@ -1597,6 +1600,19 @@ you to simply create multiple plans (creating a new plan is quick once
one exists for a given size), or better yet re-use the same array for
your transforms.

@findex fftw_alignment_of
For rare circumstances in which you cannot control the alignment of
allocated memory, but wish to determine where a given array is
aligned like the original array for which a plan was created, you can
use the @code{fftw_alignment_of} function:
@example
int fftw_alignment_of(double *p);
@end example
Two arrays have equivalent alignment (for the purposes of applying a
plan) if and only if @code{fftw_alignment_of} returns the same value
for the corresponding pointers to their data (typecast to @code{double*}
if necessary).

If you are tempted to use the new-array execute interface because you
want to transform a known bunch of arrays of the same size, you should
probably go use the advanced interface instead (@pxref{Advanced
Expand Down

0 comments on commit 53e1fdb

Please sign in to comment.