diff --git a/CLAUDE.md b/CLAUDE.md index d90043cb0..d3ecfc9d2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,7 +16,7 @@ changing CLI behaviour, update the parser, that page and, for a basic option, th ## Build Out-of-source CMake build, C++20, heavy use of `FetchContent` (spdlog, zstd, HDF5, -slsDetectorPackage, Catch2, cpp-httplib, libzmq, libtiff, FFTW, Ceres (with abseil), zlib-ng and Eigen are +slsDetectorPackage, Catch2, cpp-httplib, libzmq, libtiff, Ceres (with abseil), zlib-ng and Eigen are downloaded and statically linked — the **first configure needs network access** and is slow; the fast-feedback indexer behind FFBIDX is vendored in `image_analysis/indexing/fast-feedback-indexer/`). **No library has to come from the host**: `zlib-devel`/`eigen3-devel` are no longer needed. @@ -38,8 +38,11 @@ make -j$(nproc) jfjoch_broker # the main service; build other targets by na Key CMake options: - `JFJOCH_USE_CUDA` (default ON) — GPU path. Needs CUDA ≥ 12.8 (older is warned about and ignored). Provides the `ffbidx` and `fft` GPU indexers; without it the indexers are the CPU `fftw` - and a CPU port of the fast-feedback indexer (`FFBIDXIndexerCPU`, always built). FFTW is fetched and - `JFJOCH_USE_FFTW` defined unconditionally, so `fftw` is always there. CUDA absence is not a build + and a CPU port of the fast-feedback indexer (`FFBIDXIndexerCPU`, always built). Every CPU FFT (the + `fftw` indexer, beam-centre search, tNCS, model maps, MR, the viewer's chart) goes through + `common/CpuFFT` on the pocketfft header vendored with gemmi - FFTW is no longer a dependency, the + `fftw`/`FFTW` name is kept for the CPU indexer only for back compatibility. pocketfft vectorises + with GCC/Clang vector extensions and runs scalar under MSVC. CUDA absence is not a build error — nvcc is looked for on `PATH`, `CUDA_PATH`, `CUDA_HOME`, `CUDA_ROOT`, `/usr/local/cuda` and `/opt/cuda`. - `JFJOCH_WRITER_ONLY` (default OFF) — builds only the HDF5 writer (with the detector control, @@ -393,7 +396,7 @@ CXX_THREADS). The indexer is chosen with `-X` (`Auto|FFT|cuFFT|FFTW|FFBIDX|None`, default `Auto`, which resolves to a GPU indexer when one is present and `fftw` otherwise): `ffbidx` wants a known cell (`-C`) and suits sparse serial stills; `fft` indexes de novo and suits strong rotation data - it is the algorithm, run -with cuFFT on a GPU and with FFTW without one (or under `--no-gpu`), while `cufft`/`fftw` name one +with cuFFT on a GPU and with pocketfft without one (or under `--no-gpu`), while `cufft`/`fftw` name one implementation each. Only rugnux's CLI spells it this way: internally (and in the broker's OpenAPI) `FFT` is the GPU implementation, which the CLI's `cufft` maps onto. diff --git a/CMakeLists.txt b/CMakeLists.txt index eae9a9287..88e03e81b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -474,45 +474,6 @@ FetchContent_Declare(tiff EXCLUDE_FROM_ALL) FetchContent_MakeAvailable(tiff) -# FFTW single precision (target fftw3f): no longer used by the programs, whose CPU FFTs are pocketfft's -# (common/CpuFFT) - linked only by jfjoch_test, which checks pocketfft against it. JFJOCH_USE_FFTW still -# means "the CPU FFT indexer is built". Built from the release tarball -- the git repo ships no pre-generated codelets (needs the -# OCaml genfft). -SET(ENABLE_FLOAT ON CACHE BOOL "" FORCE) -SET(BUILD_TESTS OFF CACHE BOOL "" FORCE) -# SIMD codelets are runtime-dispatched (cpuid), so enabling AVX2 does NOT require an AVX2 CPU -# -- FFTW falls back at runtime. The codelet sets are arch-specific, so guard by processor: -# x86 gets SSE2/AVX/AVX2, aarch64 (Apple Silicon, Grace on DGX Spark) gets NEON - added below the -# FetchContent, as FFTW's CMake build has no switch for it; other arches build scalar. -IF (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|amd64") - SET(ENABLE_SSE2 ON CACHE BOOL "" FORCE) - SET(ENABLE_AVX ON CACHE BOOL "" FORCE) - SET(ENABLE_AVX2 ON CACHE BOOL "" FORCE) -ENDIF() -FetchContent_Declare(fftw - URL https://www.fftw.org/fftw-3.3.10.tar.gz - URL_HASH SHA256=56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467 - EXCLUDE_FROM_ALL) -FetchContent_MakeAvailable(fftw) -# FFTW exposes fftw3.h only via $, so consuming fftw3f straight from -# the build tree (FetchContent) leaves the header unreachable. On Linux a system-installed -# fftw3.h masks this; on Windows it does not. Add the source-tree api/ dir for build-tree use. -TARGET_INCLUDE_DIRECTORIES(fftw3f INTERFACE $) -# NEON: only FFTW's autotools build knows it (--enable-neon); its CMake build silently builds scalar -# code on ARM (and ignores an ENABLE_NEON, as this file once set). So the NEON codelets are added -# the way its CMakeLists adds the SSE2/AVX ones: the sources, and HAVE_NEON so that dft/conf.c and -# rdft/conf.c register them - as a definition, because its config.h template carries HAVE_NEON only -# as a comment. NEON is part of every aarch64 CPU, so no compiler flag is needed. It is single -# precision, which is all that is built here. Measured on Apple Silicon against the scalar build -# (same results to 1e-8): the indexer's batched 1D r2c 1.8x faster at a power-of-two length and 1.3x -# at 730, the 2D r2c of the beam-centre search 1.9x, a 128^3 c2r map 2.6x. -IF (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|ARM64") - FILE(GLOB _fftw_neon_sources ${fftw_SOURCE_DIR}/dft/simd/neon/*.c ${fftw_SOURCE_DIR}/rdft/simd/neon/*.c) - TARGET_SOURCES(fftw3f PRIVATE ${_fftw_neon_sources}) - TARGET_COMPILE_DEFINITIONS(fftw3f PRIVATE HAVE_NEON=1) -ENDIF() -ADD_COMPILE_DEFINITIONS(JFJOCH_USE_FFTW) - # Eigen (header-only), consumed by the analysis libraries (the vendored fast-feedback indexer among them) # directly and by Ceres through its own find_package(Eigen3). The headers are fetched here and a two-file config package for # them is written into the build tree; Eigen3_DIR then points at it, so every find_package(Eigen3) diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index eb27cc3b6..00edbbc6a 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -26,7 +26,6 @@ linked into the Jungfraujoch executables. | [cpp-httplib](https://github.com/yhirose/cpp-httplib) | 0.56.0 | Yuji Hirose | MIT | [cpp-httplib.txt](licenses/cpp-httplib.txt) | | [libzmq (ZeroMQ)](https://github.com/zeromq/libzmq) | 4.3.5 | iMatix and contributors | MPL-2.0 | [libzmq.txt](licenses/libzmq.txt) | | [libtiff](https://gitlab.com/libtiff/libtiff) | 4.7.2 | Sam Leffler; SGI | libtiff (BSD-like) | [libtiff.txt](licenses/libtiff.txt) | -| [FFTW](https://www.fftw.org/) | 3.3.10 | Matteo Frigo; MIT | GPL-2.0-or-later | [fftw.txt](licenses/fftw.txt) | | [Ceres Solver](https://github.com/ceres-solver/ceres-solver) | commit 0c70ed3a1a2d | Google Inc. and contributors | BSD-3-Clause | [ceres-solver.txt](licenses/ceres-solver.txt) | | [Abseil](https://github.com/abseil/abseil-cpp) | 20250127 (required by Ceres) | Google Inc. | Apache-2.0 | [abseil.txt](licenses/abseil.txt) | | [Mbed TLS](https://github.com/Mbed-TLS/mbedtls) (with TF-PSA-Crypto) | 4.2.0 | The Mbed TLS Contributors | Apache-2.0 OR GPL-2.0-or-later (used under Apache-2.0) | [mbedtls.txt](licenses/mbedtls.txt), [tf-psa-crypto.txt](licenses/tf-psa-crypto.txt) | @@ -163,7 +162,6 @@ served frontend, so the shipped web UI carries its own attribution. * **slsDetectorPackage's bundled code**: the slsDetectorPackage sources compiled into the binaries include an MD5 implementation taken from OpenSSL (Apache-2.0) and the RapidJSON headers (MIT); their `msinttypes/` headers (BSD-3-Clause) are for old MSVC compilers only. -* **FFTW** is GPL-2.0-or-later — compatible with, and absorbed by, this project's GPL-3.0 license. * **Apache-2.0** components: where upstream ships a `NOTICE` file, it is reproduced in the corresponding `licenses/` text. * **CCP4 Monomer Library (LGPL-3.0)** is data, not code: the restraint dictionaries of the compounds diff --git a/common/CpuFFT.cpp b/common/CpuFFT.cpp index 6085fc0d3..cef90287a 100644 --- a/common/CpuFFT.cpp +++ b/common/CpuFFT.cpp @@ -6,6 +6,11 @@ // Under a name of its own: gemmi includes the same header with POCKETFFT_NO_MULTITHREADING, and its // templates and ours must not be merged by the linker into one (single-threaded or not) copy. #define pocketfft jfjoch_pocketfft +// MSVC: the scalar code (pocketfft vectorises only with the GCC/Clang vector extension, and decides so +// itself; said here so that it stays so). +#ifdef _MSC_VER +#define POCKETFFT_NO_VECTORS +#endif #include "../gemmi_gph/gemmi/third_party/pocketfft_hdronly.h" namespace cpu_fft { diff --git a/common/Logger.cpp b/common/Logger.cpp index cccee71f4..52c95c625 100644 --- a/common/Logger.cpp +++ b/common/Logger.cpp @@ -53,9 +53,7 @@ Logger::Logger(const std::string &service_name, const std::string &file_name) { #ifdef JFJOCH_USE_CUDA variant += "C"; #endif -#ifdef JFJOCH_USE_FFTW variant += "F"; -#endif std::vector sinks; sinks.push_back(std::make_shared()); diff --git a/docker/ubuntu2404/Dockerfile b/docker/ubuntu2404/Dockerfile index c84fc9d38..046e6f304 100644 --- a/docker/ubuntu2404/Dockerfile +++ b/docker/ubuntu2404/Dockerfile @@ -162,7 +162,7 @@ ENV CMAKE_PREFIX_PATH=/opt/qt-${QT_VERSION}-static:/opt/dbus-${DBUS_VERSION}-sta # qemu-user-static HDF5 runs two try_run() probes (config/ConfigureChecks.cmake) that # need CMAKE_CROSSCOMPILING_EMULATOR. libzmq guards its own run-checks # with NOT CMAKE_CROSSCOMPILING; Ceres, libtiff, zstd, Catch2, spdlog, -# cpp-httplib, FFTW and ffbidx have no run-checks at all. +# cpp-httplib and ffbidx have no run-checks at all. # binutils-aarch64-linux-gnu reading aarch64 ELF on the build host. # :arm64 libraries ZLIB is one of the project's two external dependencies (Eigen, the # other, is header-only and installed above); OpenSSL is needed by the diff --git a/docker/ubuntu2404/aarch64-sbsa.cmake b/docker/ubuntu2404/aarch64-sbsa.cmake index 3c4f76841..cd4b90095 100644 --- a/docker/ubuntu2404/aarch64-sbsa.cmake +++ b/docker/ubuntu2404/aarch64-sbsa.cmake @@ -9,7 +9,7 @@ # /usr/lib/aarch64-linux-gnu and headers are shared in /usr/include, so CMAKE_LIBRARY_ARCHITECTURE # is what steers find_library() rather than CMAKE_SYSROOT. set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR aarch64) # also selects FFTW's NEON codelets in CMakeLists.txt +set(CMAKE_SYSTEM_PROCESSOR aarch64) set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) diff --git a/docs/CPU_DATA_ANALYSIS_DECISIONS.md b/docs/CPU_DATA_ANALYSIS_DECISIONS.md index fae331bb5..574bbdcee 100644 --- a/docs/CPU_DATA_ANALYSIS_DECISIONS.md +++ b/docs/CPU_DATA_ANALYSIS_DECISIONS.md @@ -275,7 +275,7 @@ The refinement walks a coarse-to-fine ladder, 6 Å → 4.5 Å → 3.5 Å, each z The refinement sees **only the working reflections**. The step is then committed only if it lowers **R-free**, computed at full resolution on the free set it never saw; otherwise the model is put back exactly where it was read and the maps are the ones it would have given. The whole addition costs about two seconds. Note that the origin is a gauge in some space groups — free in all three directions in $P1$, and along the unique axis in a polar group — so those components of the translation are undetermined; nothing is done about that beyond the Levenberg–Marquardt damping and the R-free gate, which between them make an undetermined direction harmless rather than unstable. -Where a CUDA GPU is present, the refinement's target is evaluated on it: the same density, the same composition of $F_\mathrm{calc}$ from one copy of the model, the same bulk-solvent mask with its islands removed, the same scale fit and the same Jacobian, computed on the device, where a fit takes a fraction of a second rather than several seconds. The device is chosen once per validation, before anything is computed, and never revisited - the real fit and every replicate of the null of §14.5 on the same one. What goes on the GPU is decided for all parts at once, on one budget: 80% of the card's total memory (judged on the total, so the same input on the same machine always takes the same path), less what a merge still at work holds there. Every engine is reserved up front and kept to the end, so it is their sum that has to fit: the structure factors to the data's resolution (which also make the maps), one rigid-body engine, the null's structure factors to its coarser limit and one engine for the scale fits of §14.2 each take their place in that order where they still fit, and more rigid-body engines and then more scale-fit engines are added only within half of the budget: they change only how many fits run at once, and on a large cell, where one fit already fills the card, they buy little. A part that does not fit, or a cell too small for the GPU's gridding, runs on the CPU, as everything does where there is no GPU. A CUDA failure ends the validation, not the run: the validation reports why it did not finish, decides nothing, and the reflection files are those of a run without a model. The two agree to rounding and not bit for bit: the device measures distances in single precision and transforms with cuFFT instead of FFTW, and GEMMI's scale fit, whose stopping rule leaves it unconverged at about $10^{-4}$ of $|F|$, can respond to that rounding with a step of its own. A rigid-body step accepted or rejected on an R-free difference below about $5\cdot10^{-4}$ can therefore go either way between the two; every kernel is deterministic, so either one gives the same answer on every run. +Where a CUDA GPU is present, the refinement's target is evaluated on it: the same density, the same composition of $F_\mathrm{calc}$ from one copy of the model, the same bulk-solvent mask with its islands removed, the same scale fit and the same Jacobian, computed on the device, where a fit takes a fraction of a second rather than several seconds. The device is chosen once per validation, before anything is computed, and never revisited - the real fit and every replicate of the null of §14.5 on the same one. What goes on the GPU is decided for all parts at once, on one budget: 80% of the card's total memory (judged on the total, so the same input on the same machine always takes the same path), less what a merge still at work holds there. Every engine is reserved up front and kept to the end, so it is their sum that has to fit: the structure factors to the data's resolution (which also make the maps), one rigid-body engine, the null's structure factors to its coarser limit and one engine for the scale fits of §14.2 each take their place in that order where they still fit, and more rigid-body engines and then more scale-fit engines are added only within half of the budget: they change only how many fits run at once, and on a large cell, where one fit already fills the card, they buy little. A part that does not fit, or a cell too small for the GPU's gridding, runs on the CPU, as everything does where there is no GPU. A CUDA failure ends the validation, not the run: the validation reports why it did not finish, decides nothing, and the reflection files are those of a run without a model. The two agree to rounding and not bit for bit: the device measures distances in single precision and transforms with cuFFT instead of pocketfft, and GEMMI's scale fit, whose stopping rule leaves it unconverged at about $10^{-4}$ of $|F|$, can respond to that rounding with a step of its own. A rigid-body step accepted or rejected on an R-free difference below about $5\cdot10^{-4}$ can therefore go either way between the two; every kernel is deterministic, so either one gives the same answer on every run. The rotation and translation actually taken are reported (`RIGID_BODY_ROTATION_DEG`, `RIGID_BODY_SHIFT_A`), together with the R-free before it (`R_FREE_BEFORE_RIGID_BODY`), so what the placement bought is visible. diff --git a/docs/CPU_DATA_ANALYSIS_IMAGE.md b/docs/CPU_DATA_ANALYSIS_IMAGE.md index ca528af07..ddac0f395 100644 --- a/docs/CPU_DATA_ANALYSIS_IMAGE.md +++ b/docs/CPU_DATA_ANALYSIS_IMAGE.md @@ -182,7 +182,7 @@ margin, not a centre: the surface can be locally flat over tens of pixels, and t peak-to-runner-up margin says so. A **local walk** is then seeded at the capture and refines it; where it declines there it is started again from the file's centre, and only where neither start gives it something to fit does the capture stand alone. The transforms run on the GPU where one is present and -they fit half of the card's total memory, and on FFTW otherwise, with everything that decides anything +they fit half of the card's total memory, and on the CPU FFT (pocketfft) otherwise, with everything that decides anything shared between the two. The run log then carries: diff --git a/docs/GPU_DATA_ANALYSIS.md b/docs/GPU_DATA_ANALYSIS.md index 82343dbdb..af375c978 100644 --- a/docs/GPU_DATA_ANALYSIS.md +++ b/docs/GPU_DATA_ANALYSIS.md @@ -12,7 +12,7 @@ computes. The methods themselves are described once, in the (`JFJOCH_USE_CUDA=OFF`) runs the whole pipeline on it, the `ffbidx` indexer included (an in-tree CPU port of the library's kernels). How closely the two agree is stated engine by engine below and in the source: where the arithmetic is integer, or the order of every sum is fixed to -the host's, the result is the same to the bit; where the GPU uses float distances, cuFFT for FFTW, or a +the host's, the result is the same to the bit; where the GPU uses float distances, cuFFT for pocketfft, or a different (fixed) summation order, the two agree to rounding. Every engine is deterministic on its own - no floating-point atomics decide a result - so the same input gives the same output on every run of a GPU build. @@ -74,7 +74,7 @@ nothing. stays on the host. [§1.4](CPU_DATA_ANALYSIS_IMAGE.md#14-the-beam-centre) - **Beam centre by FFT** (`BeamCenterFFTGPU.cu`) - the self-convolutions that score every candidate centre at once, their combination into one score surface, and the shortlist of its peaks, with only - the shortlist brought back. Runs on FFTW on the host instead where it would need more than half of + the shortlist brought back. Runs on the CPU FFT on the host instead where it would need more than half of the card's total memory, decided before the card is touched and logged. [§1.4](CPU_DATA_ANALYSIS_IMAGE.md#14-the-beam-centre) @@ -158,7 +158,7 @@ total and not on what is free, the same input on the same card always takes the The model's structure factors and the rigid body run on the card where there is one, every part placed on it or on the CPU up front against one budget, 80% of the card's total memory ([§14.8](CPU_DATA_ANALYSIS_DECISIONS.md#148-rigid-body-placement-of-the-model)); the GPU and CPU -agree to rounding (float distances, cuFFT for FFTW, the crystal's symmetry composed in reciprocal +agree to rounding (float distances, cuFFT for pocketfft, the crystal's symmetry composed in reciprocal space instead of by symmetrizing the grid). On a machine with several cards, the rigid-body engines the first card has no room for go on the others, each against its own budget. @@ -217,7 +217,7 @@ reflections, the grids, the symmetry and the restraints resident, and per evalua positions up and one value and one gradient per atom back. Everything that depends on the cell, the group and the reflections - the grids, the operators, the adjoint's lists - is worked out once on the host with gemmi when the engine is made. The GPU and CPU engines compute the same target to rounding (float distances and densities, -cuFFT for FFTW, summation order); the GPU's result is the same from run to run, as no sum of a result is a +cuFFT for pocketfft, summation order); the GPU's result is the same from run to run, as no sum of a result is a floating-point atomic: every per-point, per-reflection and per-atom sum is a gather in a fixed order, and every total a `cub::DeviceReduce` tree, whose order for a given size is fixed. diff --git a/docs/RUGNUX_CLI.md b/docs/RUGNUX_CLI.md index 47f6ede82..6a5237e7a 100644 --- a/docs/RUGNUX_CLI.md +++ b/docs/RUGNUX_CLI.md @@ -280,7 +280,7 @@ For very long axes the direction grid's angular resolution binds well below 500 | Option | Description | | --- | --- | | `--force-still` | Treat a rotation (goniometer) dataset as independent stills instead of rotation; several masters are then read as one stills run | -| `-X, --indexing-algorithm ` | `Auto` (default) \| `FFT` \| `cuFFT` \| `FFTW` \| `FFBIDX` \| `None`, case-insensitive. `FFT` is the de-novo FFT search, on the GPU (cuFFT) where there is one and `--no-gpu` is not given, otherwise on the CPU (FFTW); `cuFFT` and `FFTW` name one implementation each; `cuFFT` needs a GPU and is refused without one. `FFBIDX` (known cell, `-C`) runs on the GPU where there is one and otherwise on the CPU. `Auto` takes `FFBIDX` on stills with a known cell, and `FFT` otherwise. `FFBIDX` without a cell (`-C`, or one from `-z`) resolves to `None` and indexes nothing, with no error. On rotation data `-X` is not consulted: the FFT search runs on the GPU where there is one and on the CPU otherwise, so `Auto`, `FFT`, `cuFFT` (with a GPU) and `FFTW` (without one, or under `--no-gpu`) are accepted and any other value stops the run at indexing; `FFBIDX` and `None` are for stills | +| `-X, --indexing-algorithm ` | `Auto` (default) \| `FFT` \| `cuFFT` \| `FFTW` \| `FFBIDX` \| `None`, case-insensitive. `FFT` is the de-novo FFT search, on the GPU (cuFFT) where there is one and `--no-gpu` is not given, otherwise on the CPU (FFTW); `cuFFT` and `FFTW` name one implementation each (`FFTW` keeps its old name: the CPU transforms are pocketfft's); `cuFFT` needs a GPU and is refused without one. `FFBIDX` (known cell, `-C`) runs on the GPU where there is one and otherwise on the CPU. `Auto` takes `FFBIDX` on stills with a known cell, and `FFT` otherwise. `FFBIDX` without a cell (`-C`, or one from `-z`) resolves to `None` and indexes nothing, with no error. On rotation data `-X` is not consulted: the FFT search runs on the GPU where there is one and on the CPU otherwise, so `Auto`, `FFT`, `cuFFT` (with a GPU) and `FFTW` (without one, or under `--no-gpu`) are accepted and any other value stops the run at indexing; `FFBIDX` and `None` are for stills | | `-F` | Short for `-X FFT`, kept for old command lines | | `-C, --unit-cell ` | Reference unit cell `"a,b,c,alpha,beta,gamma"` (required by `ffbidx`). On rotation data it also widens the FFT search to cover the cell given, at both ends: the longest axis looked for is raised to reach it, and `--fft-min-unit-cell` is lowered to admit it. A candidate that is an integer supercell of the cell given (a twin's coincidence lattice, a row taken at a multiple of its length) is stepped down to it. On stills the run always uses it: the geometry refinement takes it as a prior (1 % on the lengths, 1° on the angles the crystal system leaves free), and the log warns - with both numbers - where the frames refine its shape more than 3 % / 3° away, or where a sample of frames indexed de novo puts materially more spots on the lattice than the cell given ([§7.7](CPU_DATA_ANALYSIS_INDEXING.md#77-stills-a-given-cell-and-the-detector-modules)). Without `-S` the cell fixes the crystal system, read from the angles as typed: an angle is 90° or 120° only where it is typed so (`90` or `90.00`, not `90.03`). Three 90s: orthorhombic, or tetragonal / cubic where the lengths are equal within tolerance; two 90s and a 120: hexagonal (or rhombohedral in hexagonal axes); two 90s: monoclinic; three equal angles: rhombohedral; anything else: triclinic, and the run behaves as with `-S P1`. The lattice is indexed in that system, never above or below it, and only the space group within it is searched | | `--fft-min-unit-cell ` | Shortest cell axis the FFT search accepts, Å (default: 10; accepted 5-40). A candidate with a shorter axis is discarded — but on rotation data a row shorter than the floor, down to 3 Å, is recognised under the multiple of it the search reports past the floor, so a small-molecule cell is indexed without this flag. `-C` lowers the floor on its own to cover the cell given. On stills a crystal below the floor cannot be indexed unless this is lowered | diff --git a/docs/RUGNUX_INSTALL.md b/docs/RUGNUX_INSTALL.md index 7d7ac0af9..cfa2f529d 100644 --- a/docs/RUGNUX_INSTALL.md +++ b/docs/RUGNUX_INSTALL.md @@ -84,8 +84,8 @@ The released Linux and Windows archives are CUDA builds (the macOS one is CPU-on an NVIDIA **driver** on the host — 525.60.13 or newer for the CUDA 12 archive, 580.65.06 or newer for the CUDA 13 ones — and no CUDA toolkit, because everything CUDA is linked statically. With no GPU or no driver, `rugnux` reports zero CUDA -devices and falls back to the CPU path, which works but is far slower: the FFT search runs on FFTW -and `ffbidx` on its CPU implementation, and the refinement of a placed model takes minutes rather than +devices and falls back to the CPU path, which works but is far slower: the FFT search runs on the CPU FFT +(pocketfft) and `ffbidx` on its CPU implementation, and the refinement of a placed model takes minutes rather than seconds. A **V100 needs the CUDA 12 archive**; which generations each build covers is in [Release contents ▸ GPU generations and the NVIDIA driver](RELEASE_CONTENTS.md#gpu-generations-and-the-nvidia-driver). diff --git a/docs/SOFTWARE.md b/docs/SOFTWARE.md index 94f23e61b..db59cbfc8 100644 --- a/docs/SOFTWARE.md +++ b/docs/SOFTWARE.md @@ -35,7 +35,7 @@ Optional: * Qt version 6 (for jfjoch_viewer) Many further dependencies (spdlog, Zstandard, HDF5, slsDetectorPackage, libzmq, libtiff, -FFTW, Ceres with abseil, the fast feedback indexer, Catch2, ...) are downloaded automatically +Ceres with abseil, the fast feedback indexer, Catch2, ...) are downloaded automatically by CMake and statically linked; building therefore requires network access on the first configure. zlib (as zlib-ng in its zlib-compatible mode) and Eigen are among them: a copy already on the machine is used instead if the configure is given `-DZLIB_ROOT=` or `-DEigen3_DIR=`. diff --git a/docs/THIRD_PARTY_NOTICES.md b/docs/THIRD_PARTY_NOTICES.md index 13990f7b0..83aff2794 100644 --- a/docs/THIRD_PARTY_NOTICES.md +++ b/docs/THIRD_PARTY_NOTICES.md @@ -31,7 +31,6 @@ linked into the Jungfraujoch executables. | [cpp-httplib](https://github.com/yhirose/cpp-httplib) | 0.56.0 | Yuji Hirose | MIT | [cpp-httplib.txt](https://gitea.psi.ch/mx/jungfraujoch/src/branch/main/licenses/cpp-httplib.txt) | | [libzmq (ZeroMQ)](https://github.com/zeromq/libzmq) | 4.3.5 | iMatix and contributors | MPL-2.0 | [libzmq.txt](https://gitea.psi.ch/mx/jungfraujoch/src/branch/main/licenses/libzmq.txt) | | [libtiff](https://gitlab.com/libtiff/libtiff) | 4.7.2 | Sam Leffler; SGI | libtiff (BSD-like) | [libtiff.txt](https://gitea.psi.ch/mx/jungfraujoch/src/branch/main/licenses/libtiff.txt) | -| [FFTW](https://www.fftw.org/) | 3.3.10 | Matteo Frigo; MIT | GPL-2.0-or-later | [fftw.txt](https://gitea.psi.ch/mx/jungfraujoch/src/branch/main/licenses/fftw.txt) | | [Ceres Solver](https://github.com/ceres-solver/ceres-solver) | commit 0c70ed3a1a2d | Google Inc. and contributors | BSD-3-Clause | [ceres-solver.txt](https://gitea.psi.ch/mx/jungfraujoch/src/branch/main/licenses/ceres-solver.txt) | | [Abseil](https://github.com/abseil/abseil-cpp) | 20250127 (required by Ceres) | Google Inc. | Apache-2.0 | [abseil.txt](https://gitea.psi.ch/mx/jungfraujoch/src/branch/main/licenses/abseil.txt) | | [Mbed TLS](https://github.com/Mbed-TLS/mbedtls) (with TF-PSA-Crypto) | 4.2.0 | The Mbed TLS Contributors | Apache-2.0 OR GPL-2.0-or-later (used under Apache-2.0) | [mbedtls.txt](https://gitea.psi.ch/mx/jungfraujoch/src/branch/main/licenses/mbedtls.txt), [tf-psa-crypto.txt](https://gitea.psi.ch/mx/jungfraujoch/src/branch/main/licenses/tf-psa-crypto.txt) | @@ -168,7 +167,6 @@ served frontend, so the shipped web UI carries its own attribution. * **slsDetectorPackage's bundled code**: the slsDetectorPackage sources compiled into the binaries include an MD5 implementation taken from OpenSSL (Apache-2.0) and the RapidJSON headers (MIT); their `msinttypes/` headers (BSD-3-Clause) are for old MSVC compilers only. -* **FFTW** is GPL-2.0-or-later — compatible with, and absorbed by, this project's GPL-3.0 license. * **Apache-2.0** components: where upstream ships a `NOTICE` file, it is reproduced in the corresponding `licenses/` text. * **CCP4 Monomer Library (LGPL-3.0)** is data, not code: the restraint dictionaries of the compounds diff --git a/image_analysis/geom_refinement/BeamCenterFFTEngine.h b/image_analysis/geom_refinement/BeamCenterFFTEngine.h index 226adbf00..6de55cfde 100644 --- a/image_analysis/geom_refinement/BeamCenterFFTEngine.h +++ b/image_analysis/geom_refinement/BeamCenterFFTEngine.h @@ -71,7 +71,7 @@ constexpr double BEAM_CENTER_VARIANCE_FLOOR = 1e-4; // Smallest 2-3-5-7-smooth transform length >= n. Both engines pad to it, so both score the same // grid. A smooth length is not a micro-optimisation here: the naive next-power-of-two pad of a -// 16 Mpixel detector costs 3x the time of the smooth one on both FFTW and cuFFT, and 2.5 GB of +// 16 Mpixel detector costs 3x the time of the smooth one on both the CPU FFT and cuFFT, and 2.5 GB of // cuFFT plan memory against a few hundred MB (measured). [[nodiscard]] int64_t BeamCenterFFTPadSize(int64_t n); diff --git a/image_analysis/indexing/FFTIndexer.cpp b/image_analysis/indexing/FFTIndexer.cpp index ab666f957..cd76beb53 100644 --- a/image_analysis/indexing/FFTIndexer.cpp +++ b/image_analysis/indexing/FFTIndexer.cpp @@ -43,15 +43,15 @@ FFTIndexer::FFTIndexer(const IndexingSettings &settings) if (max_length_A <= settings.GetFFT_HighResolution_A()) throw std::invalid_argument("Largest unit cell cannot be smaller than resolution"); if (nDirections <= 1) - throw std::invalid_argument("FFTWIndexer: number of directions must be > 1"); + throw std::invalid_argument("FFTIndexer: number of directions must be > 1"); if (!(max_length_A > 0.f)) - throw std::invalid_argument("FFTWIndexer: max_length_A must be > 0"); + throw std::invalid_argument("FFTIndexer: max_length_A must be > 0"); if (!(settings.GetFFT_HighResolution_A() > 0.f)) - throw std::invalid_argument("FFTWIndexer: high resolution must be > 0"); + throw std::invalid_argument("FFTIndexer: high resolution must be > 0"); if (histogram_size < 1) - throw std::invalid_argument("FFTWIndexer: histogram_size must be >= 1"); + throw std::invalid_argument("FFTIndexer: histogram_size must be >= 1"); if (histogram_size > 1000000) - throw std::invalid_argument("FFTWIndexer: histogram_size too large"); + throw std::invalid_argument("FFTIndexer: histogram_size too large"); SetupDirectionVectors(); } diff --git a/image_analysis/indexing/IndexerFactory.cpp b/image_analysis/indexing/IndexerFactory.cpp index 52be026d3..18994fa47 100644 --- a/image_analysis/indexing/IndexerFactory.cpp +++ b/image_analysis/indexing/IndexerFactory.cpp @@ -10,9 +10,7 @@ #include "FFTIndexerGPU.h" #endif -#ifdef JFJOCH_USE_FFTW #include "FFTIndexerCPU.h" -#endif std::unique_ptr CreateIndexer(const DiffractionExperiment& experiment) { std::unique_ptr indexer; @@ -27,10 +25,8 @@ std::unique_ptr CreateIndexer(const DiffractionExperiment& experiment) indexer->Setup(experiment); break; case IndexingAlgorithmEnum::FFTW: -#ifdef JFJOCH_USE_FFTW indexer = std::make_unique(experiment.GetIndexingSettings()); indexer->Setup(experiment); -#endif break; case IndexingAlgorithmEnum::FFT: #ifdef JFJOCH_USE_CUDA diff --git a/image_analysis/indexing/IndexerThreadPool.cpp b/image_analysis/indexing/IndexerThreadPool.cpp index 013ea4e51..4a99f4d28 100644 --- a/image_analysis/indexing/IndexerThreadPool.cpp +++ b/image_analysis/indexing/IndexerThreadPool.cpp @@ -18,9 +18,7 @@ #include "FFTIndexerGPU.h" #endif -#ifdef JFJOCH_USE_FFTW #include "FFTIndexerCPU.h" -#endif double WarmUpCuFFT() { #ifdef JFJOCH_USE_CUDA @@ -189,10 +187,8 @@ static std::unique_ptr MakeIndexer(IndexingAlgorithmEnum algorithm, con #endif if (algorithm == IndexingAlgorithmEnum::FFBIDX) return std::make_unique(); -#ifdef JFJOCH_USE_FFTW if (algorithm == IndexingAlgorithmEnum::FFTW) return std::make_unique(settings); -#endif return nullptr; } @@ -468,17 +464,12 @@ IndexerResult IndexerThreadPool::Run(const DiffractionExperiment &experiment, co // available for the resolved algorithm" from deep inside a worker. const auto requested = experiment.GetIndexingSettings().GetAlgorithm(); const bool have_gpu = get_gpu_count() > 0; -#ifdef JFJOCH_USE_FFTW - constexpr bool fftw_built = true; -#else - constexpr bool fftw_built = false; -#endif const bool servable = (algorithm == IndexingAlgorithmEnum::FFT && have_gpu && (requested == IndexingAlgorithmEnum::Auto || requested == IndexingAlgorithmEnum::FFT)) || (algorithm == IndexingAlgorithmEnum::FFBIDX && (requested == IndexingAlgorithmEnum::Auto || requested == IndexingAlgorithmEnum::FFBIDX)) || - (algorithm == IndexingAlgorithmEnum::FFTW && fftw_built && + (algorithm == IndexingAlgorithmEnum::FFTW && ((requested == IndexingAlgorithmEnum::Auto && !have_gpu) || requested == IndexingAlgorithmEnum::FFTW)); if (!servable) { std::string msg; @@ -487,8 +478,6 @@ IndexerResult IndexerThreadPool::Run(const DiffractionExperiment &experiment, co "always uses the GPU FFT indexer here; select FFT or Auto, or run FFTW on a CPU-only node."; else if (algorithm == IndexingAlgorithmEnum::FFT && !have_gpu) msg = "FFT is the GPU indexer but no GPU is available. Select FFTW or Auto for CPU indexing."; - else if (algorithm == IndexingAlgorithmEnum::FFTW) - msg = "FFTW (CPU) indexing was requested but this build has no FFTW indexer."; else msg = "the requested indexing algorithm resolved to one with no indexer available on this host."; throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, diff --git a/image_analysis/scale_merge/TranslationalNCS.cpp b/image_analysis/scale_merge/TranslationalNCS.cpp index cf9e1f486..02aa3c97d 100644 --- a/image_analysis/scale_merge/TranslationalNCS.cpp +++ b/image_analysis/scale_merge/TranslationalNCS.cpp @@ -115,8 +115,8 @@ namespace { return out; } - // Round up to the next even number whose only prime factors are 2, 3 and 5 - the sizes FFTW has - // codelets for. + // Round up to the next even number whose only prime factors are 2, 3 and 5 - the sizes the FFT + // factorises fastest. int SmoothSize(int v) { v = std::max(2, v); for (;; ++v) { diff --git a/image_analysis/structure_refinement/ModelStructureFactorsGPU.h b/image_analysis/structure_refinement/ModelStructureFactorsGPU.h index 12349b56a..43114fb1f 100644 --- a/image_analysis/structure_refinement/ModelStructureFactorsGPU.h +++ b/image_analysis/structure_refinement/ModelStructureFactorsGPU.h @@ -9,7 +9,7 @@ // bulk-solvent mask (gemmi's SolventMasker with the Refmac radii), each transformed and read off as // prepare_asu_data() lists them; and the inverse transform of a set of map coefficients, as // get_f_phi_on_grid() and MapFromFPhi() make it - moved to the device. The two agree to rounding, not -// bit for bit: float distances and cuFFT for FFTW, and the crystal's symmetry is composed in reciprocal +// bit for bit: float distances and cuFFT for pocketfft, and the crystal's symmetry is composed in reciprocal // space (SymmetryComposition, RigidBodyRefine.h) instead of by symmetrizing the grid. The GPU is // deterministic on its own. // diff --git a/image_analysis/structure_refinement/MolecularReplacementGPU.h b/image_analysis/structure_refinement/MolecularReplacementGPU.h index 47e323fc8..ee50f53ba 100644 --- a/image_analysis/structure_refinement/MolecularReplacementGPU.h +++ b/image_analysis/structure_refinement/MolecularReplacementGPU.h @@ -6,7 +6,7 @@ // The molecular-replacement search on a GPU (CUDA builds only; the header itself needs no CUDA): the // rotation function and the translation function of MolecularReplacement.h, the same functions as the // CPU computes - the same trilinear interpolation of the same molecular transform, the same bins, the -// same coefficients on the same grid - in float on the device, with cuFFT for FFTW. The two agree to +// same coefficients on the same grid - in float on the device, with cuFFT for pocketfft. The two agree to // rounding, not bit for bit. Every reduction runs in a fixed order and nothing is summed with an // atomic, so the GPU is deterministic on its own. diff --git a/image_analysis/structure_refinement/RigidBodyGPU.h b/image_analysis/structure_refinement/RigidBodyGPU.h index d99ad72e7..52a476f5d 100644 --- a/image_analysis/structure_refinement/RigidBodyGPU.h +++ b/image_analysis/structure_refinement/RigidBodyGPU.h @@ -7,7 +7,7 @@ // It is the function RigidBodyTarget computes on the CPU - the same density, the same composition of // Fcalc from one copy, the same bulk-solvent mask, scale fit, residuals and Jacobian - moved to the // device so that a fit takes a fraction of a second instead of several seconds. The two agree to -// rounding, not bit for bit: float distances, cuFFT for FFTW. The GPU is deterministic on its own. +// rounding, not bit for bit: float distances, cuFFT for pocketfft. The GPU is deterministic on its own. #include #include diff --git a/licenses/COLLECT.sh b/licenses/COLLECT.sh index ad8408608..31e69767f 100644 --- a/licenses/COLLECT.sh +++ b/licenses/COLLECT.sh @@ -50,7 +50,6 @@ copy_license catch2.txt "$(find_dep catch2-src/LICENSE.txt)" copy_license cpp-httplib.txt "$(find_dep httplib-src/LICENSE)" copy_license libzmq.txt "$(find_dep libzmq-src/LICENSE)" copy_license libtiff.txt "$(find_dep tiff-src/LICENSE.md)" -copy_license fftw.txt "$(find_dep fftw-src/COPYING)" copy_license ceres-solver.txt "$(find_dep ceres-src/LICENSE)" copy_license abseil.txt "$(find_dep ceres-src/third_party/abseil-cpp/LICENSE)" copy_license eigen.txt "$(find_dep eigen3-src/COPYING.MPL2)" diff --git a/licenses/fftw.txt b/licenses/fftw.txt deleted file mode 100644 index 623b6258a..000000000 --- a/licenses/fftw.txt +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/rugnux/rugnux_cli.cpp b/rugnux/rugnux_cli.cpp index bbbb2f184..701de869d 100644 --- a/rugnux/rugnux_cli.cpp +++ b/rugnux/rugnux_cli.cpp @@ -1203,7 +1203,7 @@ int RugnuxCli::Parse(int argc, char **argv) { if (alg == "ffbidx") indexing_algorithm = IndexingAlgorithmEnum::FFBIDX; - else if (alg == "fft") // the algorithm: on the GPU where there is one, else with FFTW + else if (alg == "fft") // the algorithm: on the GPU where there is one, else on the CPU indexing_algorithm = get_gpu_count() > 0 ? IndexingAlgorithmEnum::FFT : IndexingAlgorithmEnum::FFTW; else if (alg == "cufft") indexing_algorithm = IndexingAlgorithmEnum::FFT; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 17b290a3e..84112652d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -247,7 +247,7 @@ ADD_EXECUTABLE(jfjoch_test target_link_libraries(jfjoch_test Catch2WithMain JFJochBroker JFJochReceiver JFJochReader JFJochStreamWriter JFJochRugnuxOutput JFJochRugnux JFJochModelWriter JFJochImageAnalysis JFJochCommon JFJochHLSSimulation JFJochPreview - jfjoch_xds_plugin ZLIB::ZLIB httplib::httplib fftw3f) + jfjoch_xds_plugin ZLIB::ZLIB httplib::httplib) target_include_directories(jfjoch_test PRIVATE .) IF (JFJOCH_CUDA_AVAILABLE) TARGET_COMPILE_DEFINITIONS(jfjoch_test PRIVATE FFBIDX_SIMPLE_DATA_DIR="${FFBIDX_SIMPLE_DATA_DIR}") diff --git a/tests/CpuFFTTest.cpp b/tests/CpuFFTTest.cpp index 2046231d6..98cdcbf7d 100644 --- a/tests/CpuFFTTest.cpp +++ b/tests/CpuFFTTest.cpp @@ -4,17 +4,17 @@ #include #include +#include #include #include #include -#include - #include "../common/CpuFFT.h" #include "../image_analysis/structure_refinement/ModelFFT.h" -// pocketfft (common/CpuFFT) against FFTW on the shapes and layouts the call sites use: the same -// transform to float rounding. FFTW is linked into the test binary only, as the reference. +// pocketfft (common/CpuFFT) on the shapes and layouts the call sites use, against a direct DFT in double +// precision: the forward transforms to float rounding, the backward ones by a round trip (an unnormalised +// forward + backward pair gives the input times the number of points). namespace { @@ -28,78 +28,103 @@ std::vector Random(size_t n, unsigned seed) { } // Largest difference relative to the largest value of the reference. -template -double RelativeError(const std::vector &a, const std::vector &ref) { +template +double RelativeError(const std::vector &a, const std::vector &ref) { REQUIRE(a.size() == ref.size()); double diff = 0, scale = 0; for (size_t i = 0; i < a.size(); i++) { - diff = std::max(diff, static_cast(std::abs(a[i] - ref[i]))); - scale = std::max(scale, static_cast(std::abs(ref[i]))); + diff = std::max(diff, std::abs(std::complex(a[i]) - std::complex(ref[i]))); + scale = std::max(scale, std::abs(std::complex(ref[i]))); } return diff / scale; } +// Forward DFT of a row-major array along every axis, computed directly, in double precision. +std::vector> DirectDFT(const std::vector &shape, const std::vector &in) { + std::vector> a(in.begin(), in.end()); + size_t stride = a.size(); + for (size_t n : shape) { + stride /= n; + std::vector> line(n); + for (size_t base = 0; base < a.size(); base++) { + if ((base / stride) % n != 0) + continue; // not the first element of a line along this axis + for (size_t k = 0; k < n; k++) { + std::complex s = 0; + for (size_t j = 0; j < n; j++) + s += a[base + j * stride] * std::polar(1.0, -2.0 * M_PI * static_cast(j * k % n) / n); + line[k] = s; + } + for (size_t k = 0; k < n; k++) + a[base + k * stride] = line[k]; + } + } + return a; +} + +// The half (n/2 + 1 values) of the last axis that a real transform keeps. +std::vector> HalfLastAxis(const std::vector &shape, + const std::vector> &full) { + const size_t n = shape.back(), nc = n / 2 + 1; + std::vector> half; + for (size_t i = 0; i < full.size(); i++) + if (i % n < nc) + half.push_back(full[i]); + return half; +} + +std::vector Scaled(const std::vector &v, double s) { + std::vector r(v.size()); + for (size_t i = 0; i < v.size(); i++) + r[i] = static_cast(v[i] * s); + return r; +} + } // namespace -TEST_CASE("CpuFFT_BatchedR2CMatchesFFTW", "[fft]") { +TEST_CASE("CpuFFT_BatchedR2CMatchesDirectDFT", "[fft]") { // The FFT indexer's histograms: one transform per direction; 3142 = 2 x 1571 is a real length. - for (int n : {3142, 3150, 1024}) { - const int howmany = 37, nc = n / 2 + 1; - std::vector in = Random(static_cast(howmany) * n, n); - std::vector> ours(static_cast(howmany) * nc), ref(ours.size()); - cpu_fft::R2C({static_cast(howmany), static_cast(n)}, {1}, in.data(), ours.data()); - std::vector work = in; - fftwf_plan p = fftwf_plan_many_dft_r2c(1, &n, howmany, work.data(), nullptr, 1, n, - reinterpret_cast(ref.data()), nullptr, 1, nc, - FFTW_ESTIMATE); - fftwf_execute(p); - fftwf_destroy_plan(p); + for (size_t n : {3142, 3150, 1024}) { + const size_t howmany = 5; + const std::vector in = Random(howmany * n, n); + std::vector> ours(howmany * (n / 2 + 1)); + cpu_fft::R2C({howmany, n}, {1}, in.data(), ours.data()); + // DirectDFT over the batch axis too would mix the lines: transform each line on its own. + std::vector> ref; + for (size_t i = 0; i < howmany; i++) { + const std::vector line(in.begin() + i * n, in.begin() + (i + 1) * n); + const auto r = HalfLastAxis({n}, DirectDFT({n}, line)); + ref.insert(ref.end(), r.begin(), r.end()); + } CHECK(RelativeError(ours, ref) < 1e-5); } } -TEST_CASE("CpuFFT_2DRoundTripMatchesFFTW", "[fft]") { +TEST_CASE("CpuFFT_2DRoundTrip", "[fft]") { // The beam-centre search: a 2D r2c and c2r on a 2-3-5-7-smooth padded size. - const int ny = 210, nx = 336, nxc = nx / 2 + 1; - std::vector in = Random(static_cast(ny) * nx, 1); - std::vector> ours(static_cast(ny) * nxc), ref(ours.size()); - cpu_fft::R2C({static_cast(ny), static_cast(nx)}, {0, 1}, in.data(), ours.data()); - std::vector work = in; - fftwf_plan p = fftwf_plan_dft_r2c_2d(ny, nx, work.data(), reinterpret_cast(ref.data()), - FFTW_ESTIMATE); - fftwf_execute(p); - fftwf_destroy_plan(p); - CHECK(RelativeError(ours, ref) < 1e-5); + const std::vector shape = {210, 336}; + const std::vector in = Random(shape[0] * shape[1], 1); + std::vector> ours(shape[0] * (shape[1] / 2 + 1)); + cpu_fft::R2C(shape, {0, 1}, in.data(), ours.data()); + CHECK(RelativeError(ours, HalfLastAxis(shape, DirectDFT(shape, in))) < 1e-5); - std::vector back_ours(in.size()), back_ref(in.size()); - cpu_fft::C2R({static_cast(ny), static_cast(nx)}, {0, 1}, ours.data(), back_ours.data()); - p = fftwf_plan_dft_c2r_2d(ny, nx, reinterpret_cast(ref.data()), back_ref.data(), FFTW_ESTIMATE); - fftwf_execute(p); - fftwf_destroy_plan(p); - CHECK(RelativeError(back_ours, back_ref) < 1e-5); + std::vector back(in.size()); + cpu_fft::C2R(shape, {0, 1}, ours.data(), back.data()); + CHECK(RelativeError(back, Scaled(in, static_cast(in.size()))) < 1e-5); } -TEST_CASE("CpuFFT_3DMatchesFFTW", "[fft]") { +TEST_CASE("CpuFFT_3DRoundTrip", "[fft]") { // The model maps (u fastest, w halved) and the tNCS Patterson (row-major, last axis halved) are both a // row-major 3D transform halving the last axis; an odd length and a factor 7 included. - const int n0 = 70, n1 = 45, n2 = 54, nc = static_cast(static_cast(n0) * n1 * (n2 / 2 + 1)); - const std::vector in = Random(static_cast(n0) * n1 * n2, 2); - std::vector> ours(nc), ref(nc); - cpu_fft::R2C({70, 45, 54}, {0, 1, 2}, in.data(), ours.data()); - std::vector work = in; - fftwf_plan p = fftwf_plan_dft_r2c_3d(n0, n1, n2, work.data(), reinterpret_cast(ref.data()), - FFTW_ESTIMATE); - fftwf_execute(p); - fftwf_destroy_plan(p); - CHECK(RelativeError(ours, ref) < 1e-5); + const std::vector shape = {70, 45, 54}; + const std::vector in = Random(shape[0] * shape[1] * shape[2], 2); + std::vector> ours(shape[0] * shape[1] * (shape[2] / 2 + 1)); + cpu_fft::R2C(shape, {0, 1, 2}, in.data(), ours.data()); + CHECK(RelativeError(ours, HalfLastAxis(shape, DirectDFT(shape, in))) < 1e-5); - std::vector back_ours(in.size()), back_ref(in.size()); - cpu_fft::C2R({70, 45, 54}, {0, 1, 2}, ours.data(), back_ours.data()); - p = fftwf_plan_dft_c2r_3d(n0, n1, n2, reinterpret_cast(ref.data()), back_ref.data(), - FFTW_ESTIMATE); - fftwf_execute(p); - fftwf_destroy_plan(p); - CHECK(RelativeError(back_ours, back_ref) < 1e-5); + std::vector back(in.size()); + cpu_fft::C2R(shape, {0, 1, 2}, ours.data(), back.data()); + CHECK(RelativeError(back, Scaled(in, static_cast(in.size()))) < 1e-5); } TEST_CASE("CpuFFT_MapToFPhiInParallelMatchesMapToFPhi", "[fft]") { diff --git a/tests/IndexingUnitTest.cpp b/tests/IndexingUnitTest.cpp index cc56abdbc..a913d9a9a 100644 --- a/tests/IndexingUnitTest.cpp +++ b/tests/IndexingUnitTest.cpp @@ -710,9 +710,7 @@ namespace { #ifdef JFJOCH_USE_CUDA ret.push_back(IndexingAlgorithmEnum::FFT); #endif -#ifdef JFJOCH_USE_FFTW ret.push_back(IndexingAlgorithmEnum::FFTW); -#endif return ret; } diff --git a/tests/ModelValidationTest.cpp b/tests/ModelValidationTest.cpp index d5bd688c6..522d7caa5 100644 --- a/tests/ModelValidationTest.cpp +++ b/tests/ModelValidationTest.cpp @@ -1023,7 +1023,7 @@ TEST_CASE("ModelValidation_WarmUpChangesNothing", "[ModelValidation]") { std::filesystem::remove(path); } -// The model path's structure factors come from FFTW; they must be gemmi's own transform to float +// The model path's structure factors come from the CPU FFT (pocketfft); they must be gemmi's own transform to float // precision, in the same layout, so prepare_asu_data() reads the same reflections from either. // A wrong model may come in a group that does not keep the data's metric - a cubic group on an @@ -1161,7 +1161,7 @@ TEST_CASE("ModelValidation_CCModelUnrelatedModelConfirmsNothing", "[ModelValidat std::filesystem::remove(wrong_path); } TEST_CASE("ModelValidation_MapToFPhiMatchesGemmi", "[ModelValidation]") { - // An even grid, and an odd one on every axis (FFTW and pocketfft split odd lengths differently). + // An even grid, and an odd one on every axis (FFT libraries split odd lengths differently). const auto size = GENERATE(std::array{20, 24, 30}, std::array{15, 21, 27}); gemmi::Grid map; map.unit_cell.set(40.0, 50.0, 60.0, 90.0, 95.0, 90.0); @@ -1193,7 +1193,7 @@ TEST_CASE("ModelValidation_MapToFPhiMatchesGemmi", "[ModelValidation]") { CHECK(a.v[i].hkl == b.v[i].hkl); } -// The output maps come from FFTW too; each must be gemmi's own map to float precision, point for point +// The output maps come from the CPU FFT too; each must be gemmi's own map to float precision, point for point // in the same layout. Coefficients with arbitrary phases, negative indices, expanded by symmetry and // Friedel, on grids that are odd along u and v (w is even by construction of a half-l grid). TEST_CASE("ModelValidation_MapFromFPhiMatchesGemmi", "[ModelValidation]") { @@ -1849,7 +1849,7 @@ TEST_CASE("RigidBodyGPU_AxisBrickBoundCoversWrappedBoxes", "[ModelValidation][gp // The GPU target is the CPU target's function, computed on the device: at the same placement the two // give the same residuals and the same Jacobian to rounding (float distances on the device, cuFFT for -// FFTW), on every group of the composition tests, both zones, anisotropic atoms included. +// pocketfft), on every group of the composition tests, both zones, anisotropic atoms included. TEST_CASE("RigidBodyGPU_MatchesCPU", "[ModelValidation][gpu]") { if (get_gpu_count() == 0) SKIP("No GPU"); @@ -2021,7 +2021,7 @@ TEST_CASE("RigidBodyGPU_CallsLeaveTheCallerOnItsCard", "[ModelValidation][gpu]") } // The model's structure factors on the GPU against the CPU path model validation takes - its density -// (PutModelDensityOnGrid) and gemmi's mask on the symmetrized grid, transformed by FFTW and read off by prepare_asu_data() - in the five groups, +// (PutModelDensityOnGrid) and gemmi's mask on the symmetrized grid, transformed by the CPU FFT and read off by prepare_asu_data() - in the five groups, // at a resolution where the mask has a grid of its own (SolventMaskGrid) and at one where it is on the // density's. The same reflections // in the same order; F_calc to rounding; F_mask to the few grid points at an atom's mask radius that float diff --git a/tests/PortableTest.cpp b/tests/PortableTest.cpp index 3c67eed15..214445ada 100644 --- a/tests/PortableTest.cpp +++ b/tests/PortableTest.cpp @@ -115,7 +115,7 @@ TEST_CASE("Portable_BitShuffleBlock_MatchesReference", "[portable][compression]" } } -// The CPU indexer (FFTW, NEON codelets on arm64) on a synthetic orthorhombic lattice. Named +// The CPU FFT indexer (FFTW, on pocketfft) on a synthetic orthorhombic lattice. Named // explicitly rather than through Auto, so a CUDA build on a runner without a GPU tests it too. TEST_CASE("Portable_FFTWIndexer_SyntheticLattice", "[portable][Indexing]") { const UnitCell uc(39, 45, 78, 90, 90, 90); diff --git a/viewer/charts/JFJochDatasetInfoChartView.cpp b/viewer/charts/JFJochDatasetInfoChartView.cpp index 03b8ce9fb..c8ff0b8d6 100644 --- a/viewer/charts/JFJochDatasetInfoChartView.cpp +++ b/viewer/charts/JFJochDatasetInfoChartView.cpp @@ -360,14 +360,10 @@ void JFJochDatasetInfoChartView::updateChart() { delete item; band_items_.clear(); -#ifdef JFJOCH_USE_FFTW if (m_showFFT) buildFFTChart(); else buildTimeDomainChart(); -#else - buildTimeDomainChart(); -#endif // Light red behind the images the merge rejected, light yellow behind the ones it down-weighted. // Above the plot background, below the grid and the curves. @@ -825,13 +821,11 @@ void JFJochDatasetInfoChartView::contextMenuEvent(QContextMenuEvent *event) { binActions.push_back(act); } -#ifdef JFJOCH_USE_FFTW QAction *actShowFFT = menu.addAction("Show FFT (amplitude vs Hz)"); actShowFFT->setCheckable(true); actShowFFT->setChecked(m_showFFT); // Require valid sampling interval actShowFFT->setEnabled(!values.empty() && image_time_s > 0.0); -#endif menu.addSeparator(); const bool has_range = sel_first_ >= 0; @@ -872,11 +866,9 @@ void JFJochDatasetInfoChartView::contextMenuEvent(QContextMenuEvent *event) { if (ok && v >= 1) { setBinning(v); } -#ifdef JFJOCH_USE_FFTW } else if (chosen == actShowFFT) { m_showFFT = !m_showFFT; updateChart(); -#endif } } @@ -897,7 +889,6 @@ void JFJochDatasetInfoChartView::mouseMoveEvent(QMouseEvent *event) { } } -#ifdef JFJOCH_USE_FFTW if (m_showFFT && !m_fftFrequenciesHz.empty()) { // FFT mode: x is frequency in Hz const QPointF chartPos = chart()->mapToValue(event->pos(), series); @@ -948,7 +939,6 @@ void JFJochDatasetInfoChartView::mouseMoveEvent(QMouseEvent *event) { m_hoverPendingIdx = -1; return; } -#endif if (values.empty()) return; @@ -1102,7 +1092,6 @@ void JFJochDatasetInfoChartView::onHoverLoadTimeout() { } } -#ifdef JFJOCH_USE_FFTW void JFJochDatasetInfoChartView::buildFFTChart() { const size_t N = values.size(); @@ -1179,5 +1168,4 @@ void JFJochDatasetInfoChartView::buildFFTChart() { } StyleChartAxes(chart()); } -#endif diff --git a/viewer/charts/JFJochDatasetInfoChartView.h b/viewer/charts/JFJochDatasetInfoChartView.h index e6c1cfb40..9b32db8e1 100644 --- a/viewer/charts/JFJochDatasetInfoChartView.h +++ b/viewer/charts/JFJochDatasetInfoChartView.h @@ -105,12 +105,10 @@ private: // FFT view toggle bool m_showFFT = false; -#ifdef JFJOCH_USE_FFTW // Cached FFT data for hover/status bar etc. void buildFFTChart(); std::vector m_fftMagnitudes; std::vector m_fftFrequenciesHz; -#endif signals: void imageSelected(int64_t number); diff --git a/viewer/resources/third_party_licenses.html b/viewer/resources/third_party_licenses.html index 32455f252..c2f2cf019 100644 --- a/viewer/resources/third_party_licenses.html +++ b/viewer/resources/third_party_licenses.html @@ -22,7 +22,6 @@ manifest with copyright holders is in THIRD_PARTY_NOTICES.md in the source distr
  • eigen
  • Fast feedback indexer
  • fast-float
  • -
  • fftw
  • gemmi
  • half
  • hdf5
  • @@ -1934,348 +1933,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    -

    fftw

    -
    		    GNU GENERAL PUBLIC LICENSE
    -		       Version 2, June 1991
    -
    - Copyright (C) 1989, 1991 Free Software Foundation, Inc.
    -     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    - Everyone is permitted to copy and distribute verbatim copies
    - of this license document, but changing it is not allowed.
    -
    -			    Preamble
    -
    -  The licenses for most software are designed to take away your
    -freedom to share and change it.  By contrast, the GNU General Public
    -License is intended to guarantee your freedom to share and change free
    -software--to make sure the software is free for all its users.  This
    -General Public License applies to most of the Free Software
    -Foundation's software and to any other program whose authors commit to
    -using it.  (Some other Free Software Foundation software is covered by
    -the GNU Library General Public License instead.)  You can apply it to
    -your programs, too.
    -
    -  When we speak of free software, we are referring to freedom, not
    -price.  Our General Public Licenses are designed to make sure that you
    -have the freedom to distribute copies of free software (and charge for
    -this service if you wish), that you receive source code or can get it
    -if you want it, that you can change the software or use pieces of it
    -in new free programs; and that you know you can do these things.
    -
    -  To protect your rights, we need to make restrictions that forbid
    -anyone to deny you these rights or to ask you to surrender the rights.
    -These restrictions translate to certain responsibilities for you if you
    -distribute copies of the software, or if you modify it.
    -
    -  For example, if you distribute copies of such a program, whether
    -gratis or for a fee, you must give the recipients all the rights that
    -you have.  You must make sure that they, too, receive or can get the
    -source code.  And you must show them these terms so they know their
    -rights.
    -
    -  We protect your rights with two steps: (1) copyright the software, and
    -(2) offer you this license which gives you legal permission to copy,
    -distribute and/or modify the software.
    -
    -  Also, for each author's protection and ours, we want to make certain
    -that everyone understands that there is no warranty for this free
    -software.  If the software is modified by someone else and passed on, we
    -want its recipients to know that what they have is not the original, so
    -that any problems introduced by others will not reflect on the original
    -authors' reputations.
    -
    -  Finally, any free program is threatened constantly by software
    -patents.  We wish to avoid the danger that redistributors of a free
    -program will individually obtain patent licenses, in effect making the
    -program proprietary.  To prevent this, we have made it clear that any
    -patent must be licensed for everyone's free use or not licensed at all.
    -
    -  The precise terms and conditions for copying, distribution and
    -modification follow.
    -
    -		    GNU GENERAL PUBLIC LICENSE
    -   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    -
    -  0. This License applies to any program or other work which contains
    -a notice placed by the copyright holder saying it may be distributed
    -under the terms of this General Public License.  The "Program", below,
    -refers to any such program or work, and a "work based on the Program"
    -means either the Program or any derivative work under copyright law:
    -that is to say, a work containing the Program or a portion of it,
    -either verbatim or with modifications and/or translated into another
    -language.  (Hereinafter, translation is included without limitation in
    -the term "modification".)  Each licensee is addressed as "you".
    -
    -Activities other than copying, distribution and modification are not
    -covered by this License; they are outside its scope.  The act of
    -running the Program is not restricted, and the output from the Program
    -is covered only if its contents constitute a work based on the
    -Program (independent of having been made by running the Program).
    -Whether that is true depends on what the Program does.
    -
    -  1. You may copy and distribute verbatim copies of the Program's
    -source code as you receive it, in any medium, provided that you
    -conspicuously and appropriately publish on each copy an appropriate
    -copyright notice and disclaimer of warranty; keep intact all the
    -notices that refer to this License and to the absence of any warranty;
    -and give any other recipients of the Program a copy of this License
    -along with the Program.
    -
    -You may charge a fee for the physical act of transferring a copy, and
    -you may at your option offer warranty protection in exchange for a fee.
    -
    -  2. You may modify your copy or copies of the Program or any portion
    -of it, thus forming a work based on the Program, and copy and
    -distribute such modifications or work under the terms of Section 1
    -above, provided that you also meet all of these conditions:
    -
    -    a) You must cause the modified files to carry prominent notices
    -    stating that you changed the files and the date of any change.
    -
    -    b) You must cause any work that you distribute or publish, that in
    -    whole or in part contains or is derived from the Program or any
    -    part thereof, to be licensed as a whole at no charge to all third
    -    parties under the terms of this License.
    -
    -    c) If the modified program normally reads commands interactively
    -    when run, you must cause it, when started running for such
    -    interactive use in the most ordinary way, to print or display an
    -    announcement including an appropriate copyright notice and a
    -    notice that there is no warranty (or else, saying that you provide
    -    a warranty) and that users may redistribute the program under
    -    these conditions, and telling the user how to view a copy of this
    -    License.  (Exception: if the Program itself is interactive but
    -    does not normally print such an announcement, your work based on
    -    the Program is not required to print an announcement.)
    -
    -These requirements apply to the modified work as a whole.  If
    -identifiable sections of that work are not derived from the Program,
    -and can be reasonably considered independent and separate works in
    -themselves, then this License, and its terms, do not apply to those
    -sections when you distribute them as separate works.  But when you
    -distribute the same sections as part of a whole which is a work based
    -on the Program, the distribution of the whole must be on the terms of
    -this License, whose permissions for other licensees extend to the
    -entire whole, and thus to each and every part regardless of who wrote it.
    -
    -Thus, it is not the intent of this section to claim rights or contest
    -your rights to work written entirely by you; rather, the intent is to
    -exercise the right to control the distribution of derivative or
    -collective works based on the Program.
    -
    -In addition, mere aggregation of another work not based on the Program
    -with the Program (or with a work based on the Program) on a volume of
    -a storage or distribution medium does not bring the other work under
    -the scope of this License.
    -
    -  3. You may copy and distribute the Program (or a work based on it,
    -under Section 2) in object code or executable form under the terms of
    -Sections 1 and 2 above provided that you also do one of the following:
    -
    -    a) Accompany it with the complete corresponding machine-readable
    -    source code, which must be distributed under the terms of Sections
    -    1 and 2 above on a medium customarily used for software interchange; or,
    -
    -    b) Accompany it with a written offer, valid for at least three
    -    years, to give any third party, for a charge no more than your
    -    cost of physically performing source distribution, a complete
    -    machine-readable copy of the corresponding source code, to be
    -    distributed under the terms of Sections 1 and 2 above on a medium
    -    customarily used for software interchange; or,
    -
    -    c) Accompany it with the information you received as to the offer
    -    to distribute corresponding source code.  (This alternative is
    -    allowed only for noncommercial distribution and only if you
    -    received the program in object code or executable form with such
    -    an offer, in accord with Subsection b above.)
    -
    -The source code for a work means the preferred form of the work for
    -making modifications to it.  For an executable work, complete source
    -code means all the source code for all modules it contains, plus any
    -associated interface definition files, plus the scripts used to
    -control compilation and installation of the executable.  However, as a
    -special exception, the source code distributed need not include
    -anything that is normally distributed (in either source or binary
    -form) with the major components (compiler, kernel, and so on) of the
    -operating system on which the executable runs, unless that component
    -itself accompanies the executable.
    -
    -If distribution of executable or object code is made by offering
    -access to copy from a designated place, then offering equivalent
    -access to copy the source code from the same place counts as
    -distribution of the source code, even though third parties are not
    -compelled to copy the source along with the object code.
    -
    -  4. You may not copy, modify, sublicense, or distribute the Program
    -except as expressly provided under this License.  Any attempt
    -otherwise to copy, modify, sublicense or distribute the Program is
    -void, and will automatically terminate your rights under this License.
    -However, parties who have received copies, or rights, from you under
    -this License will not have their licenses terminated so long as such
    -parties remain in full compliance.
    -
    -  5. You are not required to accept this License, since you have not
    -signed it.  However, nothing else grants you permission to modify or
    -distribute the Program or its derivative works.  These actions are
    -prohibited by law if you do not accept this License.  Therefore, by
    -modifying or distributing the Program (or any work based on the
    -Program), you indicate your acceptance of this License to do so, and
    -all its terms and conditions for copying, distributing or modifying
    -the Program or works based on it.
    -
    -  6. Each time you redistribute the Program (or any work based on the
    -Program), the recipient automatically receives a license from the
    -original licensor to copy, distribute or modify the Program subject to
    -these terms and conditions.  You may not impose any further
    -restrictions on the recipients' exercise of the rights granted herein.
    -You are not responsible for enforcing compliance by third parties to
    -this License.
    -
    -  7. If, as a consequence of a court judgment or allegation of patent
    -infringement or for any other reason (not limited to patent issues),
    -conditions are imposed on you (whether by court order, agreement or
    -otherwise) that contradict the conditions of this License, they do not
    -excuse you from the conditions of this License.  If you cannot
    -distribute so as to satisfy simultaneously your obligations under this
    -License and any other pertinent obligations, then as a consequence you
    -may not distribute the Program at all.  For example, if a patent
    -license would not permit royalty-free redistribution of the Program by
    -all those who receive copies directly or indirectly through you, then
    -the only way you could satisfy both it and this License would be to
    -refrain entirely from distribution of the Program.
    -
    -If any portion of this section is held invalid or unenforceable under
    -any particular circumstance, the balance of the section is intended to
    -apply and the section as a whole is intended to apply in other
    -circumstances.
    -
    -It is not the purpose of this section to induce you to infringe any
    -patents or other property right claims or to contest validity of any
    -such claims; this section has the sole purpose of protecting the
    -integrity of the free software distribution system, which is
    -implemented by public license practices.  Many people have made
    -generous contributions to the wide range of software distributed
    -through that system in reliance on consistent application of that
    -system; it is up to the author/donor to decide if he or she is willing
    -to distribute software through any other system and a licensee cannot
    -impose that choice.
    -
    -This section is intended to make thoroughly clear what is believed to
    -be a consequence of the rest of this License.
    -
    -  8. If the distribution and/or use of the Program is restricted in
    -certain countries either by patents or by copyrighted interfaces, the
    -original copyright holder who places the Program under this License
    -may add an explicit geographical distribution limitation excluding
    -those countries, so that distribution is permitted only in or among
    -countries not thus excluded.  In such case, this License incorporates
    -the limitation as if written in the body of this License.
    -
    -  9. The Free Software Foundation may publish revised and/or new versions
    -of the General Public License from time to time.  Such new versions will
    -be similar in spirit to the present version, but may differ in detail to
    -address new problems or concerns.
    -
    -Each version is given a distinguishing version number.  If the Program
    -specifies a version number of this License which applies to it and "any
    -later version", you have the option of following the terms and conditions
    -either of that version or of any later version published by the Free
    -Software Foundation.  If the Program does not specify a version number of
    -this License, you may choose any version ever published by the Free Software
    -Foundation.
    -
    -  10. If you wish to incorporate parts of the Program into other free
    -programs whose distribution conditions are different, write to the author
    -to ask for permission.  For software which is copyrighted by the Free
    -Software Foundation, write to the Free Software Foundation; we sometimes
    -make exceptions for this.  Our decision will be guided by the two goals
    -of preserving the free status of all derivatives of our free software and
    -of promoting the sharing and reuse of software generally.
    -
    -			    NO WARRANTY
    -
    -  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
    -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
    -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
    -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
    -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
    -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
    -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
    -REPAIR OR CORRECTION.
    -
    -  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
    -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
    -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
    -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
    -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
    -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
    -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
    -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
    -POSSIBILITY OF SUCH DAMAGES.
    -
    -		     END OF TERMS AND CONDITIONS
    -
    -	    How to Apply These Terms to Your New Programs
    -
    -  If you develop a new program, and you want it to be of the greatest
    -possible use to the public, the best way to achieve this is to make it
    -free software which everyone can redistribute and change under these terms.
    -
    -  To do so, attach the following notices to the program.  It is safest
    -to attach them to the start of each source file to most effectively
    -convey the exclusion of warranty; and each file should have at least
    -the "copyright" line and a pointer to where the full notice is found.
    -
    -    <one line to give the program's name and a brief idea of what it does.>
    -    Copyright (C) <year>  <name of author>
    -
    -    This program is free software; you can redistribute it and/or modify
    -    it under the terms of the GNU General Public License as published by
    -    the Free Software Foundation; either version 2 of the License, or
    -    (at your option) any later version.
    -
    -    This program is distributed in the hope that it will be useful,
    -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    -    GNU General Public License for more details.
    -
    -    You should have received a copy of the GNU General Public License
    -    along with this program; if not, write to the Free Software
    -    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    -
    -
    -Also add information on how to contact you by electronic and paper mail.
    -
    -If the program is interactive, make it output a short notice like this
    -when it starts in an interactive mode:
    -
    -    Gnomovision version 69, Copyright (C) year  name of author
    -    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    -    This is free software, and you are welcome to redistribute it
    -    under certain conditions; type `show c' for details.
    -
    -The hypothetical commands `show w' and `show c' should show the appropriate
    -parts of the General Public License.  Of course, the commands you use may
    -be called something other than `show w' and `show c'; they could even be
    -mouse-clicks or menu items--whatever suits your program.
    -
    -You should also get your employer (if you work as a programmer) or your
    -school, if any, to sign a "copyright disclaimer" for the program, if
    -necessary.  Here is a sample; alter the names:
    -
    -  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
    -  `Gnomovision' (which makes passes at compilers) written by James Hacker.
    -
    -  <signature of Ty Coon>, 1 April 1989
    -  Ty Coon, President of Vice
    -
    -This General Public License does not permit incorporating your program into
    -proprietary programs.  If your program is a subroutine library, you may
    -consider it more useful to permit linking proprietary applications with the
    -library.  If this is what you want to do, use the GNU Library General
    -Public License instead of this License.
    -

    gemmi

    Mozilla Public License Version 2.0
     ==================================