SimVascular / svFSI

A multi-physics finite element solver for patient-specific blood flow simulation including fluid-structure interaction and cardiac electrophysiology
Other
26 stars 48 forks source link

Option to set CMAKE_Fortran_FLAGS while configuring ccmake #44

Open vvedula22 opened 2 years ago

vvedula22 commented 2 years ago

CMAKE_Fortran_FLAGS are reinitialized and hardcoded in svFSI/CMakeLists.txt and svFSILS/CMakeLists.txt.

When compiling using AOCC/Intel compilers, or when debugging, users have to edit these files to set appropriate FFLAGS such as,

if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
  # set(CMAKE_Fortran_FLAGS "-O3 -DNDEBUG -march=native")
  # set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp -pthread -std=legacy")

  # Use below flags for debugging
  set(CMAKE_Fortran_FLAGS "-O0")
  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp -pthread -std=legacy")
  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -Wall -Wconversion -Wline-truncation -pedantic -fimplicit-none -fbacktrace -fbounds-check -p -fcheck=all -ffpe-trap=invalid,zero,overflow,underflow")

elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
  set(CMAKE_Fortran_FLAGS "-O3 -DNDEBUG -march=core-avx2")
  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp ")

elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Flang")
  set(CMAKE_Fortran_FLAGS "-O3 -DNDEBUG -march=znver2")
  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mpreprocess -Mallocatable=03 ")

else()
  # nothing for now
  # may need to set for intel compiler or others
endif()

It would be useful to allow users to set CMAKE_Fortran_FLAGS during the configuration step in ccmake.

@ktbolt : could you take a look at this issue?

ktbolt commented 2 years ago

I've also run into this problem, will have a look.