Skip to content

Commit

Permalink
merge 37dd0f4
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisZYJ committed Jun 20, 2024
2 parents b8fd6b0 + 6e16485 commit 35a633d
Show file tree
Hide file tree
Showing 98 changed files with 4,538 additions and 767 deletions.
33 changes: 33 additions & 0 deletions .github/file-filter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This is used by the action https://github.com/dorny/paths-filter
# Lists all files to be filtered for changes to run a CI for test.yml & coverage.yml

fortran_src: &fortran_src
- '**/*.f90'
- '**/*.fpp'

python_src: &python_src
- '**/*.py'
- 'toolchain/requirements.txt'

cmakelist: &cmakelist
- 'CMakeLists.txt'
- 'toolchain/cmake/**'

tests: &tests
- 'tests/**'

scripts: &scripts
- 'mfc.sh'
- 'mfc.bat'
- 'toolchain/bootstrap/**'

yml: &yml
- '**/*.yml'

checkall: &checkall
- *fortran_src
- *python_src
- *cmakelist
- *tests
- *scripts
- *yml
3 changes: 1 addition & 2 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: 'Benchmark'

on:
pull_request:
on: pull_request

jobs:
self:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/count.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Check Line Counts
on:
push:

pull_request:

workflow_dispatch:
on: [push, pull_request, workflow_dispatch]

jobs:
sz:
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Coverage Check

on: [push, pull_request, workflow_dispatch]

jobs:
file-changes:
name: Detect File Changes
runs-on: 'ubuntu-latest'
outputs:
checkall: ${{ steps.changes.outputs.checkall }}
steps:
- name: Clone
uses: actions/checkout@v4

- name: Detect Changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: ".github/file-filter.yml"

run:
name: Coverage Test on CodeCov
if: needs.file-changes.outputs.checkall == 'true'
needs: file-changes
runs-on: "ubuntu-latest"
steps:
- name: Checkouts
uses: actions/checkout@v4

- name: Setup Ubuntu
run: |
sudo apt update -y
sudo apt install -y tar wget make cmake gcc g++ python3 python3-dev "openmpi-*" libopenmpi-dev
- name: Build
run: /bin/bash mfc.sh build -j $(nproc) --gcov

- name: Test
run: /bin/bash mfc.sh test -a -j $(nproc)

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
7 changes: 1 addition & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Lint

on:
push:

pull_request:

workflow_dispatch:
on: [push, pull_request, workflow_dispatch]

jobs:
docs:
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/pretty.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Pretty

on:
push:

pull_request:

workflow_dispatch:
on: [push, pull_request, workflow_dispatch]

jobs:
docs:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Spell Check
on:
push:
workflow_dispatch:

on: [push, workflow_dispatch]

jobs:
run:
Expand All @@ -13,3 +12,5 @@ jobs:

- name: Spell Check
uses: crate-ci/typos@master
with:
config: .typos.toml
40 changes: 28 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,25 @@ on:
workflow_dispatch:

jobs:
file-changes:
name: Detect File Changes
runs-on: 'ubuntu-latest'
outputs:
checkall: ${{ steps.changes.outputs.checkall }}
steps:
- name: Clone
uses: actions/checkout@v4

- name: Detect Changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: ".github/file-filter.yml"

github:
name: Github
if: needs.file-changes.outputs.checkall == 'true'
needs: file-changes
strategy:
matrix:
os: ['ubuntu', 'macos']
Expand All @@ -29,12 +46,7 @@ jobs:
- os: macos
intel: true

- os: macos
debug: debug
intel: false

include:

include:
- os: ubuntu
mpi: no-mpi
debug: no-debug
Expand All @@ -43,17 +55,18 @@ jobs:
fail-fast: false
continue-on-error: true
runs-on: ${{ matrix.os }}-latest

steps:
- name: Clone
uses: actions/checkout@v4

- name: Setup MacOS
if: matrix.os == 'macos'
run: |
echo "CC=gcc-13" >> $GITHUB_ENV
echo "CXX=g++-13" >> $GITHUB_ENV
echo "FC=gfortran-13" >> $GITHUB_ENV
brew install wget make python make cmake coreutils gcc@13
brew install wget make python make cmake coreutils gcc@14
echo "CC=gcc-14" >> $GITHUB_ENV
echo "CXX=g++-14" >> $GITHUB_ENV
echo "FC=gfortran-14" >> $GITHUB_ENV
- name: (MacOS) Build OpenMPI
if: matrix.os == 'macos' && matrix.mpi == 'mpi'
Expand Down Expand Up @@ -101,7 +114,9 @@ jobs:
OPT2: ${{ matrix.debug == 'debug' && '-% 20' || '' }}

docker:
name: Github | Docker
name: Github | Docker
if: needs.file-changes.outputs.checkall == 'true'
needs: file-changes
runs-on: ubuntu-latest
steps:
- name: Clone
Expand All @@ -112,7 +127,8 @@ jobs:

self:
name: Self Hosted
if: github.repository == 'MFlowCode/MFC'
if: github.repository == 'MFlowCode/MFC' && needs.file-changes.outputs.checkall == 'true'
needs: file-changes
continue-on-error: true
strategy:
matrix:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ examples/*/*.err
examples/*/viz/
examples/*.jpg
examples/*.png
examples/*/workloads/
examples/*/run-*/
examples/*/logs/
workloads/

benchmarks/*batch/*/
benchmarks/*/D/*
Expand Down
1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ WRONLY = "WRONLY"
nd = "nd"
iy = "iy"
HPE = "HPE"
alph = "alph"

[files]
extend-exclude = ["docs/documentation/references*", "tests/", "toolchain/cce_simulation_workgroup_256.sh"]
66 changes: 46 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ project(MFC LANGUAGES C CXX Fortran)

# Build options exposed to users and their default values.

option(MFC_MPI "Build with MPI" ON)
option(MFC_OpenACC "Build with OpenACC" OFF)
option(MFC_PRE_PROCESS "Build pre_process" OFF)
option(MFC_SIMULATION "Build simulation" OFF)
option(MFC_POST_PROCESS "Build post_process" OFF)
option(MFC_SYSCHECK "Build syscheck" OFF)
option(MFC_DOCUMENTATION "Build documentation" OFF)
option(MFC_ALL "Build everything" OFF)
option(MFC_MPI "Build with MPI" ON)
option(MFC_OpenACC "Build with OpenACC" OFF)
option(MFC_GCov "Build with GCov" OFF)
option(MFC_Unified "Build with unified CPU & GPU memory (GH-200 only)" OFF)
option(MFC_PRE_PROCESS "Build pre_process" OFF)
option(MFC_SIMULATION "Build simulation" OFF)
option(MFC_POST_PROCESS "Build post_process" OFF)
option(MFC_SYSCHECK "Build syscheck" OFF)
option(MFC_DOCUMENTATION "Build documentation" OFF)
option(MFC_ALL "Build everything" OFF)

if (MFC_ALL)
set(MFC_PRE_PROCESS ON FORCE)
Expand Down Expand Up @@ -66,16 +68,8 @@ elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_Fortran_COMPILER_
if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 21.7)
message(FATAL_ERROR "${__err_msg}ERROR: When using NVHPC, v21.7 or newer is required to build MFC.")
endif()
if (MAKE_BUILD_TYPE STREQUAL "Debug")
if (MFC_OpenACC)
if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 23.0)
message(FATAL_ERROR "${__err_msg}ERROR: When using NVHPC, v23.0 or newer is required to build MFC with Debug and GPU options.")
endif()
else()
if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 23.8)
message(FATAL_ERROR "${__err_msg}ERROR: Debug is not working with NVHPC 23.X and older and CPU options at present.")
endif()
endif()
if ((CMAKE_BUILD_TYPE STREQUAL "Debug") AND MFC_OpenACC)
message(FATAL_ERROR "${__err_msg}ERROR: When using NVHPC, MFC with Debug and GPU options is unavailable.")
endif()
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
message(FATAL_ERROR "${__err_msg}ERROR: MFC does not support the Apple Clang compilers. Please consult the documentation.")
Expand Down Expand Up @@ -106,13 +100,34 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
$<$<COMPILE_LANGUAGE:Fortran>:-ffree-line-length-none>
)

if (MFC_GCov)

# Warning present in gcc versions >= 12 that is treated as an error
# This flag doesn't exist in gcc versions < 12
if (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 12)
add_compile_options(
-Wno-error=coverage-invalid-line-number
)
endif()

add_compile_options(
$<$<COMPILE_LANGUAGE:Fortran>:-fprofile-arcs>
$<$<COMPILE_LANGUAGE:Fortran>:-ftest-coverage>
)

add_link_options(
$<$<COMPILE_LANGUAGE:Fortran>:-lgcov>
$<$<COMPILE_LANGUAGE:Fortran>:--coverage>
)
endif()

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(
-fcheck=all,no-array-temps
-fbacktrace
-fimplicit-none
#-ffpe-trap=invalid,zero,denormal,overflow
)
)
endif()

if (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 10)
Expand Down Expand Up @@ -171,7 +186,7 @@ elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_Fortran_COMPILER_
endif()

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-C -g -O0 -traceback -Mchkptr -Mchkstk -Minform=inform -Mbounds)
add_compile_options(-C -g -O0 -traceback -Mchkptr -Minform=inform -Mbounds)
endif()

if (DEFINED ENV{MFC_CUDA_CC})
Expand Down Expand Up @@ -440,6 +455,17 @@ function(MFC_SETUP_TARGET)
PRIVATE -gpu=keep,ptxinfo,lineinfo
)

# GH-200 Unified Memory Support
if (MFC_Unified)
target_compile_options(${ARGS_TARGET}
PRIVATE -gpu=unified
)
# "This option must appear in both the compile and link lines" -- NVHPC Docs
target_link_options(${ARGS_TARGET}
PRIVATE -gpu=unified
)
endif()

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(${ARGS_TARGET}
PRIVATE -gpu=autocompare,debug
Expand Down
Loading

0 comments on commit 35a633d

Please sign in to comment.