Commit d2daaa57 authored by Henderson, Shane's avatar Henderson, Shane
Browse files

WIP: experiment with Flang

parent 14a70ff2
Loading
Loading
Loading
Loading
Loading
+34 −10
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
      "name": "serial-debug",
      "displayName": "Serial (Debug) — CI parity",
      "inherits": "base",
      "toolchainFile": "${sourceDir}/cmake/toolchains/gcc.cmake",
      "cacheVariables": {
        "CMAKE_BUILD_TYPE": "DEBUG",

@@ -39,11 +40,7 @@
        "TPL_ENABLE_BLAS": "ON",
        "BLAS_LIBRARY_DIRS": "/opt/vera_tpls/lapack-3.5.0/lib",
        "TPL_ENABLE_LAPACK": "ON",
        "LAPACK_LIBRARY_DIRS": "/opt/vera_tpls/lapack-3.5.0/lib",

        "CMAKE_C_COMPILER": "gcc",
        "CMAKE_CXX_COMPILER": "g++",
        "CMAKE_Fortran_COMPILER": "gfortran"
        "LAPACK_LIBRARY_DIRS": "/opt/vera_tpls/lapack-3.5.0/lib"
      }
    },

@@ -51,6 +48,7 @@
      "name": "mpi-debug",
      "displayName": "MPI (Debug) — CI parity",
      "inherits": "base",
      "toolchainFile": "${sourceDir}/cmake/toolchains/gcc-mpi.cmake",
      "cacheVariables": {
        "CMAKE_BUILD_TYPE": "DEBUG",

@@ -72,17 +70,36 @@
        "PETSC_LIBRARY_DIRS": "/opt/vera_tpls/petsc-3.12.4/lib",
        "PETSC_LIBRARY_NAMES": "petsc",

        "Futility_SCALE_TEST_TIMEOUT": "3.00",
        "CMAKE_Fortran_COMPILER": "mpif90",
        "CMAKE_C_COMPILER": "mpicc",
        "CMAKE_CXX_COMPILER": "mpicxx"
        "Futility_SCALE_TEST_TIMEOUT": "3.00"
      }
    },

    {
      "name": "flang-serial",
      "displayName": "Flang (Debug) — serial",
      "inherits": "base",
      "toolchainFile": "${sourceDir}/cmake/toolchains/flang-serial.cmake",
      "cacheVariables": {
        "CMAKE_BUILD_TYPE": "DEBUG",

        "Futility_ENABLE_OpenMP": "FALSE",

        "TPL_ENABLE_MPI": "OFF",
        "TPL_ENABLE_PETSC": "OFF",
        "TPL_ENABLE_HDF5": "OFF",

        "TPL_ENABLE_BLAS": "ON",
        "BLAS_LIBRARY_DIRS": "/opt/vera_tpls/lapack-3.5.0/lib",
        "TPL_ENABLE_LAPACK": "ON",
        "LAPACK_LIBRARY_DIRS": "/opt/vera_tpls/lapack-3.5.0/lib"
      }
    }
  ],

  "buildPresets": [
    { "name": "serial-debug", "configurePreset": "serial-debug", "jobs": 0 },
    { "name": "mpi-debug", "configurePreset": "mpi-debug", "jobs": 0 }
    { "name": "mpi-debug", "configurePreset": "mpi-debug", "jobs": 0 },
    { "name": "flang-serial", "configurePreset": "flang-serial", "jobs": 0 }
  ],

  "testPresets": [
@@ -104,6 +121,13 @@
          "name": "COBRA_TFUtils|DataTransferKit"
        }
      }
    },
    {
      "name": "flang-serial",
      "displayName": "CTest (flang serial)",
      "configurePreset": "flang-serial",
      "execution": { "jobs": 4 },
      "output": { "outputOnFailure": true }
    }
  ]
}
+13 −0
Original line number Diff line number Diff line
@@ -35,6 +35,19 @@ contains the following capabilities:
The Futility project will not contain any encryption technology to preserve the
  open source license.

## Using flang
---
This repo includes CMake presets and toolchains for GCC and flang.

Configure/build/test with flang (serial):
```sh
cmake --preset flang-serial
cmake --build --preset flang-serial
ctest --preset flang-serial
```

Toolchain files live in `cmake/toolchains/` if you prefer manual configuration.

## Citation
---
Proper citation of the Futility software:
+12 −1
Original line number Diff line number Diff line
@@ -33,6 +33,18 @@ contains the following capabilities:
The Futility project will not contain any encryption technology to preserve the
  open source license.

!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
!                                 Using flang                                 !
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
This repo includes CMake presets and toolchains for GCC and flang.

Configure/build/test with flang (serial):
  cmake --preset flang-serial
  cmake --build --preset flang-serial
  ctest --preset flang-serial

Toolchain files live in cmake/toolchains/ if you prefer manual configuration.

!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
!                                   Citation                                   !
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
@@ -71,4 +83,3 @@ Contributor Agreement:
  should remain followed by the new contribution.
- The administrators of the github.com/CASL/Futility project reserve the right
  to decline any pull request for any reason.
+46 −2
Original line number Diff line number Diff line
@@ -122,6 +122,9 @@ ENDIF()
IF(${PACKAGE_NAME}_ENABLE_OpenMP AND DEFINED OpenMP_C_FLAGS)
    SET(OpenMP_Fortran_FLAGS ${OpenMP_C_FLAGS})
ENDIF()
IF(NOT ${PACKAGE_NAME}_ENABLE_OpenMP)
    UNSET(OpenMP_Fortran_FLAGS)
ENDIF()

# Check if MPI supports Fortran 2003 standard
IF(${PROJECT_NAME}_BUILD_STANDARD)
@@ -264,7 +267,7 @@ ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
    IF(${PROJECT_NAME}_BUILD_STANDARD)
        SET(Fortran_FLAGS
            ${Fortran_FLAGS}
            ${CSYM}std=f2008
            ${CSYM}std=f2018
           )
    ENDIF()

@@ -321,6 +324,45 @@ ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
        ${CSYM}g
        ${CSYM}fbounds-check
       )
ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
    SET(Fortran_FLAGS
        ${CSYM}cpp
        ${CSYM}DFUTILITY_DISABLE_BLAS
       )

    IF(${PROJECT_NAME}_BUILD_STANDARD)
        SET(Fortran_FLAGS
            ${Fortran_FLAGS}
            ${CSYM}std=f2018
           )
    ENDIF()

    IF(${PROJECT_NAME}_SUPPRESS_WARNINGS)
        SET(Fortran_FLAGS
            ${Fortran_FLAGS}
            ${CSYM}w
           )
    ENDIF()

    IF(${PROJECT_NAME}_GPROF)
        SET(Fortran_FLAGS
            ${Fortran_FLAGS}
            ${CSYM}pg
           )
    ENDIF()

    SET(Fortran_FLAGS_DEBUG
        ${CSYM}g
       )

    SET(Fortran_FLAGS_RELEASE
        ${CSYM}O3
       )

    SET(Fortran_FLAGS_RELWITHDEBINFO
        ${CSYM}O3
        ${CSYM}g
       )
ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")

    SET(Fortran_FLAGS
@@ -440,7 +482,9 @@ IF(${PROJECT_NAME}_ENABLE_CODECOV)
ENDIF()


IF(${PACKAGE_NAME}_ENABLE_OpenMP AND DEFINED OpenMP_Fortran_FLAGS)
    SET(Fortran_FLAGS ${Fortran_FLAGS} ${OpenMP_Fortran_FLAGS})
ENDIF()

# Add define symbols to Fortran_FLAGS and CXX_Flags
FOREACH(def ${${PACKAGE_NAME}_DEFINES})
+3 −0
Original line number Diff line number Diff line
set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE)
set(CMAKE_Fortran_COMPILER "/opt/homebrew/bin/flang" CACHE STRING "" FORCE)
Loading