Package: ducc0
Distinctly Useful Code Collection (DUCC)This is a collection of basic programming tools for numerical computation,
including Fast Fourier Transforms, Spherical Harmonic Transforms, non-equispaced
Fourier transforms, as well as some concrete applications like 4pi convolution
on the sphere and gridding/degridding of radio interferometry data.The code is written in C++17, but provides a simple and comprehensive Python
interface.RequirementsPython >= 3.8only when compiling from source:pybind11only when compiling from source: a C++17-capable compiler, e.g.g++7 or laterclang++MSVC 2019 or laterIntelicpx(oneAPI compiler series). (Note that the oldericpccompilers
are not supported.)SourcesThe latest version of DUCC can be obtained by cloning the repository viagit clone https://gitlab.mpcdf.mpg.de/mtr/ducc.gitLicensing termsAll source code in this package is released under the terms of the GNU
General Public License v2 or later.Some files (those constituting the FFT component and its internal
dependencies) are also licensed under the 3-clause BSD license. These files
contain two sets of licensing headers; the user is free to choose under which
of those terms they want to use these sources.DocumentationOnline documentation of the most recent Python interface is available athttps://mtr.pages.mpcdf.de/ducc.The C++ interface is documented athttps://mtr.pages.mpcdf.de/ducc/cpp.
Please note that this interface is not as well documented as the Python one,
and that it should not be considered stable.InstallationFor best performance, it is recommended to compile DUCC from source, optimizing
for the specific CPU on the system. This can be done using the commandpip3 install --no-binary ducc0 --user ducc0NOTE: compilation requires the appropriate compilers to be installed (see above)
and can take a significant amount of time (several minutes).Alternatively, a simplepip3 install --user ducc0will install a pre-compiled binary package, which makes the installation process
much quicker and does not require any compilers to be installed on the system.
However, the code will most likely perform significantly worse (by a factor of
two to three for some functions) than a custom built version.Additionally, pre-compiled binaries are distributed for the following systems:DUCC componentsducc.fftThis package provides Fast Fourier, trigonometric and Hartley transforms with a
simple Python interface. It is an evolution ofpocketfftandpypocketfftwhich are currently used bynumpyandscipy.The central algorithms are derived from Paul Swarztrauber'sFFTPACKcode.Featuressupports fully complex and half-complex (i.e. complex-to-real and
real-to-complex) FFTs, discrete sine/cosine transforms and Hartley transformsachieves very high accuracy for all transformssupports multidimensional arrays and selection of the axes to be transformedsupports single, double, and long double precisionmakes use of CPU vector instructions, except for short 1D transformssupports prime-length transforms without degrading to O(N**2) performancehas optional multi-threading support for all transforms except short 1D ones.Design decisions and performance characteristicsthere is no explicit plan management to be done by the user, making the
interface as simple as possible.
A small number of plans is cached internally, which does not consume much
memory, since the storage requirement for a plan only scales with the square
root of the FFT length for large lengths.1D transforms are somewhat slower than those provided by FFTW (if FFTW's
plan generation overhead is ignored)multi-D transforms in double precision perform fairly similar to FFTW with
FFTW_MEASURE; in single precisionducc.fftcan be significantly faster.ducc.nufftLibrary for non-uniform FFTs in 1D/2D/3D
(currently only supports transform types 1 and 2).
The goal is to provide similar or better performance and accuracy thanFINUFFT, making use of lessons
learned during the implementation of thewgriddermodule (see below).ducc.shtThis package provides efficient spherical harmonic transforms (SHTs). Its code
is derived fromlibsharp, but has been
significantly enhanced.Noteworthy featuresvery efficient support for spherical harmonic synthesis ("alm2map") operations
and their adjoint for any grid based on iso-latitude rings with equidistant
pixels in each of the rings.support for the same operations onentirely arbitraryspherical grids,
i.e. without constraints on pixel locations. This is implemented via
intermediate iso-latitude grids and non-uniform FFTs.support for accurate spherical harmonic analyis on certain sub-classes of
grids (Clenshaw-Curtis, Fejer-1 and McEwen-Wiaux) at band limits beyond those
for which quadrature weights exist. For details seethis note.iterative approximate spherical harmonic analysis on aritrary grids.substantially improved transformation speed (up to a factor of 2) on the
above mentioned grid geometries for high band limits.accelerated recurrences as presented inIshioka (2018)vector instruction supportmulti-threading supportThe code for rotating spherical harmonic coefficients was taken (with some
modifications) from Mikael Slevinsky'sFastTransforms package.ducc.healpixThis library provides Python bindings for the most important functionality
related to theHEALPixtesselation,
except for spherical harmonic transforms, which are covered byducc.sht.The design goals aresimilarity to the interface of the HEALPix C++ library
(while respecting some Python peculiarities)simplicity (no optional function parameters)low function calling overheadducc.totalconvolveLibrary for high-accuracy 4pi convolution on the sphere, which generates a
total convolution data cube from a set of sky and beama_lmand computes
interpolated values for a given list of detector pointings.
This code has evolved from the originaltotalconvolveralgorithm
via theconviqtcode.Algorithmic details:the code usesducc.shtSHTs andducc.fftFFTs to compute the data cubeshared-memory parallelization is provided via standard C++ threads.for interpolation, the algorithm and kernel described inhttps://arxiv.org/abs/1808.06736are used. This allows very efficient
interpolation with user-adjustable accuracy.ducc.wgridderLibrary for high-accuracy gridding/degridding of radio interferometry datasets
(code paper available athttps://arxiv.org/abs/2010.10122).
This code has also been integrated intowsclean(https://arxiv.org/abs/1407.1943)
as thewgriddercomponent.Programming aspectsshared-memory parallelization via standard C++ threads.kernel computation is performed on the fly, avoiding inaccuracies
due to table lookup and reducing overall memory bandwidthNumerical aspectsuses a generalization of the analytical gridding kernel presented inhttps://arxiv.org/abs/1808.06736uses the "improved W-stacking method" described inhttps://arxiv.org/abs/2101.11172in combination these two aspects allow extremely accurate gridding/degridding
operations (L2 error compared to explicit DFTs can go below 1e-12) with
reasonable resource consumptionducc.miscVarious unsorted functionality which will hopefully be categorized in the
future.This module contains an efficient algorithm for the computation of abscissas and
weights for Gauss-Legendre quadrature. For degrees up to 100, the solutions are
computed in the standard iterative fashion; for higher degrees Ignace Bogaert'sFastGL algorithmis used.