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

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

> On Sep 19, 2021, at 3:39 PM, Ryan Novosielski <novosirj.rutgers.edu> wrote:
>
>> On Sep 19, 2021, at 8:18 AM, David A Case <dacase1.gmail.com> 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:
>>>
>>> -DCMAKE_C_FLAGS="-O3 -xAVX -axCORE-AVX2" -DCMAKE_CXX_FLAGS="-O3 -xAVX -axCORE-AVX2" \
>>> -DCMAKE_FORTRAN_FLAGS="-O3 -xAVX -axCORE-AVX2" -DCMAKE_EXE_LINKER_FLAGS="-O3 -xAVX -axCORE-AVX2" \
>>>
>>
>> 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(SSE)

                        if("${CMAKE_Fortran_COMPILER_VERSION}" VERSION_GREATER 11 OR ${CMAKE_Fortran_COMPILER_VERSION} VERSION_EQUAL 11)
                                if(NOT "${SSE_TYPES}" STREQUAL "")
                                        list(APPEND OPT_FFLAGS "-ax${SSE_TYPES}")
                                else()
                                        list(APPEND OPT_FFLAGS -xHost)
                                endif()
                        else()
                                list(APPEND OPT_FFLAGS -axSTPW)
                        endif()
                endif()

…vs.…

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
        set(CMAKE_CXX_FLAGS_DEBUG "-g -debug all")

        set(OPT_CXXFLAGS -O3)
endif()

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

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


_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Sun Sep 19 2021 - 13:30:02 PDT
Custom Search