From b817f87fd4b3a0e0fe0855ebf04ce385ee7b1da1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 31 Jan 2023 08:42:39 +0100 Subject: [PATCH] Fixes for ARM --- config/gfortran.cfg | 4 +-- config/gfortran_openblas.cfg | 62 ++++++++++++++++++++++++++++++++++++ configure | 26 ++++++++++++--- etc/ocaml.rc | 8 ++--- external/qp2-dependencies | 2 +- 5 files changed, 90 insertions(+), 12 deletions(-) create mode 100644 config/gfortran_openblas.cfg diff --git a/config/gfortran.cfg b/config/gfortran.cfg index 56bb6ba4..33ce48ba 100644 --- a/config/gfortran.cfg +++ b/config/gfortran.cfg @@ -10,7 +10,7 @@ # # [COMMON] -FC : gfortran -g -ffree-line-length-none -I . -fPIC +FC : gfortran -g -ffree-line-length-none -I . -fPIC -march=native LAPACK_LIB : -lblas -llapack IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --assert -DSET_NESTED @@ -22,7 +22,7 @@ IRPF90_FLAGS : --ninja --align=32 --assert -DSET_NESTED # 0 : Deactivate # [OPTION] -MODE : DEBUG ; [ OPT | PROFILE | DEBUG ] : Chooses the section below +MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below CACHE : 0 ; Enable cache_compile.py OPENMP : 1 ; Append OpenMP flags diff --git a/config/gfortran_openblas.cfg b/config/gfortran_openblas.cfg new file mode 100644 index 00000000..ab67d8c3 --- /dev/null +++ b/config/gfortran_openblas.cfg @@ -0,0 +1,62 @@ +# Common flags +############## +# +# -ffree-line-length-none : Needed for IRPF90 which produces long lines +# -lblas -llapack : Link with libblas and liblapack libraries provided by the system +# -I . : Include the curent directory (Mandatory) +# +# --ninja : Allow the utilisation of ninja. (Mandatory) +# --align=32 : Align all provided arrays on a 32-byte boundary +# +# +[COMMON] +FC : gfortran -g -ffree-line-length-none -I . -fPIC -march=native +LAPACK_LIB : -lopenblas +IRPF90 : irpf90 +IRPF90_FLAGS : --ninja --align=32 --assert -DSET_NESTED + +# Global options +################ +# +# 1 : Activate +# 0 : Deactivate +# +[OPTION] +MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below +CACHE : 0 ; Enable cache_compile.py +OPENMP : 1 ; Append OpenMP flags + +# Optimization flags +#################### +# +# -Ofast : Disregard strict standards compliance. Enables all -O3 optimizations. +# It also enables optimizations that are not valid +# for all standard-compliant programs. It turns on +# -ffast-math and the Fortran-specific +# -fno-protect-parens and -fstack-arrays. +[OPT] +FCFLAGS : -Ofast + +# Profiling flags +################# +# +[PROFILE] +FC : -p -g +FCFLAGS : -Ofast + +# Debugging flags +################# +# +# -fcheck=all : Checks uninitialized variables, array subscripts, etc... +# -g : Extra debugging information +# +[DEBUG] +FCFLAGS : -g -march=native -fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -Wreal-q-constant -Wuninitialized -fbacktrace -ffpe-trap=zero,overflow,underflow -finit-real=nan + +# OpenMP flags +################# +# +[OPENMP] +FC : -fopenmp +IRPF90_FLAGS : --openmp + diff --git a/configure b/configure index 852082e7..59135126 100755 --- a/configure +++ b/configure @@ -16,6 +16,25 @@ export CC=gcc git submodule init git submodule update +# Update ARM or x86 dependencies +ARCHITECTURE=$(uname -m) +cd ${QP_ROOT}/external/qp2-dependencies +echo "Architecture: $ARCHITECTURE" +case $ARCHITECTURE in + aarch64) + git checkout arm64 + ;; + x86_64) + git checkout x86 + ;; + *) + echo "Unknown architecture. Using x86_64." + git checkout x86 + ;; +esac +cd ${QP_ROOT} + + function help() { cat < /dev/null 2> /dev/null || true diff --git a/external/qp2-dependencies b/external/qp2-dependencies index 90ee61f5..57a1466d 160000 --- a/external/qp2-dependencies +++ b/external/qp2-dependencies @@ -1 +1 @@ -Subproject commit 90ee61f5041c7c94a0c605625a264860292813a0 +Subproject commit 57a1466d8707a8b0b1dfef8eede8e4f770b349cf