Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add patch to make SIMD instructions optional at runtime on Windows #93

Merged
merged 3 commits into from
Apr 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .azure-pipelines/azure-pipelines-win.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .ci_support/linux_64_mpimpich.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
c_compiler:
- gcc
c_compiler_version:
- '10'
- '11'
cdt_name:
- cos6
channel_sources:
Expand All @@ -11,13 +11,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
- '11'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
- '11'
mpi:
- mpich
mpich:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/linux_64_mpinompi.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
c_compiler:
- gcc
c_compiler_version:
- '10'
- '11'
cdt_name:
- cos6
channel_sources:
Expand All @@ -11,13 +11,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
- '11'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
- '11'
mpi:
- nompi
mpich:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/linux_64_mpiopenmpi.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
c_compiler:
- gcc
c_compiler_version:
- '10'
- '11'
cdt_name:
- cos6
channel_sources:
Expand All @@ -11,13 +11,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
- '11'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
- '11'
mpi:
- openmpi
mpich:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/linux_aarch64_mpimpich.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ BUILD:
c_compiler:
- gcc
c_compiler_version:
- '10'
- '11'
cdt_arch:
- aarch64
cdt_name:
Expand All @@ -15,13 +15,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
- '11'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
- '11'
mpi:
- mpich
mpich:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/linux_aarch64_mpinompi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ BUILD:
c_compiler:
- gcc
c_compiler_version:
- '10'
- '11'
cdt_arch:
- aarch64
cdt_name:
Expand All @@ -15,13 +15,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
- '11'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
- '11'
mpi:
- nompi
mpich:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/linux_aarch64_mpiopenmpi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ BUILD:
c_compiler:
- gcc
c_compiler_version:
- '10'
- '11'
cdt_arch:
- aarch64
cdt_name:
Expand All @@ -15,13 +15,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
- '11'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
- '11'
mpi:
- openmpi
mpich:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/linux_ppc64le_mpimpich.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
c_compiler:
- gcc
c_compiler_version:
- '10'
- '11'
cdt_name:
- cos7
channel_sources:
Expand All @@ -11,13 +11,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
- '11'
docker_image:
- quay.io/condaforge/linux-anvil-ppc64le
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
- '11'
mpi:
- mpich
mpich:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/linux_ppc64le_mpinompi.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
c_compiler:
- gcc
c_compiler_version:
- '10'
- '11'
cdt_name:
- cos7
channel_sources:
Expand All @@ -11,13 +11,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
- '11'
docker_image:
- quay.io/condaforge/linux-anvil-ppc64le
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
- '11'
mpi:
- nompi
mpich:
Expand Down
6 changes: 3 additions & 3 deletions .ci_support/linux_ppc64le_mpiopenmpi.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
c_compiler:
- gcc
c_compiler_version:
- '10'
- '11'
cdt_name:
- cos7
channel_sources:
Expand All @@ -11,13 +11,13 @@ channel_targets:
cxx_compiler:
- gxx
cxx_compiler_version:
- '10'
- '11'
docker_image:
- quay.io/condaforge/linux-anvil-ppc64le
fortran_compiler:
- gfortran
fortran_compiler_version:
- '10'
- '11'
mpi:
- openmpi
mpich:
Expand Down
4 changes: 2 additions & 2 deletions .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .scripts/run_osx_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ryan Volz <[email protected]>
Date: Thu, 6 Apr 2023 13:06:45 -0400
Subject: [PATCH] cmake: Set SIMD flags on appropriate source files only.

Doing this matches the behavior of the configure script and makefiles.

Previously, enabling a set of SIMD instructions with the CMake build
would build the whole library with that flag enabled, allowing the
compiler to optimize by using that set of instructions anywhere. That
would then require that any SIMD instructions enabled at build time
would have to be present at run time. This change enables the intended
behavior of using SIMD instructions only when they are detected at run
time.
---
CMakeLists.txt | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6e46667..aaf618ee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -314,19 +314,29 @@ if (MSVC AND NOT (CMAKE_C_COMPILER_ID STREQUAL "Intel"))
target_compile_definitions (${fftw3_lib} PRIVATE /bigobj)
endif ()
if (HAVE_SSE)
- target_compile_options (${fftw3_lib} PRIVATE ${SSE_FLAG})
+ set_source_files_properties (${fftw_dft_simd_sse2_SOURCE}
+ ${fftw_rdft_simd_sse2_SOURCE}
+ PROPERTIES COMPILE_FLAGS "${SSE_FLAG}")
endif ()
if (HAVE_SSE2)
- target_compile_options (${fftw3_lib} PRIVATE ${SSE2_FLAG})
+ set_source_files_properties (${fftw_dft_simd_sse2_SOURCE}
+ ${fftw_rdft_simd_sse2_SOURCE}
+ PROPERTIES COMPILE_FLAGS "${SSE2_FLAG}")
endif ()
if (HAVE_AVX)
- target_compile_options (${fftw3_lib} PRIVATE ${AVX_FLAG})
+ set_source_files_properties (${fftw_dft_simd_avx_SOURCE}
+ ${fftw_rdft_simd_avx_SOURCE}
+ PROPERTIES COMPILE_FLAGS "${AVX_FLAG}")
endif ()
if (HAVE_AVX2)
- target_compile_options (${fftw3_lib} PRIVATE ${AVX2_FLAG})
+ set_source_files_properties (${fftw_dft_simd_avx2_SOURCE}
+ ${fftw_rdft_simd_avx2_SOURCE}
+ PROPERTIES COMPILE_FLAGS "${AVX2_FLAG}")
endif ()
if (HAVE_FMA)
- target_compile_options (${fftw3_lib} PRIVATE ${FMA_FLAG})
+ set_source_files_properties (${fftw_dft_simd_avx2_SOURCE}
+ ${fftw_rdft_simd_avx2_SOURCE}
+ PROPERTIES COMPILE_FLAGS "${FMA_FLAG}")
endif ()
if (HAVE_LIBM)
target_link_libraries (${fftw3_lib} m)
--
2.39.2

4 changes: 3 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set version = "3.3.10" %}
{% set build = 6 %}
{% set build = 7 %}


# ensure mpi is defined (needed for conda-smithy recipe-lint)
Expand Down Expand Up @@ -28,6 +28,8 @@ package:
source:
url: http://www.fftw.org/fftw-{{ version }}.tar.gz
sha256: 56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467
patches:
- 0001-cmake-Set-SIMD-flags-on-appropriate-source-files-onl.patch

build:
number: {{ build }}
Expand Down