Compare commits

...

No commits in common. "c8s" and "c10s" have entirely different histories.
c8s ... c10s

9 changed files with 365 additions and 149 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

12
.gitignore vendored
View File

@ -1,2 +1,12 @@
SOURCES/fftw-3.3.5.tar.gz
fftw-3.2.2.tar.gz
/fftw-3.3.tar.gz
/fftw-3.3.1.tar.gz
/fftw-3.3.2.tar.gz
<<<<<<< HEAD
=======
/fftw-3.3.3.tar.gz
>>>>>>> master
/fftw-3.3.4.tar.gz
/fftw-3.3.5.tar.gz
/fftw-3.3.8.tar.gz
/fftw-3.3.10.tar.gz

309
fftw.spec
View File

@ -1,4 +1,13 @@
%if %{defined rhel}
%bcond_with mpich
%else
# TODO check later if we can enable mpich on s390x
%ifarch s390 s390x
%bcond_with mpich
%else
%bcond_without mpich
%endif
%endif
%ifarch s390 s390x
%bcond_with openmpi
%else
@ -11,20 +20,17 @@
%global mpi_list %{?mpi_list} openmpi
%endif
Name: fftw
Version: 3.3.5
Release: 11%{?dist}
Version: 3.3.10
Release: 15%{?dist}
Summary: A Fast Fourier Transform library
Group: System Environment/Libraries
License: GPLv2+
# Generally, the code is under GPL but some headers are also under MIT or BSD:
License: GPL-2.0-or-later AND MIT AND BSD-2-Clause
URL: http://www.fftw.org
Source0: http://www.fftw.org/fftw-%{version}.tar.gz
BuildRequires: gcc-gfortran
Patch1: fix_autotools_build.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: gcc-gfortran
%global quad 0
# Quad precision support only available with gcc >= 4.6 (Fedora >= 15)
@ -33,6 +39,16 @@ BuildRequires: libtool
%global quad 1
%endif
# Names of precisions to (maybe) build
%global prec_names prec_name[0]=single;prec_name[1]=double;prec_name[2]=long;prec_name[3]=quad
# Number of precisions to build; sometimes quad is not possible
%global nprec 3
%if %{quad}
%global nprec 4
%endif
# Number of precisions to build for MPI
%global nmpiprec 3
# For check phase
BuildRequires: time
BuildRequires: perl-interpreter
@ -43,9 +59,10 @@ BuildRequires: nss-myhostname
%if %{with openmpi}
BuildRequires: openmpi-devel
%endif
Requires(post): info
Requires(preun): info
%if %{with mpich} || %{with openmpi}
BuildRequires: environment-modules
%endif
BuildRequires: make
%description
@ -55,7 +72,6 @@ data, and of arbitrary input size.
%package libs
Summary: FFTW run-time library
Group: System Environment/Libraries
Provides: fftw3 = %{version}-%{release}
# Libs rearranged in 3.3.1-2
Obsoletes: fftw-libs-threads < %{version}-%{release}
@ -76,7 +92,6 @@ run-time libraries.
%package devel
Summary: Headers, libraries and docs for the FFTW library
Group: Development/Libraries
Requires: pkgconfig
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
@ -93,21 +108,18 @@ develop programs using the FFTW fast Fourier transform library.
%package libs-double
Summary: FFTW library, double precision
Group: Development/Libraries
%description libs-double
This package contains the FFTW library compiled in double precision.
%package libs-single
Summary: FFTW library, single precision
Group: Development/Libraries
%description libs-single
This package contains the FFTW library compiled in single precision.
%package libs-long
Summary: FFTW library, long double precision
Group: Development/Libraries
%description libs-long
This package contains the FFTW library compiled in long double
@ -116,7 +128,6 @@ precision.
%if %{quad}
%package libs-quad
Summary: FFTW library, quadruple
Group: Development/Libraries
%description libs-quad
This package contains the FFTW library compiled in quadruple
@ -125,7 +136,6 @@ precision.
%package static
Summary: Static versions of the FFTW libraries
Group: Development/Libraries
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
Provides: fftw3-static%{?_isa} = %{version}-%{release}
Provides: fftw3-static = %{version}-%{release}
@ -137,7 +147,6 @@ the FFTW fast Fourier transform library.
%if %{with mpich}
%package mpich-libs
Summary: FFTW MPICH run-time library
Group: System Environment/Libraries
Provides: fftw3-mpich = %{version}-%{release}
# Pull in the actual libraries
@ -152,7 +161,6 @@ MPICH run-time libraries.
%package mpich-devel
Summary: Headers, libraries and docs for the FFTW MPICH library
Group: Development/Libraries
Requires: mpich-devel
Requires: pkgconfig
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
@ -170,7 +178,6 @@ develop programs using the FFTW fast Fourier transform library for MPICH.
%package mpich-libs-double
Summary: FFTW MPICH library, double precision
Group: Development/Libraries
Requires: %{name}-libs-double%{?_isa} = %{version}-%{release}
%description mpich-libs-double
@ -178,7 +185,6 @@ This package contains the FFTW MPICH library compiled in double precision.
%package mpich-libs-single
Summary: FFTW MPICH library, single precision
Group: Development/Libraries
Requires: %{name}-libs-single%{?_isa} = %{version}-%{release}
%description mpich-libs-single
@ -186,7 +192,6 @@ This package contains the FFTW MPICH library compiled in single precision.
%package mpich-libs-long
Summary: FFTW MPICH library, long double precision
Group: Development/Libraries
Requires: %{name}-libs-long%{?_isa} = %{version}-%{release}
%description mpich-libs-long
@ -195,7 +200,6 @@ precision.
%package mpich-static
Summary: Static versions of the FFTW MPICH libraries
Group: Development/Libraries
Requires: %{name}-mpich-devel%{?_isa} = %{version}-%{release}
Requires: %{name}-static%{?_isa} = %{version}-%{release}
Provides: fftw3-mpich-static%{?_isa} = %{version}-%{release}
@ -209,7 +213,6 @@ the FFTW fast Fourier transform library for MPICh.
%if %{with openmpi}
%package openmpi-libs
Summary: FFTW OpenMPI run-time library
Group: System Environment/Libraries
Provides: fftw3-openmpi = %{version}-%{release}
# Pull in the actual libraries
@ -224,7 +227,6 @@ OpenMPI run-time libraries.
%package openmpi-devel
Summary: Headers, libraries and docs for the FFTW OpenMPI library
Group: Development/Libraries
Requires: openmpi-devel
Requires: pkgconfig
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
@ -242,7 +244,6 @@ develop programs using the FFTW fast Fourier transform library for OpenMPI.
%package openmpi-libs-double
Summary: FFTW OpenMPI library, double precision
Group: Development/Libraries
Requires: %{name}-libs-double%{?_isa} = %{version}-%{release}
%description openmpi-libs-double
@ -250,7 +251,6 @@ This package contains the FFTW OpenMPI library compiled in double precision.
%package openmpi-libs-single
Summary: FFTW OpenMPI library, single precision
Group: Development/Libraries
Requires: %{name}-libs-single%{?_isa} = %{version}-%{release}
%description openmpi-libs-single
@ -258,7 +258,6 @@ This package contains the FFTW OpenMPI library compiled in single precision.
%package openmpi-libs-long
Summary: FFTW OpenMPI library, long double precision
Group: Development/Libraries
Requires: %{name}-libs-long%{?_isa} = %{version}-%{release}
%description openmpi-libs-long
@ -267,7 +266,6 @@ precision.
%package openmpi-static
Summary: Static versions of the FFTW OpenMPI libraries
Group: Development/Libraries
Requires: %{name}-openmpi-devel%{?_isa} = %{version}-%{release}
Requires: %{name}-static%{?_isa} = %{version}-%{release}
Provides: fftw3-openmpi-static%{?_isa} = %{version}-%{release}
@ -280,7 +278,6 @@ the FFTW fast Fourier transform library for MPICh.
%package doc
Summary: FFTW library manual
Group: Documentation
BuildArch: noarch
%description doc
@ -288,23 +285,22 @@ This package contains the manual for the FFTW fast Fourier transform
library.
%prep
%setup -q
%autosetup -p1
%build
# Regenerate autoconf files using current tools so proper build flags
# from redhat-rpm-config are used
autoreconf -vfi
%if %{with mpich} || %{with openmpi}
# Explicitly load shell support for the environment-modules package, used
# below via 'module' pseudo-command.
. /etc/profile.d/modules.sh
%endif
# Configure uses g77 by default, if present on system
export F77=gfortran
BASEFLAGS="--enable-shared --disable-dependency-tracking --enable-threads"
BASEFLAGS+=" --enable-openmp"
# Precisions to build
prec_name[0]=single
prec_name[1]=double
prec_name[2]=long
prec_name[3]=quad
%prec_names
# Corresponding flags
prec_flags[0]=--enable-single
@ -314,123 +310,115 @@ prec_flags[3]=--enable-quad-precision
%ifarch x86_64
# Enable SSE2 and AVX support for x86_64
for((i=0;i<2;i++)); do
prec_flags[i]+=" --enable-sse2 --enable-avx"
for ((i=0; i<2; i++)) ; do
prec_flags[i]+=" --enable-sse2 --enable-avx --enable-avx2"
done
%endif
# No NEON run time detection, not all ARM SoCs have NEON
#%ifarch %{arm}
## Compile support for NEON instructions
#for((i=0;i<2;i++)); do
# prec_flags[i]+=" --enable-neon"
#done
#%endif
%ifarch %{arm64}
# Compile support for NEON instructions
for ((i=0; i<2; i++)) ; do
prec_flags[i]+=" --enable-neon"
done
BASEFLAGS+=" --enable-armv8-cntvct-el0"
%endif
#%ifarch ppc ppc64
## Compile support for Altivec instructions
#for((i=0;i<2;i++)); do
#prec_flags[i]+=" --enable-altivec"
#done
#%endif
%ifarch ppc ppc64
# Compile support for Altivec instructions; only supported for single precision
for ((i=0; i<1; i++)) ; do
prec_flags[i]+=" --enable-altivec"
done
%endif
# Loop over precisions
%if %{quad}
for((iprec=0;iprec<4;iprec++))
%else
for((iprec=0;iprec<3;iprec++))
%endif
do
for ((iprec=0; iprec<%{nprec}; iprec++)) ; do
mkdir ${prec_name[iprec]}${ver_name[iver]}
cd ${prec_name[iprec]}${ver_name[iver]}
ln -s ../configure .
%{configure} ${BASEFLAGS} ${prec_flags[iprec]}
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make %{?_smp_mflags}
%make_build
cd ..
done
# MPI Builds - this duplicates the non-mpi builds, but oh well
for mpi in %{mpi_list}
do
for mpi in %{?mpi_list} ; do
module load mpi/${mpi}-%{_arch}
# Loop over precisions - no quad precision support with MPI
for((iprec=0;iprec<3;iprec++))
do
for((iprec=0;iprec<%{nmpiprec};iprec++)) ; do
mkdir ${mpi}-${prec_name[iprec]}${ver_name[iver]}
cd ${mpi}-${prec_name[iprec]}${ver_name[iver]}
ln -s ../configure .
# Force linking the _mpi.so libraries with the mpi libs. This works because
# we get rid of all of the non-mpi components of these builds
export CC=mpicc
%{configure} ${BASEFLAGS} ${prec_flags[iprec]} --enable-mpi \
if [ $mpi = "openmpi" ]; then
export MPIRUN="mpirun --oversubscribe"
fi
%{configure} ${BASEFLAGS} ${prec_flags[iprec]} \
--enable-mpi \
--libdir=%{_libdir}/$mpi/lib \
--bindir=%{_libdir}/$mpi/bin \
--sbindir=%{_libdir}/$mpi/sbin \
--includedir=%{_includedir}/$mpi-%{_arch} \
--mandir=%{_libdir}/$mpi/share/man
make %{?_smp_mflags}
%make_build
cd ..
done
module unload mpi/${mpi}-%{_arch}
done
%install
%if %{quad}
for ver in single double long quad
%else
for ver in single double long
%prec_names
%if %{with mpich} || %{with openmpi}
# Explicitly load shell support for the environment-modules package, used
# below via 'module' pseudo-command.
source /etc/profile.d/modules.sh
%endif
do
make -C $ver install DESTDIR=%{buildroot}
for((iprec=0;iprec<%{nprec};iprec++)) ; do
%make_install -C ${prec_name[iprec]}
done
# MPI
for mpi in %{mpi_list}
do
for mpi in %{?mpi_list} ; do
module load mpi/${mpi}-%{_arch}
for ver in single double long
do
make -C ${mpi}-${ver} install DESTDIR=%{buildroot}
for((iprec=0;iprec<%{nmpiprec};iprec++)) ; do
%make_install -C ${mpi}-${prec_name[iprec]}
# Remove duplicated non-mpi libraries, binaries, and data
find %{buildroot}%{_libdir}/${mpi}/lib -name libfftw\* -a \! -name \*_mpi.\* -delete
rm -r %{buildroot}%{_libdir}/${mpi}/{bin,share}
done
module unload mpi/${mpi}-%{_arch}
done
rm -f %{buildroot}%{_infodir}/dir
find %{buildroot} -name \*.la -delete
%check
bdir=`pwd`
%if %{quad}
for ver in single double long quad
%else
for ver in single double long
%prec_names
%if %{with mpich} || %{with openmpi}
# Explicitly load shell support for the environment-modules package, used
# below via 'module' pseudo-command.
. /etc/profile.d/modules.sh
%endif
do
export LD_LIBRARY_PATH=$bdir/$ver/.libs:$bdir/$ver/threads/.libs
make %{?_smp_mflags} -C $ver check
bdir=$(pwd)
for((iprec=0;iprec<%{nprec};iprec++)) ; do
export LD_LIBRARY_PATH=$bdir/${prec_name[iprec]}/.libs:$bdir/${prec_name[iprec]}/threads/.libs
%make_build -C ${prec_name[iprec]} check
done
# MPI
%if %{with openmpi}
%ifarch %{ix86}
# disable Open MPI's vader byte transfer layer while running tests on 32-bit x86 platforms
# as it is known to be troublesome <https://github.com/open-mpi/ompi/issues/4260>
export OMPI_MCA_btl="^vader"
%endif
%endif
# disable tests on ppc64 and ppc64le for now
# https://github.com/FFTW/fftw3/issues/145
%ifnarch ppc64 ppc64le
for mpi in %{mpi_list}
do
# Allow oversubscription with openmpi
export OMPI_MCA_rmaps_base_oversubscribe=1
for mpi in %{?mpi_list} ; do
module load mpi/${mpi}-%{_arch}
for ver in single double long
do
export LD_LIBRARY_PATH=$bdir/$ver/.libs:$bdir/$ver/threads/.libs
make %{?_smp_mflags} -C ${mpi}-${ver}/mpi check
for((iprec=0;iprec<%{nmpiprec};iprec++)) ; do
export LD_LIBRARY_PATH=$bdir/${prec_name[iprec]}/.libs:$bdir/${prec_name[iprec]}/threads/.libs
%make_build -C ${mpi}-${prec_name[iprec]}/mpi check
done
module unload mpi/${mpi}-%{_arch}
done
@ -441,15 +429,6 @@ done
%if %{quad}
%ldconfig_scriptlets libs-quad
%endif
%endif
%post devel
/sbin/install-info --section="Math" %{_infodir}/%{name}.info.gz %{_infodir}/dir 2>/dev/null || :
%preun devel
if [ "$1" = 0 ]; then
/sbin/install-info --delete %{_infodir}/%{name}.info.gz %{_infodir}/dir 2>/dev/null || :
fi
%files
%{_mandir}/man1/fftw*.1*
@ -491,6 +470,8 @@ fi
%doc doc/FAQ/fftw-faq.html/
%doc %{_infodir}/fftw3.info*
%{_includedir}/fftw3*
%dir %{_libdir}/cmake/fftw3/
%{_libdir}/cmake/fftw3/*.cmake
%{_libdir}/pkgconfig/fftw3*.pc
%{_libdir}/libfftw3*.so
@ -521,6 +502,8 @@ fi
%files mpich-devel
%doc doc/FAQ/fftw-faq.html/
%{_includedir}/mpich-%{_arch}
%dir %{_libdir}/mpich/lib/cmake/fftw3/
%{_libdir}/mpich/lib/cmake/fftw3/*.cmake
%{_libdir}/mpich/lib/pkgconfig/fftw3*.pc
%{_libdir}/mpich/lib/libfftw3*.so
@ -549,6 +532,8 @@ fi
%files openmpi-devel
%doc doc/FAQ/fftw-faq.html/
%{_includedir}/openmpi-%{_arch}
%dir %{_libdir}/openmpi/lib/cmake/fftw3/
%{_libdir}/openmpi/lib/cmake/fftw3/*.cmake
%{_libdir}/openmpi/lib/pkgconfig/fftw3*.pc
%{_libdir}/openmpi/lib/libfftw3*.so
@ -557,6 +542,102 @@ fi
%endif
%changelog
* Mon Nov 25 2024 Pavel Simovec <psimovec@redhat.com> - 3.3.10-15
- Enable openmpi for RHEL
- Resolves: RHEL-65277
* Mon Nov 18 2024 Pavel Simovec <psimovec@redhat.com> - 3.3.10-14
- Re-enable openmpi for s390x
- Resolves: RHEL-65277
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 3.3.10-13
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 3.3.10-12
- Bump release for June 2024 mass rebuild
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.10-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.10-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
- Fix i686 build by disabling openmpi
- Fix "The file FFTW3LibraryDepends.cmake is missing" in autotools build
https://github.com/FFTW/fftw3/issues/130#issuecomment-1902748460 (#2193075)
- Disable mpich on s390x to fix the build
* Thu Jul 27 2023 Lukáš Zaoral <lzaoral@redhat.com> - 3.3.10-9
- migrate to SPDX license format
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.10-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Tue Mar 28 2023 David Cantrell <dcantrell@redhat.com> - 3.3.10-7
- Rebuild
* Mon Mar 27 2023 Trent Piepho <tpiepho@gmail.com> - 3.3.10-6
- Enable AVX2 on x86-86
- Enable NEON on aarch64
- Clean up precision list
- Fix for OpenMPI build with < 4 processors
- Fix building with no enabled MPI types
- Enable single precision Altivec on PPC
- Enable CNTVCT_EL0 support on ARMv8
* Thu Mar 02 2023 Orion Poplawski <orion@nwra.com> - 3.3.10-5
- Use make macros
- Drop openmpi vader workaround
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.10-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Dec 20 2021 David Cantrell <dcantrell@redhat.com> - 3.3.10-1
- Upgrade to fftw-3.3.10
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.8-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.8-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.8-9
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.8-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.8-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.8-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Mar 7 2019 Tim Landscheidt <tim@tim-landscheidt.de> - 3.3.8-5
- Remove obsolete requirements for %%post/%%preun scriptlets
* Thu Feb 14 2019 Orion Poplawski <orion@nwra.com> - 3.3.8-4
- Rebuild for openmpi 3.1.3
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Jun 11 2018 Conrad Meyer <cemeyer@uw.edu> - 3.3.8-1
- Update to latest upstream, 3.3.8 (rhbz# 1413425)
- Add missing BuildRequires on environment-modules, used in 43b91c1c ("Build
mpich and openmpi versions") without explicit BR dependency
- Add new cmake files to %%files
* Wed Apr 18 2018 Merlin Mathesius <mmathesi@redhat.com> - 3.3.5-11
- Regenerate autoconf files using current tools so proper build flags
from redhat-rpm-config are used. This resolves BZ#1548473.

13
fix_autotools_build.patch Normal file
View File

@ -0,0 +1,13 @@
diff --git a/FFTW3Config.cmake.in b/FFTW3Config.cmake.in
index 6b1fbc2..e8a2ed8 100644
--- a/FFTW3Config.cmake.in
+++ b/FFTW3Config.cmake.in
@@ -10,8 +10,6 @@ set (FFTW3@PREC_SUFFIX@_LIBRARIES fftw3@PREC_SUFFIX@)
set (FFTW3@PREC_SUFFIX@_LIBRARY_DIRS @CMAKE_INSTALL_FULL_LIBDIR@)
set (FFTW3@PREC_SUFFIX@_INCLUDE_DIRS @CMAKE_INSTALL_FULL_INCLUDEDIR@)
-include ("${CMAKE_CURRENT_LIST_DIR}/FFTW3LibraryDepends.cmake")
-
if (CMAKE_VERSION VERSION_LESS 2.8.3)
set (CMAKE_CURRENT_LIST_DIR)
endif ()

View File

@ -1,6 +1,7 @@
--- !Policy
product_versions:
- rhel-8
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

7
gating/main.fmf Normal file
View File

@ -0,0 +1,7 @@
summary: Test basic FFTW functionality
test: ./test.sh
framework: shell
require:
- gcc
- fftw3-devel

99
gating/test.sh Executable file
View File

@ -0,0 +1,99 @@
#!/bin/sh -eux
# Create the test program source file
cat << 'EOF' > fftw_test.c
#include <stdio.h>
#include <math.h>
#include <fftw3.h>
int main() {
int N = 4;
fftw_complex in[N], out[N], back[N];
fftw_plan forward_plan, backward_plan;
// Initialize input array with known values
for (int i = 0; i < N; i++) {
in[i][0] = (double)(i + 1); // Real part: 1.0, 2.0, 3.0, 4.0
in[i][1] = 0.0; // Imaginary part: 0.0
}
forward_plan = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE);
backward_plan = fftw_plan_dft_1d(N, out, back, FFTW_BACKWARD, FFTW_ESTIMATE);
fftw_execute(forward_plan);
printf("Forward FFT Output (Frequency Domain):\n");
for (int i = 0; i < N; i++) {
printf("Index %d: %f + %fi\n", i, out[i][0], out[i][1]);
}
fftw_execute(backward_plan);
// Normalize the output of the inverse FFT
for (int i = 0; i < N; i++) {
back[i][0] /= N;
back[i][1] /= N;
}
printf("\nOriginal Input vs. Recovered Data:\n");
for (int i = 0; i < N; i++) {
printf("Index %d:\n", i);
printf(" Original: %f + %fi\n", in[i][0], in[i][1]);
printf(" Recovered: %f + %fi\n", back[i][0], back[i][1]);
}
fftw_destroy_plan(forward_plan);
fftw_destroy_plan(backward_plan);
return 0;
}
EOF
# Compile the test program
gcc -o fftw_test fftw_test.c -lfftw3 -lm
# Run the test program and capture its output
OUTPUT=$(./fftw_test)
# Expected output patterns (using grep-compatible regular expressions)
EXPECTED_PATTERNS=(
"Forward FFT Output \(Frequency Domain\):"
"Index 0: 10\.000000 \+ 0\.000000i"
"Index 1: -2\.000000 \+ 2\.000000i"
"Index 2: -2\.000000 \+ 0\.000000i"
"Index 3: -2\.000000 \+ -2\.000000i"
"Original Input vs\. Recovered Data:"
"Index 0:"
" Original: 1\.000000 \+ 0\.000000i"
" Recovered: 1\.000000 \+ 0\.000000i"
"Index 1:"
" Original: 2\.000000 \+ 0\.000000i"
" Recovered: 2\.000000 \+ 0\.000000i"
"Index 2:"
" Original: 3\.000000 \+ 0\.000000i"
" Recovered: 3\.000000 \+ 0\.000000i"
"Index 3:"
" Original: 4\.000000 \+ 0\.000000i"
" Recovered: 4\.000000 \+ 0\.000000i"
)
# Verify the output
ALL_MATCH=1
for PATTERN in "${EXPECTED_PATTERNS[@]}"; do
if ! echo "$OUTPUT" | grep -qE "$PATTERN"; then
echo "Pattern not found: $PATTERN"
ALL_MATCH=0
fi
done
if [ $ALL_MATCH -eq 1 ]; then
echo "FFTW test passed."
exit 0
else
echo "FFTW test failed."
echo "Program output:"
echo "$OUTPUT"
exit 1
fi

4
plans/main.fmf Normal file
View File

@ -0,0 +1,4 @@
discover:
how: fmf
execute:
how: tmt

View File

@ -1 +1 @@
SHA512 (fftw-3.3.5.tar.gz) = a81f02d884cfe4171fab479b0e5ec76eceb9c5da6d4eda1f89281b7e1efa2d8176c9ba87051595c402889eb32172d216ce40eb2bef41289c646f01002fb4ba8e
SHA512 (fftw-3.3.10.tar.gz) = 2d34b5ccac7b08740dbdacc6ebe451d8a34cf9d9bfec85a5e776e87adf94abfd803c222412d8e10fbaa4ed46f504aa87180396af1b108666cde4314a55610b40