libCEED
libCEED copied to clipboard
Build failure with spack on MacOS w/ gcc@14
Getting Spack configured
https://github.com/libxsmm/libxsmm/issues/921 - this issue is somewhat related, as initially I was trying to get builds to go through of libceed+libxsmm. Unfortunately apple-clang is tricky, and I couldn't immediately understand what the appropriate fix was for that issue.
Firstly, there are some preliminary issues with the spec of libceed+libxsmm on MacOS. This is a spack bug, and perhaps we could file a spack issue to better capture this.
spack debug report:
* **Spack:** 1.0.0.dev0 (0bec90ecd75f686b89f114c0c711f17c3cbd0041)
* **Python:** 3.9.6
* **Platform:** darwin-sequoia-m1
This is a bug within spack itself, but I wanted to note it as otherwise one cannot reproduce this issue.
$ spack spec libceed+libxsmm
==> Error: Spack concretizer internal error. Please submit a bug report and include the command, environment if applicable and the following error message.
libceed+libxsmm is unsatisfiable
In order to get the spec to go through (in an environment spack.yaml or otherwise):
> spack spec libceed+libxsmm libxsmm
- [email protected]~cuda~debug+libxsmm~magma~occa~rocm build_system=makefile arch=darwin-sequoia-m1
[e] ^[email protected] build_system=bundle arch=darwin-sequoia-m1
[+] ^[email protected] build_system=generic arch=darwin-sequoia-m1
[e] ^[email protected]~binutils+bootstrap~graphite~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' patches:=838cf07 arch=darwin-sequoia-m1
[+] ^[email protected] build_system=generic arch=darwin-sequoia-m1
- ^[email protected]~guile build_system=generic arch=darwin-sequoia-m1
[+] libxsmm@main~debug~generator~header-only~large_jit_buffer~shared blas=0 build_system=makefile arch=darwin-sequoia-m1
[e] ^[email protected]~binutils+bootstrap~graphite~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' patches:=838cf07 arch=darwin-sequoia-m1
[+] ^[email protected] build_system=generic arch=darwin-sequoia-m1
[e] ^[email protected]~guile build_system=generic patches:=ca60bd9 arch=darwin-sequoia-m1
[e] ^[email protected]+bz2+ctypes+dbm~debug+libxml2+lzma~optimizations+pic+pyexpat~pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic arch=darwin-sequoia-m1
Then, using spack@develop, in order to get the concretization that I want using gcc...
> spack spec libceed+libxsmm %[virtuals=c,cxx,fortran] gcc libxsmm
- [email protected]~cuda~debug+libxsmm~magma~occa~rocm build_system=makefile arch=darwin-sequoia-m1
[+] ^[email protected] build_system=generic arch=darwin-sequoia-m1
[e] ^[email protected]~binutils+bootstrap~graphite~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' patches:=838cf07 arch=darwin-sequoia-m1
[+] ^[email protected] build_system=generic arch=darwin-sequoia-m1
- ^[email protected]~guile build_system=generic arch=darwin-sequoia-m1
[+] libxsmm@main~debug~generator~header-only~large_jit_buffer~shared blas=0 build_system=makefile arch=darwin-sequoia-m1
[e] ^[email protected]~binutils+bootstrap~graphite~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' patches:=838cf07 arch=darwin-sequoia-m1
[+] ^[email protected] build_system=generic arch=darwin-sequoia-m1
[e] ^[email protected]~guile build_system=generic patches:=ca60bd9 arch=darwin-sequoia-m1
[e] ^[email protected]+bz2+ctypes+dbm~debug+libxml2+lzma~optimizations+pic+pyexpat~pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic arch=darwin-sequoia-m1
libCEED build issue
Now that we have spack configured to use the spec we want, now we can build libceed. Unfortunately that isn't so easy:
==> libceed: Executing phase: 'edit'
==> [2025-04-22-11:00:22.159997] '/usr/bin/make' '-j12' 'info' 'V=1' 'OPT=-O3 -g -ffp-contract=fast -fopenmp-simd -march=native' 'CUDA_DIR=/disable-cuda' 'XSMM_DIR=/Users/rcamruzz/projects/spack/opt/spack/darwin-armv8.4a/libxsmm-main-fqbqukvdaxvuwdyxl3bguiddcr4vvhvw'
-----------------------------------------
| ___ __ ______________________ |
| / (_) /_ / ____/ ____/ ____/ __ \ |
| / / / __ \/ / / __/ / __/ / / / / |
| / / / /_/ / /___/ /___/ /___/ /_/ / |
| /_/_/_.___/\____/_____/_____/_____/ |
-----------------------------------------
-----------------------------------------
Built-in Backends:
/cpu/self/ref/serial /cpu/self/ref/blocked /cpu/self/opt/serial /cpu/self/opt/blocked
Additional Backends:
/cpu/self/xsmm/serial /cpu/self/xsmm/blocked
-----------------------------------------
Compiler Flags:
CC = /Users/rcamruzz/projects/spack/opt/spack/darwin-armv8.4a/compiler-wrapper-1.0-4eeaioueab55op7u7htnx2rtr5qt6hq7/libexec/spack/gcc/gcc
CXX = /Users/rcamruzz/projects/spack/opt/spack/darwin-armv8.4a/compiler-wrapper-1.0-4eeaioueab55op7u7htnx2rtr5qt6hq7/libexec/spack/gcc/g++
FC = /Users/rcamruzz/projects/spack/opt/spack/darwin-armv8.4a/compiler-wrapper-1.0-4eeaioueab55op7u7htnx2rtr5qt6hq7/libexec/spack/gcc/gfortran
CPPFLAGS = -I./include
CFLAGS = -O3 -g -ffp-contract=fast -fopenmp-simd -march=native -fPIC -std=c99 -Wall -Wextra -Wno-unused-parameter -MMD -MP
CXXFLAGS = -O3 -g -ffp-contract=fast -fopenmp-simd -march=native -fPIC -std=c++11 -Wall -Wextra -Wno-unused-parameter -MMD -MP
FFLAGS = -O3 -g -ffp-contract=fast -fopenmp-simd -march=native -fPIC -cpp -Wall -Wextra -Wno-unused-parameter -Wno-unused-dummy-argument -MMD -MP
NVCCFLAGS = -ccbin /Users/rcamruzz/projects/spack/opt/spack/darwin-armv8.4a/compiler-wrapper-1.0-4eeaioueab55op7u7htnx2rtr5qt6hq7/libexec/spack/gcc/g++ -Xcompiler '-O3 -g -ffp-contract=fast -fopenmp-simd -march=native' -Xcompiler -fPIC
HIPCCFLAGS = -O3 -g -ffp-contract=fast -march=native -fPIC -munsafe-fp-atomics
SYCLFLAGS = -fPIC -std=c++17 -O3 -g -ffp-contract=fast -fopenmp-simd -march=native -fPIC -Wall -Wextra -Wno-unused-parameter -MMD -MP -O3 -g -ffp-contract=fast -march=native
CEED_LDFLAGS =
CEED_LDLIBS = -lm
AR = ar
ARFLAGS = crD
OPT = -O3 -g -ffp-contract=fast -fopenmp-simd -march=native
AFLAGS = -fsanitize=address
ASAN = (empty)
VERBOSE = 1 [verbose=on]
-----------------------------------------
Backend Dependencies:
MEMCHK_STATUS = Disabled [not found]
AVX_STATUS = Disabled [not found]
XSMM_DIR = /Users/rcamruzz/projects/spack/opt/spack/darwin-armv8.4a/libxsmm-main-fqbqukvdaxvuwdyxl3bguiddcr4vvhvw [backends: /cpu/self/xsmm/serial /cpu/self/xsmm/blocked]
CUDA_DIR = /disable-cuda [not found]
ROCM_DIR = [not found]
SYCL_DIR = [not found]
MAGMA_DIR = ../magma [not found]
OCCA_DIR = ../occa/install [not found]
-----------------------------------------
Example Dependencies:
MFEM_DIR =
NEK5K_DIR =
PETSC_DIR =
DEAL_II_DIR =
-----------------------------------------
Install Options:
prefix = /usr/local
includedir = $(prefix)/include
libdir = $(prefix)/lib
pkgconfigdir = $(libdir)/pkgconfig
-----------------------------------------
Git:
describe = 85bbdf9
-----------------------------------------
==> libceed: Executing phase: 'build'
==> [2025-04-22-11:00:22.782917] '/usr/bin/make' '-j12' 'V=1' 'OPT=-O3 -g -ffp-contract=fast -fopenmp-simd -march=native' 'CUDA_DIR=/disable-cuda' 'XSMM_DIR=/Users/rcamruzz/projects/spack/opt/spack/darwin-armv8.4a/libxsmm-main-fqbqukvdaxvuwdyxl3bguiddcr4vvhvw'
make: 'lib' with optional backends: /cpu/self/xsmm/serial /cpu/self/xsmm/blocked
/Users/rcamruzz/projects/spack/opt/spack/darwin-armv8.4a/compiler-wrapper-1.0-4eeaioueab55op7u7htnx2rtr5qt6hq7/libexec/spack/gcc/gcc -I./include -O3 -g -ffp-contract=fast -fopenmp-simd -march=native -fPIC -std=c99 -Wall -Wextra -Wno-unused-parameter -MMD -MP -c -o build/interface/ceed-basis.o /private/var/folders/v1/8y9txrt57mg382s0p7vq06xr0000gq/T/rcamruzz/spack-stage/spack-stage-libceed-develop-vs7nw4okx2sudzowqzszcfgyxa3cg2nx/spack-src/interface/ceed-basis.c
cc1: error: unknown value 'apple-m3' for '-march'
cc1: note: valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a armv8.6-a armv8.7-a armv8.8-a armv8.9-a armv8-r armv9-a armv9.1-a armv9.2-a armv9.3-a armv9.4-a native
cc1: note: did you mean '-mcpu=apple-m3'?
make: *** [build/interface/ceed-basis.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** wait: No child processes. Stop.
Key error here is: cc1: error: unknown value 'apple-m3' for '-march'
Resolving the issue
This is where the speculation begins, and I would appreciate feedback / guidance. From what I understand, Spack injects the relevant flags that you are trying to control at the Spack level here. There is even a comment in your package.py that references this https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/libceed/package.py#L107
When investigating the build files after a failed build, I see many of the flags that you have manually set already configured (this analysis is just for my gcc MacOS build):
-g: spack's gcc compiler wrapper had some place where it injected a-gflag if debug mode was enabled from what I can tell. Is that something you really want to add again at thepackage.pylevel? I noticed that you even include that flag when debugging is disabled https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/libceed/package.py#L87, which seems concerning-O3: I couldn't immediately understand where the flag would be generated by spack, but I am convinced thatbuild_type=Releasewould configure-O3at the compiler-wrapper level.-ffp-contract=fastand-fopenmp-simd: I have to assume that these are necessary, and that this is something that should definitely be injected by your package. i.e. this isn't included by spack (maybe it is)-march=native: For some reason this is only conditionally set based on arch. In myspack-build-env-mods.txt, I can see thatSPACK_TARGET_ARGS_CC='-march=armv8.4-a -mtune=generic'for the C, CXX and Fortan variables. This suggests that both-march=nativeis wrong, and that Spack is handling this for you.
So, assuming that the issue is isolated to the final flag, what can we do to resolve this:
- Only set
-march=nativeconditionally for platforms that aren't MacOS. This would be a hotfix for this issue I ran into. - Never set
-march=nativefor any platform, as Spack should be taking care of this.
If I knew which would be more appropriate, I would have a PR open into the libCEED package. Please let me know how to proceed, and I will gladly submit a PR.
For the moment, I am going to patch the Makefile to get me unstuck on this line, changing from what it currently is to the following, and only applying the Patch for gcc on MacOS in the Palace package.py:
OPT = -ffp-contract=fast -fopenmp=simd
That way we can ignore the options passed from your package, keep the relevant ones, and let spack correctly add in the -march flag we need.
I think its unrelated to your issue but libCEED v12.0 and libXSMM main don't work together, I think
@jeremylt ah - sorry for the confusion. I was generating these spack specs after having issues with a bigger environment.
==> Concretized 3 specs:
- vs7nw4o libceed@develop~cuda~debug+libxsmm~magma~occa~rocm build_system=makefile arch=darwin-sequoia-armv8.4a
[+] 4eeaiou ^[email protected] build_system=generic arch=darwin-sequoia-armv8.4a
[e] jekfajq ^[email protected]~binutils+bootstrap~graphite~mold~nvptx~piclibs~profiled~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran' patches:=838cf07 arch=darwin-sequoia-armv8.4a
[+] ksyizs4 ^[email protected] build_system=generic arch=darwin-sequoia-armv8.4a
[e] ysvxlfb ^[email protected]~guile build_system=generic patches:=ca60bd9 arch=darwin-sequoia-armv8.4a
[+] fqbqukv libxsmm@main~debug~generator~header-only~large_jit_buffer~shared blas=0 build_system=makefile arch=darwin-sequoia-armv8.4a
[e] azflzuy ^[email protected]+bz2+ctypes+dbm~debug+libxml2+lzma~optimizations+pic+pyexpat~pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic arch=darwin-sequoia-armv8.4a
- ibbtw7o palace@develop~arpack~cuda+gslib~int64~ipo~magma~mumps~openmp~rocm+shared+slepc~strumpack+sundials+superlu-dist build_system=cmake build_type=Release dev_path=/Users/rcamruzz/projects/palace generator=make arch=darwin-sequoia-armv8.4a
[e] ehjd57c ^[email protected]~doc+ncurses+ownlibs~qtgui build_system=generic build_type=Release arch=darwin-sequoia-armv8.4a
[+] 6y7dfli ^[email protected]~ipo~nightly~rocm build_system=cmake build_type=RelWithDebInfo generator=make arch=darwin-sequoia-armv8.4a
[+] 5v2qfn2 ^[email protected]~ipo+pic~shared build_system=cmake build_type=Release cxxstd=11 generator=make arch=darwin-sequoia-armv8.4a
[+] ytrrr7s ^[email protected]~blas+mpi+mpiio+shared build_system=generic arch=darwin-sequoia-armv8.4a
[+] ixp34l7 ^[email protected]~caliper~complex~cuda~debug+fortran~gptune~gpu-aware-mpi~gpu-profiling~int64~internal-superlu+lapack~magma~mixedint+mpi~openmp~rocm+shared~superlu-dist~sycl~umpire~unified-memory build_system=autotools precision=double arch=darwin-sequoia-armv8.4a
[+] 6qpmhn2 ^gnuconfig@2024-07-27 build_system=generic arch=darwin-sequoia-armv8.4a
[e] d4ojczv ^[email protected]~bignuma~consistent_fpcsr+dynamic_dispatch+fortran~ilp64+locking+pic+shared build_system=makefile patches:=1a2401f symbol_suffix=none threads=none arch=darwin-sequoia-armv8.4a
[+] gumczje ^[email protected]~gdb~int64~ipo~no_warning~real64+shared build_system=cmake build_type=Release generator=make patches:=4991da9,93a7903,b1225da arch=darwin-sequoia-armv8.4a
- szi4rnk ^mfem@develop~amgx~conduit~cuda~debug~examples~exceptions~fms~ginkgo~gnutls+gslib~hiop~lapack~libceed~libunwind+metis~miniapps~mpfr+mpi~mumps~netcdf~occa~openmp~petsc~pumi~raja~rocm+shared~slepc+static~strumpack~suite-sparse+sundials+superlu-dist~threadsafe~umpire+zlib build_system=generic cxxstd=auto precision=double timer=auto arch=darwin-sequoia-armv8.4a
[+] 5hzyld3 ^[email protected]~ipo+multiple_headers build_system=cmake build_type=Release generator=make arch=darwin-sequoia-armv8.4a
[e] fqshv6s ^[email protected]+atomics~cuda~debug~gpfs~internal-hwloc~internal-libevent~internal-pmix~ipv6~java~lustre~memchecker~openshmem~romio+rsh~static~two_level_namespace+vt~wrapper-rpath build_system=autotools fabrics:=none romio-filesystem:=none schedulers:=none arch=darwin-sequoia-armv8.4a
- gh32mkw ^[email protected]~X~batch~cgns+complex~cuda~debug+double~exodusii~fftw+fortran~giflib~hdf5~hpddm~hwloc~hypre~int64~jpeg~knl~kokkos~libpng~libyaml~memkind+metis~mkl-pardiso~mmg~moab~mpfr+mpi~mumps~openmp~p4est~parmmg~ptscotch~random123~rocm~saws~scalapack+shared~strumpack~suite-sparse+superlu-dist~sycl~tetgen~trilinos~valgrind~zoltan build_system=generic clanguage=C memalign=none arch=darwin-sequoia-armv8.4a
[+] gj66hep ^[email protected] build_system=autotools arch=darwin-sequoia-armv8.4a
[+] ohxukfb ^[email protected] build_system=autotools libs:=shared,static arch=darwin-sequoia-armv8.4a
[+] gdrby3u ^[email protected]~gdb~int64~ipo+shared build_system=cmake build_type=Release generator=make patches:=4f89253,50ed208,704b84f arch=darwin-sequoia-armv8.4a
[e] 5sf76fs ^[email protected] build_system=autotools arch=darwin-sequoia-armv8.4a
- x7xu2ow ^[email protected]~arpack~blopex~cuda~hpddm~rocm build_system=generic arch=darwin-sequoia-armv8.4a
[+] tyhb6ah ^[email protected]+ARKODE+CVODE+CVODES+IDA+IDAS+KINSOL~cuda+examples+examples-install~f2003~fcmix~ginkgo+hypre~int64~ipo~klu~kokkos~kokkos-kernels~lapack~magma~monitoring+mpi~openmp~petsc~profiling~pthread~raja~rocm+shared+static~superlu-dist~superlu-mt~sycl~trilinos build_system=cmake build_type=Release cstd=99 cxxstd=14 generator=make logging-level=2 precision=double arch=darwin-sequoia-armv8.4a
- owxc55i ^[email protected]~cuda~int64~ipo~openmp+parmetis~rocm+shared build_system=cmake build_type=Release generator=make arch=darwin-sequoia-armv8.4a
[+] svf3fyj ^[email protected]+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-sequoia-armv8.4a
Here's the full concretization of that bigger environment. I am building with libceed@develop here and that's the version that generated the error I included.
Cool, just wanted to get ahead of a potential rabbithole
I filed spack issue https://github.com/spack/spack/issues/50167 to capture the stuff I presented at the beginning of the issue.
For CMake packages, you can override the compiler spec (and effectively discard the spack compiler wrapper) by specifying CMAKE_{C/CCX}_COMPILER.
Since libCEED package is controlling its own compiler flags, I wonder if this would resolve the issue longer term?
Would be slightly different since this is a Makefile package.
To clarify, I think there are three distinct options to resolve this issue:
- Don't use the Spack compiler wrapper at the
package.pylevel in libCEED, avoiding this issue, but perhaps having unintended consequences for other builds - Apply a patch to the Makefile for MacOS platforms that overrides the
-march=nativeextra flag thrown in that breaks gcc (example of this here) - Have a conditional block in the libCEED
package.pythat removes the-march=nativeextra flag when running with gcc on MacOS
I am inclined to think that 3 is the correct approach here.
@jeremylt what do you think? I will gladly submit a patch for whatever option is best.
Interestingly, in CI -march=native is in the options on our macos-15 + gcc job and its doing fine: https://github.com/CEED/libCEED/actions/runs/14669751903/job/41173315711
I'm not sure what is different there?
CC @jedbrown since you're the most knowledgeable about build system issues
The difference between your CI job working and the Spack build failing is the Spack compiler wrapper. The compiler wrapper injects it's own plethora of flags, and then your specification of OPT adds to that "flag soup".
It seems like GCC has a failure mode when spack passes -march=armv4.8a, and then you additionally specify -march=native. Perhaps some weird string expansion bug, or a core gcc bug...
@hughcars also was able to reproduce the bug, but noted that if you re-run the failing build with VERBOSE=1 make, after sourcing your Spack environment, the bug disappears? Very mysterious.
Are you saying gcc -march=armv8.4a -march=native is broken? If there is an issue in the wrapper, I'd think the wrapper should be fixed. If it's in GCC, we should report it upstream and work around it. In Spack's current philosophy, should packages ever insert their own -march=native? Does Spack want to manage all the optimization flags?
@jedbrown yes. Here is a simple reproducer of the issue (simplified to not use the Spack compiler wrapper, but reproduces the same issue):
Makefile:
# Compiler and flags
CC = gcc-14
CFLAGS = -march=armv8.4a -mcpu=native -march=native -O3 -g -fPIC -std=c99 -Wall -Wextra -Wno-unused-parameter -MMD -MP
# Source and executable files
SRC = test.c
EXE = myprogram
# Default target
all: $(EXE)
# Compile object file
$(EXE): $(SRC)
$(CC) $(CFLAGS) -o $(EXE) $(SRC)
# Clean object files and executable
clean:
rm -f $(EXE)
test.c:
#include <stdio.h>
int main() {
printf("Hello, world!\n");
return 0;
}
Output:
$ make
gcc-14 -march=armv8.4a -mcpu=native -march=native -O3 -g -fPIC -std=c99 -Wall -Wextra -Wno-unused-parameter -MMD -MP -o myprogram test.c
cc1: error: unknown value 'apple-m3' for '-march'
cc1: note: valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a armv8.5-a armv8.6-a armv8.7-a armv8.8-a armv8.9-a armv8-r armv9-a armv9.1-a armv9.2-a armv9.3-a armv9.4-a native
cc1: note: did you mean '-mcpu=apple-m3'?
make: *** [myprogram] Error 1
Note that I am adding both flags -march=armv8.4a -mcpu=native here in order to replicate the bugged flags the spack compiler wrapper is passing.
I think this suggests that this is a gcc bug that we should upstream a bug report for, and then work around locally.
I don't quite understand Spack's philosophy here, and it seems to also have to take into account a given package's philosophy? My intuition suggests that packages should only touch compiler flags if they aren't a CMake package, but I admit I am grasping at straws a little here.
In my mind, ideally spack inherits the burden of compiler flag specification for all packages, as that's the easiest approach. Then again, I can totally understand a package wanting to control things at a finer granularity.
I suppose one final option is to not have libCEED specify any compiler flags at the package.py level, but that's a touch more extreme of a suggestion.
EDIT: This would also mean manually setting say OPT= to some empty string to avoid the Makefile re-adding extra compiler flags.
OPT exists only as an easy way to twiddle at the command-line, and the default is not libCEED expressing an opinion about the proper way to build itself. We assume that higher-level systems like Spack will know whether they intend to make portable binaries or -march=native, whether they want debugging, etc. So I have no issue with setting OPT= or setting it to options that Spack has chosen (though perhaps you want the have the wrapper handle that).
Would a diff like this be what you are intending for the libCEED package.py then?
diff --git a/var/spack/repos/builtin/packages/libceed/package.py b/var/spack/repos/builtin/packages/libceed/package.py
index 948a35c8..07bea1ef 100644
--- a/var/spack/repos/builtin/packages/libceed/package.py
+++ b/var/spack/repos/builtin/packages/libceed/package.py
@@ -80,33 +80,7 @@ def common_make_opts(self):
makeopts += ["NDEBUG=%s" % ("" if spec.satisfies("+debug") else "1")]
elif spec.satisfies("@0.4:"):
- # Determine options based on the compiler:
- if spec.satisfies("+debug"):
- opt = "-g"
- elif compiler.name == "gcc":
- opt = "-O3 -g -ffp-contract=fast"
- if compiler.version >= ver(4.9):
- opt += " -fopenmp-simd"
- if self.spec.target.family in ["x86_64", "aarch64"]:
- opt += " -march=native"
- elif compiler.name == "apple-clang":
- opt = "-O3 -g -march=native -ffp-contract=fast"
- if compiler.version >= ver(10):
- opt += " -fopenmp-simd"
- elif compiler.name == "clang":
- opt = "-O3 -g -march=native -ffp-contract=fast"
- if compiler.version >= ver(6):
- opt += " -fopenmp-simd"
- elif compiler.name in ["xl", "xl_r"]:
- opt = "-O -g -qsimd=auto"
- elif compiler.name == "intel":
- opt = "-O3 -g"
- makeopts += ["CC_VENDOR=icc"]
- else:
- opt = "-O -g"
- # Note: spack will inject additional target-specific flags through
- # the compiler wrapper.
- makeopts += ["OPT=%s" % opt]
+ makeopts += ["OPT="]
if spec.satisfies("@0.7") and compiler.name in ["xl", "xl_r"]:
makeopts += ["CXXFLAGS.XL=-qpic -std=c++11 -MMD"]
@@ -119,8 +93,7 @@ def common_make_opts(self):
makeopts += ["CUDA_ARCH=sm_%s" % spec.variants["cuda_arch"].value]
if spec.satisfies("@:0.4"):
nvccflags = [
- '-ccbin %s -Xcompiler "%s" -Xcompiler %s'
- % (compiler.cxx, opt, compiler.cc_pic_flag)
+ "-ccbin %s -Xcompiler -Xcompiler %s" % (compiler.cxx, compiler.cc_pic_flag)
]
nvccflags = " ".join(nvccflags)
makeopts += ["NVCCFLAGS=%s" % nvccflags]
The only hesitation I have would be how this interacts with CUDA, but this would hopefully set OPT to the empty string for all Spack builds.
I'd want to widely test it, but I think that diff looks reasonable and doesn't have us overwriting our own compiler detection in the Makefile? I can't recall why we added all that logic in the first place.
I'd think it isn't even necessary to explicitly OPT=. In practice, what sort of options get passed? We liked -fopenmp-simd because it vectorized better, but I think we worked out detection of vendor-specific attributes so that we can get good performance without it. I like simpler.
I think some site had an icc that mangled version info, which is why we added that here (circa 2021).
Perhaps we just slap a max version on the options above since we're about to release v0.13
- elif spec.satisfies("@0.4:"):
+ elif spec.satisfies("@0.4:@0.12"):