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

Respect CMAKE_Fortran_FLAGS (fortran flags passed by the user). #388

Closed
wants to merge 1 commit into from

Conversation

yurivict
Copy link

Systems should be able to set their preferred fortran flags.

Systems should be able to set their preferred fortran flags.
@codecov
Copy link

codecov bot commented Nov 15, 2020

Codecov Report

Merging #388 (a868621) into develop (1e7f52e) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           develop    #388   +/-   ##
=======================================
  Coverage     62.1%   62.1%           
=======================================
  Files           87      87           
  Lines        25741   25741           
=======================================
  Hits         15997   15997           
  Misses        9744    9744           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e7f52e...a868621. Read the comment docs.

@jenkins-cscs
Copy link
Collaborator

Can one of the admins verify this patch?

@dev-zero dev-zero closed this in b8639df Nov 16, 2020
@dev-zero
Copy link
Contributor

The problem with the proposed solution is the ordering of flags: CMake always orders the build-type flags (release, debug, profiling) after the common flags:

cd /home/tiziano/work/cp2k/dbcsr/build/src && /usr/bin/gfortran -DNDEBUG -D__MPI_VERSION=3 -D__STATM_TOTAL -D__parallel -D__SHORT_FILE__=\"dbcsr_mpiwrap.F\" -I/home/tiziano/work/cp2k/dbcsr/src/base -I/home/tiziano/work/cp2k/dbcsr/src -I/home/tiziano/work/cp2k/dbcsr/build/src -I/usr/include -I/usr/lib/openmpi -ffree-form -std=f2008ts -fimplicit-none -Werror=aliasing -Werror=ampersand -Werror=c-binding-type -Werror=intrinsic-shadow -Werror=intrinsics-std -Werror=line-truncation -Werror=tabs -Werror=target-lifetime -Werror=underflow -Werror=unused-but-set-parameter -Werror=unused-but-set-variable -Werror=unused-variable -Werror=unused-dummy-argument -Werror=conversion -Werror=zerotrip -Werror=uninitialized -Wno-maybe-uninitialized -O3 -g -funroll-loops -pthread -fopenmp -c /home/tiziano/work/cp2k/dbcsr/build/src/mpi/dbcsr_mpiwrap.F -o CMakeFiles/dbcsr.dir/mpi/dbcsr_mpiwrap.F.o

... the -std=f2008ts comes from the common flags, -O3 comes from the release build-type. And with GCC later flags override earlier ones, so this patch would not allow to override the flags.

And this is the reason why distros like Gentoo build CMake packages with a custom build-type, which allows to override the flags already like this:

$ cmake -DCMAKE_BUILD_TYPE=custom -DCMAKE_Fortran_FLAGS_CUSTOM=-O2 ..
$ make VERBOSE=1
[...]
[ 49%] Building Fortran object src/CMakeFiles/dbcsr.dir/utils/dbcsr_min_heap.F.o
cd /home/tiziano/work/cp2k/dbcsr/build/src && /usr/bin/gfortran -D__MPI_VERSION=3 -D__STATM_TOTAL -D__parallel -D__SHORT_FILE__=\"dbcsr_min_heap.F\" -I/home/tiziano/work/cp2k/dbcsr/src/base -I/home/tiziano/work/cp2k/dbcsr/src -I/home/tiziano/work/cp2k/dbcsr/build/src -I/usr/include -I/usr/lib/openmpi -ffree-form -std=f2008ts -fimplicit-none -Werror=aliasing -Werror=ampersand -Werror=c-binding-type -Werror=intrinsic-shadow -Werror=intrinsics-std -Werror=line-truncation -Werror=tabs -Werror=target-lifetime -Werror=underflow -Werror=unused-but-set-parameter -Werror=unused-but-set-variable -Werror=unused-variable -Werror=unused-dummy-argument -Werror=conversion -Werror=zerotrip -Werror=uninitialized -Wno-maybe-uninitialized -O2 -pthread -fopenmp -c /home/tiziano/work/cp2k/dbcsr/build/src/utils/dbcsr_min_heap.F -o CMakeFiles/dbcsr.dir/utils/dbcsr_min_heap.F.o

I've added more documentation to docs/guide/2-user-guide/1-installation/2-cmake-build-recipes.md about this.

dev-zero added a commit to dev-zero/dbcsr that referenced this pull request Nov 26, 2020
dev-zero added a commit to dev-zero/dbcsr that referenced this pull request Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants