diff --git a/recipes/heffte/49.patch b/recipes/heffte/49.patch new file mode 100644 index 0000000000000..228ab832f2138 --- /dev/null +++ b/recipes/heffte/49.patch @@ -0,0 +1,30 @@ +From e85d3df03ca8c226364df61e3dbeee6ccddd5fe1 Mon Sep 17 00:00:00 2001 +From: Axel Huebl +Date: Tue, 11 Jun 2024 17:15:37 -0700 +Subject: [PATCH] Fix AppleClang: Stock `aligned_alloc` + +Compiling heFFTe 2.4.0 with AppleClang 16.0.6 on macOS 13.4 raises: +``` +include/stock_fft/heffte_stock_allocator.h:43:46: error: use of undeclared identifier 'aligned_alloc' + return reinterpret_cast(aligned_alloc(alignof(F), n*sizeof(F))); + ^ +``` + +This adds the missing include and uses the C++ variant of the +function. +--- + include/stock_fft/heffte_stock_allocator.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/stock_fft/heffte_stock_allocator.h b/include/stock_fft/heffte_stock_allocator.h +index d8d69df..6123513 100644 +--- a/include/stock_fft/heffte_stock_allocator.h ++++ b/include/stock_fft/heffte_stock_allocator.h +@@ -2,6 +2,7 @@ + #define HEFFTE_STOCK_ALLOCATOR_H + + #include ++#include + #include + + #include "heffte_stock_complex.h" diff --git a/recipes/heffte/bld.bat b/recipes/heffte/bld.bat new file mode 100755 index 0000000000000..6479e46da819f --- /dev/null +++ b/recipes/heffte/bld.bat @@ -0,0 +1,37 @@ +@echo on + +:: configure +cmake ^ + -S %SRC_DIR% -B build ^ + %CMAKE_ARGS% ^ + -G "Ninja" ^ + -DBUILD_SHARED_LIBS=ON ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_C_COMPILER=clang-cl ^ + -DCMAKE_CXX_COMPILER=clang-cl ^ + -DCMAKE_INSTALL_LIBDIR=lib ^ + -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ + -DCMAKE_LINKER=lld-link ^ + -DCMAKE_NM=llvm-nm ^ + -DCMAKE_VERBOSE_MAKEFILE=ON ^ + -DHeffte_DISABLE_GPU_AWARE_MPI=ON ^ + -DHeffte_ENABLE_AVX=ON ^ + -DHeffte_ENABLE_AVX512=OFF ^ + -DHeffte_ENABLE_FFTW=ON ^ + -DHeffte_ENABLE_CUDA=OFF ^ + -DHeffte_ENABLE_ROCM=OFF ^ + -DHeffte_ENABLE_ONEAPI=OFF ^ + -DHeffte_ENABLE_MKL=OFF ^ + -DHeffte_ENABLE_DOXYGEN=OFF ^ + -DHeffte_SEQUENTIAL_TESTING=ON ^ + -DHeffte_ENABLE_TESTING=ON ^ + -DHeffte_ENABLE_TRACING=OFF ^ + -DHeffte_ENABLE_PYTHON=OFF ^ + -DHeffte_ENABLE_FORTRAN=OFF ^ + -DHeffte_ENABLE_SWIG=OFF ^ + -DHeffte_ENABLE_MAGMA=OFF +if errorlevel 1 exit 1 + +:: build, pack & install +cmake --build build --config Release --parallel %CPU_COUNT% --target install +if errorlevel 1 exit 1 diff --git a/recipes/heffte/build.sh b/recipes/heffte/build.sh new file mode 100755 index 0000000000000..ba81650cfbdae --- /dev/null +++ b/recipes/heffte/build.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# avoid side-injection of -std=c++14 flag in some toolchains +if [[ ${CXXFLAGS} == *"-std=c++14"* ]]; then + echo "14 -> 17" + export CXXFLAGS="${CXXFLAGS} -std=c++17" +fi +# Darwin modern C++ +# https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk +if [[ ${target_platform} =~ osx.* ]]; then + export CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY" +fi + +# configure +cmake \ + -S ${SRC_DIR} -B build \ + ${CMAKE_ARGS} \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_INSTALL_PREFIX=${PREFIX} \ + -DHeffte_DISABLE_GPU_AWARE_MPI=ON \ + -DHeffte_ENABLE_AVX=ON \ + -DHeffte_ENABLE_AVX512=OFF \ + -DHeffte_ENABLE_FFTW=ON \ + -DHeffte_ENABLE_CUDA=OFF \ + -DHeffte_ENABLE_ROCM=OFF \ + -DHeffte_ENABLE_ONEAPI=OFF \ + -DHeffte_ENABLE_MKL=OFF \ + -DHeffte_ENABLE_DOXYGEN=OFF \ + -DHeffte_SEQUENTIAL_TESTING=ON \ + -DHeffte_ENABLE_TESTING=ON \ + -DHeffte_ENABLE_TRACING=OFF \ + -DHeffte_ENABLE_PYTHON=OFF \ + -DHeffte_ENABLE_FORTRAN=OFF \ + -DHeffte_ENABLE_SWIG=OFF \ + -DHeffte_ENABLE_MAGMA=OFF + +# build, pack & install +cmake --build build --parallel ${CPU_COUNT} --target install diff --git a/recipes/heffte/conda_build_config.yaml b/recipes/heffte/conda_build_config.yaml new file mode 100644 index 0000000000000..37625f94e63c9 --- /dev/null +++ b/recipes/heffte/conda_build_config.yaml @@ -0,0 +1,8 @@ +mpi: + - mpich # [unix] + - openmpi # [unix] +# macOS aligned_alloc support +# https://github.com/icl-utk-edu/heffte/pull/49 +# https://stackoverflow.com/questions/44841574/aligned-alloc-not-found-for-clang/76984907#76984907 +MACOSX_SDK_VERSION: # [osx and x86_64] + - "10.15" # [osx and x86_64] diff --git a/recipes/heffte/meta.yaml b/recipes/heffte/meta.yaml new file mode 100644 index 0000000000000..0faa1be12dec3 --- /dev/null +++ b/recipes/heffte/meta.yaml @@ -0,0 +1,75 @@ +{% set name = "heFFTe" %} +{% set version = "2.4.0" %} +{% set build = 0 %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + url: https://github.com/icl-utk-edu/heffte/archive/refs/tags/v{{ version }}.tar.gz + sha256: 02310fb4f9688df02f7181667e61c3adb7e38baf79611d80919d47452ff7881d + patches: + # macOS build error in aligned_alloc + # https://github.com/icl-utk-edu/heffte/pull/49 + - 49.patch + +build: + number: {{ build }} + + # heFFTe depends on MPI, but we do not yet build a Windows-MPI that we trust + skip: true # [win] + + # add build string so packages can depend on specific mpi variants + # dependencies: + # `pkg * mpi_mpich_*` for MPICH + # `pkg * mpi_openmpi_*` for OpenMPI + # `pkg * mpi_*` for any mpi + {% set mpi_prefix = "mpi_" + mpi %} + string: {{ mpi_prefix }}_h{{ PKG_HASH }}_{{ build }} + +requirements: + build: + - {{ compiler("c") }} + - {{ compiler("cxx") }} + - {{ stdlib("c") }} + - cmake + - make # [unix] + - pkgconfig + host: + - fftw * mpi_{{ mpi }}_* + - {{ mpi }} + run: + - fftw * mpi_{{ mpi }}_* + - {{ mpi }} + +test: + requires: + - {{ compiler("c") }} + - {{ compiler("cxx") }} + - {{ stdlib("c") }} + - cmake + - make # [unix] + - pkgconfig + +about: + home: https://icl.utk.edu/publications/fft-ecp-fast-fourier-transform + license: BSD-3-Clause + license_family: BSD + license_file: LICENSE + summary: Distributed fast-Fourier transforms in on a heterogeneous systems. + + description: | + The Highly Efficient FFT for Exascale (heFFTe) library is being developed + as part of the Exascale Computing Project (ECP), which is a joint project + of the U.S. Department of Energy's Office of Science and National Nuclear + Security Administration (NNSA). HeFFTe delivers algorithms for distributed + fast-Fourier transforms in on a heterogeneous systems, targeting the + upcoming exascale machines. + + doc_url: https://icl-utk-edu.github.io/heffte/ + dev_url: https://github.com/icl-utk-edu/heffte + +extra: + recipe-maintainers: + - ax3l diff --git a/recipes/heffte/run_test.bat b/recipes/heffte/run_test.bat new file mode 100755 index 0000000000000..bda803fd06e44 --- /dev/null +++ b/recipes/heffte/run_test.bat @@ -0,0 +1,16 @@ +@echo on + +set "OMP_NUM_THREADS=2" + +cmake ^ + -S %PREFIX%\share\heffte\testing ^ + -B build_test ^ + -DBUILD_SHARED_LIBS=ON ^ + -DCMAKE_VERBOSE_MAKEFILE=ON +if errorlevel 1 exit 1 + +cmake --build build_test +if errorlevel 1 exit 1 + +cmake --build build_test --target test +if errorlevel 1 exit 1 diff --git a/recipes/heffte/run_test.sh b/recipes/heffte/run_test.sh new file mode 100755 index 0000000000000..1cd68d9fd4200 --- /dev/null +++ b/recipes/heffte/run_test.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -eu -x -o pipefail + +export OMP_NUM_THREADS=2 + +cmake \ + -S ${PREFIX}/share/heffte/testing \ + -B build_test \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_VERBOSE_MAKEFILE=ON + +cmake --build build_test +cmake --build build_test --target test