From 5c57e904ba995aa9aae0d0ec7914a6b18215458e Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Wed, 21 Feb 2024 17:50:42 +0100 Subject: [PATCH] Split FFTW3 into double and float versions for ROOT and O2 ROOT requires libfftw3, but O2 requires libfftw3f. Also, make sure that ROOT actually finds libfftw3 and doesn't just disable the feature we request. --- fftw3.sh | 37 ++++--------------------------------- fftw3f.sh | 24 ++++++++++++++++++++++++ o2.sh | 4 ++-- root.sh | 4 ++++ 4 files changed, 34 insertions(+), 35 deletions(-) create mode 100644 fftw3f.sh diff --git a/fftw3.sh b/fftw3.sh index 2efe3b7297..7ba0f9ddb7 100644 --- a/fftw3.sh +++ b/fftw3.sh @@ -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 @@ -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" diff --git a/fftw3f.sh b/fftw3f.sh new file mode 100644 index 0000000000..0ac1fc8355 --- /dev/null +++ b/fftw3f.sh @@ -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" diff --git a/o2.sh b/o2.sh index ae8a70015e..f879febc42 100644 --- a/o2.sh +++ b/o2.sh @@ -23,7 +23,7 @@ requires: - libjalienO2 - cgal - VecGeom - - FFTW3 + - FFTW3F - ONNXRuntime - MLModels - KFParticle @@ -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} diff --git a/root.sh b/root.sh index 7a7c7b44c5..3d8e9f5376 100644 --- a/root.sh +++ b/root.sh @@ -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