From 2d908acc0a5dc520db8c08ce043030d8f48bf9d7 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 6 Apr 2017 13:14:23 -0500 Subject: [PATCH 1/4] Make -O2 default for gcc. --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abb900592a..208da7b41c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,8 +108,8 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) endif() # GCC compiler options - list(APPEND f90flags -cpp -std=f2008 -fbacktrace) - list(APPEND cflags -cpp -std=c99) + list(APPEND f90flags -cpp -std=f2008 -fbacktrace -O2) + list(APPEND cflags -cpp -std=c99 -O2) if(debug) list(APPEND f90flags -g -Wall -pedantic -fbounds-check -ffpe-trap=invalid,overflow,underflow) @@ -122,6 +122,8 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) list(APPEND ldflags -pg) endif() if(optimize) + list(REMOVE_ITEM f90flags -O2) + list(REMOVE_ITEM cflags -O2) list(APPEND f90flags -O3) list(APPEND cflags -O3) endif() @@ -190,6 +192,7 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL XL) list(APPEND ldflags -p) endif() if(optimize) + list(REMOVE_ITEM f90flags -O2) list(APPEND f90flags -O3) endif() if(openmp) From ef66d9a43aea981ce5d63e58d65cf4099e327dab Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 7 Apr 2017 12:08:10 -0500 Subject: [PATCH 2/4] Make sure debug mode uses -O0 --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 208da7b41c..ddb55dcbed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,8 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) list(APPEND f90flags -cpp -std=f2008 -fbacktrace -O2) list(APPEND cflags -cpp -std=c99 -O2) if(debug) + list(REMOVE_ITEM f90flags -O2) + list(REMOVE_ITEM cflags -O2) list(APPEND f90flags -g -Wall -pedantic -fbounds-check -ffpe-trap=invalid,overflow,underflow) list(APPEND cflags -g -Wall -pedantic -fbounds-check) @@ -144,8 +146,8 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Intel) list(APPEND cflags -std=c99) if(debug) list(APPEND f90flags -g -warn -ftrapuv -fp-stack-check - "-check all" -fpe0) - list(APPEND cflags -g -w3 -ftrapuv -fp-stack-check) + "-check all" -fpe0 -O0) + list(APPEND cflags -g -w3 -ftrapuv -fp-stack-check -O0) list(APPEND ldflags -g) endif() if(profile) @@ -184,7 +186,8 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL XL) list(APPEND f90flags -O2) add_definitions(-DNO_F2008) if(debug) - list(APPEND f90flags -g -C -qflag=i:i -u) + list(REMOVE_ITEM f90flags -O2) + list(APPEND f90flags -g -C -qflag=i:i -u -O0) list(APPEND ldflags -g) endif() if(profile) From c494ed69d700085aec3a2bf6565702cf845db333 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 10 Apr 2017 07:26:48 -0500 Subject: [PATCH 3/4] Show compile flags when cmake is run --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddb55dcbed..d453890b21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,6 +213,11 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Cray) endif() +# Show flags being used +message(STATUS "Fortran flags: ${f90flags}") +message(STATUS "C flags: ${cflags}") +message(STATUS "Linker flags: ${ldflags}") + #=============================================================================== # git SHA1 hash #=============================================================================== From 2660c5918f00fcff758a7f2a504ca8fb665f1d03 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 10 Apr 2017 07:32:51 -0500 Subject: [PATCH 4/4] Turn on OpenMP by default --- CMakeLists.txt | 3 +-- docs/source/usersguide/install.rst | 2 +- tests/run_tests.py | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d453890b21..2dc30a21d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,14 +25,13 @@ endif() # Command line options #=============================================================================== -option(openmp "Enable shared-memory parallelism with OpenMP" OFF) +option(openmp "Enable shared-memory parallelism with OpenMP" ON) option(profile "Compile with profiling flags" OFF) option(debug "Compile with debug flags" OFF) option(optimize "Turn on all compiler optimization flags" OFF) option(coverage "Compile with coverage analysis flags" OFF) option(mpif08 "Use Fortran 2008 MPI interface" OFF) - # Maximum number of nested coordinates levels set(maxcoord 10 CACHE STRING "Maximum number of nested coordinate levels") add_definitions(-DMAX_COORD=${maxcoord}) diff --git a/docs/source/usersguide/install.rst b/docs/source/usersguide/install.rst index e980407084..a065c904a9 100644 --- a/docs/source/usersguide/install.rst +++ b/docs/source/usersguide/install.rst @@ -225,7 +225,7 @@ optimize openmp Enables shared-memory parallelism using the OpenMP API. The Fortran compiler - being used must support OpenMP. + being used must support OpenMP. (Default: on) coverage Compile and link code instrumented for coverage analysis. This is typically diff --git a/tests/run_tests.py b/tests/run_tests.py index f0ecd82916..2d9112e92e 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -184,8 +184,8 @@ class Test(object): build_str += "-Ddebug=ON " if self.optimize: build_str += "-Doptimize=ON " - if self.openmp: - build_str += "-Dopenmp=ON " + if not self.openmp: + build_str += "-Dopenmp=OFF " if self.coverage: build_str += "-Dcoverage=ON " self.build_opts = build_str