Skip to content

Commit

Permalink
Split FFTW3 into double and float versions for ROOT and O2
Browse files Browse the repository at this point in the history
ROOT requires libfftw3, but O2 requires libfftw3f.

Also, make sure that ROOT actually finds libfftw3 and doesn't just disable the
feature we request.
  • Loading branch information
TimoWilken committed Feb 21, 2024
1 parent 4511cfa commit 5c57e90
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 35 deletions.
37 changes: 4 additions & 33 deletions fftw3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,9 @@ build_requires:
- "GCC-Toolchain:(?!osx)"
---
#!/bin/bash -e
export FFTW3_WITH_AVX # use AVX with float or double. Unset automatically for long double and quad

if [[ $FFTW3_DOUBLE == "ON" ]]; then # ensure only one option is set and AVX is disabled if necessary
FFTW3_FLOAT="OFF"
FFTW3_LONG_DOUBLE="OFF"
elif [[ $FFTW3_LONG_DOUBLE == "ON" ]]; then
unset FFTW3_WITH_AVX
FFTW3_FLOAT="OFF"
FFTW3_DOUBLE="OFF"
else # keep FLOAT default option as it was
FFTW3_FLOAT="ON"
FFTW3_DOUBLE="OFF"
FFTW3_LONG_DOUBLE="OFF"
fi

case $ARCHITECTURE in
osx_arm64)
cmake $SOURCEDIR \
-DCMAKE_INSTALL_PREFIX:PATH="${INSTALLROOT}" \
-DCMAKE_INSTALL_LIBDIR:PATH="lib" \
-DENABLE_LONG_DOUBLE=${FFTW3_LONG_DOUBLE-OFF} \
-DENABLE_FLOAT=${FFTW3_FLOAT-OFF}
;;
*)
cmake $SOURCEDIR \
-DCMAKE_INSTALL_PREFIX:PATH="${INSTALLROOT}" \
-DCMAKE_INSTALL_LIBDIR:PATH="lib" \
-DENABLE_LONG_DOUBLE=${FFTW3_LONG_DOUBLE-OFF} \
-DENABLE_FLOAT=${FFTW3_FLOAT-OFF} \
${FFTW3_WITH_AVX:+-DENABLE_AVX=ON}
;;
esac
cmake "$SOURCEDIR" \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALLROOT" \
-DCMAKE_INSTALL_LIBDIR:PATH=lib

make ${JOBS+-j $JOBS}
make install
Expand All @@ -49,4 +20,4 @@ make install
MODULEDIR="$INSTALLROOT/etc/modulefiles"
MODULEFILE="$MODULEDIR/$PKGNAME"
mkdir -p "$MODULEDIR"
alibuild-generate-module --bin --lib > $MODULEFILE
alibuild-generate-module --bin --lib > "$MODULEFILE"
24 changes: 24 additions & 0 deletions fftw3f.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package: FFTW3F
version: "%(tag_basename)s"
tag: v3.3.9
source: https://github.com/alisw/fftw3
prefer_system: (?!slc5.*)
build_requires:
- alibuild-recipe-tools
- CMake
- "GCC-Toolchain:(?!osx)"
---
#!/bin/bash -e
cmake "$SOURCEDIR" \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALLROOT" \
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
-DENABLE_FLOAT=ON

make ${JOBS+-j $JOBS}
make install

#Modulefile
MODULEDIR="$INSTALLROOT/etc/modulefiles"
MODULEFILE="$MODULEDIR/$PKGNAME"
mkdir -p "$MODULEDIR"
alibuild-generate-module --bin --lib > "$MODULEFILE"
4 changes: 2 additions & 2 deletions o2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ requires:
- libjalienO2
- cgal
- VecGeom
- FFTW3
- FFTW3F
- ONNXRuntime
- MLModels
- KFParticle
Expand Down Expand Up @@ -256,7 +256,7 @@ module load BASE/1.0 \\
${LIBJALIENO2_REVISION:+libjalienO2/$LIBJALIENO2_VERSION-$LIBJALIENO2_REVISION} \\
${CURL_REVISION:+curl/$CURL_VERSION-$CURL_REVISION} \\
${FAIRMQ_REVISION:+FairMQ/$FAIRMQ_VERSION-$FAIRMQ_REVISION} \\
${FFTW3_REVISION:+FFTW3/$FFTW3_VERSION-$FFTW3_REVISION} \\
${FFTW3F_REVISION:+FFTW3F/$FFTW3F_VERSION-$FFTW3F_REVISION} \\
${ONNXRUNTIME_REVISION:+ONNXRuntime/$ONNXRUNTIME_VERSION-$ONNXRUNTIME_REVISION} \\
${RAPIDJSON_REVISION:+RapidJSON/$RAPIDJSON_VERSION-$RAPIDJSON_REVISION} \\
${MLMODELS_REVISION:+MLModels/$MLMODELS_VERSION-$MLMODELS_REVISION}
Expand Down
4 changes: 4 additions & 0 deletions root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ cmake $SOURCEDIR

cmake --build . --target install ${JOBS+-j $JOBS}

# Make sure ROOT actually found its build dependencies and didn't disable
# features we requested. "-Dfail-on-missing=ON" would probably be better.
[ "$("$INSTALLROOT/bin/root-config" --has-fftw3)" = yes ]

# Add support for ROOT_PLUGIN_PATH envvar for specifying additional plugin search paths
grep -v '^Unix.*.Root.PluginPath' $INSTALLROOT/etc/system.rootrc > system.rootrc.0
cat >> system.rootrc.0 <<\EOF
Expand Down

0 comments on commit 5c57e90

Please sign in to comment.