Re: [AMBER] Setting compiler flags w/cmake build? Amber20/AmberTools21

From: Ryan Novosielski <>
Date: Sun, 19 Sep 2021 20:19:05 +0000

> On Sep 19, 2021, at 3:39 PM, Ryan Novosielski <> wrote:
>> On Sep 19, 2021, at 8:18 AM, David A Case <> wrote:
>> On Sat, Sep 18, 2021, Ryan Novosielski wrote:
>>> Trying to build with the Intel compilers and wanted to use auto vectorization, so I set:
>> I think you want to set OPT_CFLAGS, OPT_FFLAGS (and, if needed NO_OPT_CFLAGS
>> and NO_OPT_FFLAGS). Look in the amber20_src/cmake/CompilerFlags.cmake file
>> for more information.
> Thanks, David. What’s not clear to me is where to set those? From reading that file, it looks like I could still set SSE_TYPES and the section of that file around the Intel compiler would make use of it. Same goes for the variables you suggest them, but I’m not clear if I should set those like: OPT_CFLAGS="-O3 -xAVX -axCORE-AVX2” ./run_cmake, or if I set those with -D inside the run_cmake script, or what.
> Thanks again!

Realized I could probably get an answer faster through experimentation, and so I discovered that I can add -DSSE_TYPES= to the run_cmake file and that works.

My remaining question is if it’s on purpose that this does not affect the CXX flags. It’s applied on both the Fortran and C sections, but you can see the difference here with the CXX flags:


                                if(NOT "${SSE_TYPES}" STREQUAL "")
                                        list(APPEND OPT_FFLAGS "-ax${SSE_TYPES}")
                                        list(APPEND OPT_FFLAGS -xHost)
                                list(APPEND OPT_FFLAGS -axSTPW)


        set(CMAKE_CXX_FLAGS_DEBUG "-g -debug all")

        set(OPT_CXXFLAGS -O3)

I have to figure that that’s intentional? I can’t remember how this worked on Amber 16 (the last one I personally built).

|| \\UTGERS, |---------------------------*O*---------------------------
||_// the State | Ryan Novosielski -
|| \\ University | Sr. Technologist - 973/972.0922 (2x0922) ~*~ RBHS Campus
|| \\ of NJ | Office of Advanced Research Computing - MSB C630, Newark

AMBER mailing list
Received on Sun Sep 19 2021 - 13:30:02 PDT
Custom Search