Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into ppconvertcmakeclean
Browse files Browse the repository at this point in the history
  • Loading branch information
ye-luo committed Oct 1, 2021
2 parents d48bd76 + 91fa888 commit 4042431
Show file tree
Hide file tree
Showing 51 changed files with 1,128 additions and 460 deletions.
191 changes: 111 additions & 80 deletions .github/workflows/ci-github-actions.yaml
@@ -1,16 +1,14 @@

name: GitHub Actions CI

on:
on:
push:
branches:
- develop
branches:
- develop
pull_request:
branches:
- develop
branches:
- develop

jobs:

linux:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
Expand All @@ -20,79 +18,112 @@ jobs:
strategy:
fail-fast: false
matrix:
jobname: [
gcc-openmpi-real-coverage,
gcc-openmpi-complex-coverage,
gcc11-real-werror,
gcc11-complex-werror,
clang-real-asan,
clang-complex-asan,
clang-openmpi-real-ubsan,
clang-latest-openmp-offload
]
jobname:
[
gcc-openmpi-real-coverage,
gcc-openmpi-complex-coverage,
gcc11-real-werror,
gcc11-complex-werror,
clang-real-asan,
clang-complex-asan,
clang-openmpi-real-ubsan,
clang-latest-openmp-offload,
]
include:
- jobname: gcc-openmpi-real-coverage
container:
image: williamfgc/qmcpack-ci:ubuntu20-openmpi
options: -u 1001

- jobname: gcc-openmpi-complex-coverage
container:
image: williamfgc/qmcpack-ci:ubuntu20-openmpi
options: -u 1001

- jobname: gcc11-real-werror
container:
image: williamfgc/qmcpack-ci:ubuntu2110-serial
options: -u 1001

- jobname: gcc11-complex-werror
container:
image: williamfgc/qmcpack-ci:ubuntu2110-serial
options: -u 1001

- jobname: clang-real-asan
container:
image: williamfgc/qmcpack-ci:ubuntu20-openmpi
options: -u 1001

- jobname: clang-complex-asan
container:
image: williamfgc/qmcpack-ci:ubuntu20-openmpi
options: -u 1001

- jobname: clang-openmpi-real-ubsan
container:
image: williamfgc/qmcpack-ci:ubuntu20-openmpi
options: -u 1001

- jobname: clang-latest-openmp-offload
container:
image: williamfgc/qmcpack-ci:ubuntu20-clang-latest
options: -u 1001
- jobname: gcc-openmpi-real-coverage
container:
image: williamfgc/qmcpack-ci:ubuntu20-openmpi
options: -u 1001

- jobname: gcc-openmpi-complex-coverage
container:
image: williamfgc/qmcpack-ci:ubuntu20-openmpi
options: -u 1001

- jobname: gcc11-real-werror
container:
image: williamfgc/qmcpack-ci:ubuntu2110-serial
options: -u 1001

- jobname: gcc11-complex-werror
container:
image: williamfgc/qmcpack-ci:ubuntu2110-serial
options: -u 1001

- jobname: clang-real-asan
container:
image: williamfgc/qmcpack-ci:ubuntu20-openmpi
options: -u 1001

- jobname: clang-complex-asan
container:
image: williamfgc/qmcpack-ci:ubuntu20-openmpi
options: -u 1001

- jobname: clang-openmpi-real-ubsan
container:
image: williamfgc/qmcpack-ci:ubuntu20-openmpi
options: -u 1001

- jobname: clang-latest-openmp-offload
container:
image: williamfgc/qmcpack-ci:ubuntu20-clang-latest
options: -u 1001

steps:
- name: Checkout Action
uses: actions/checkout@v1

- name: Configure
run: tests/test_automation/github-actions/ci/run_step.sh configure

- name: Build
run: tests/test_automation/github-actions/ci/run_step.sh build

- name: Test
run: tests/test_automation/github-actions/ci/run_step.sh test

- name: Coverage
if: contains(matrix.jobname, 'coverage')
run: tests/test_automation/github-actions/ci/run_step.sh coverage

- name: Upload Coverage
if: contains(matrix.jobname, 'coverage') && github.repository_owner == 'QMCPACK'
uses: codecov/codecov-action@v1
with:
file: ../qmcpack-build/coverage.xml
flags: tests-deterministic # optional
name: codecov-QMCPACK # optional
fail_ci_if_error: true # optional (default = false)

macos:
runs-on: macos-latest
env:
GH_JOBNAME: ${{ matrix.jobname }}
GH_OS: macOS

strategy:
fail-fast: false
matrix:
jobname: [macOS-gcc11-real]

steps:
- name: Checkout Action
uses: actions/checkout@v1

- name: Configure
run: tests/test_automation/github-actions/ci/run_step.sh configure

- name: Build
run: tests/test_automation/github-actions/ci/run_step.sh build

- name: Test
run: tests/test_automation/github-actions/ci/run_step.sh test

- name: Coverage
if: contains(matrix.jobname, 'coverage')
run: tests/test_automation/github-actions/ci/run_step.sh coverage

- name: Upload Coverage
if: contains(matrix.jobname, 'coverage') && github.repository_owner == 'QMCPACK'
uses: codecov/codecov-action@v1
with:
file: ../qmcpack-build/coverage.xml
flags: tests-deterministic # optional
name: codecov-QMCPACK # optional
fail_ci_if_error: true # optional (default = false)
- name: Checkout Action
uses: actions/checkout@v2

- name: Setup Dependencies
run: |
brew install ninja hdf5 fftw boost
pip3 install numpy h5py pandas
- name: Configure
run: tests/test_automation/github-actions/ci/run_step.sh configure

- name: Build
run: tests/test_automation/github-actions/ci/run_step.sh build

- name: Test
run: tests/test_automation/github-actions/ci/run_step.sh test

- name: Install
run: tests/test_automation/github-actions/ci/run_step.sh install
11 changes: 11 additions & 0 deletions CMake/ClangCompilers.cmake
Expand Up @@ -19,6 +19,17 @@ if(QMC_OMP)
CACHE STRING "Offload target architecture")
set(OPENMP_OFFLOAD_COMPILE_OPTIONS "-fopenmp-targets=${OFFLOAD_TARGET}")

if(NOT DEFINED OFFLOAD_ARCH AND OFFLOAD_TARGET MATCHES "nvptx64" AND DEFINED CMAKE_CUDA_ARCHITECTURES)
list(LENGTH CMAKE_CUDA_ARCHITECTURES NUMBER_CUDA_ARCHITECTURES)
if(NUMBER_CUDA_ARCHITECTURES EQUAL "1")
set(OFFLOAD_ARCH sm_${CMAKE_CUDA_ARCHITECTURES})
else()
message(FATAL_ERROR "LLVM does not yet support offload to multiple architectures! "
"Deriving OFFLOAD_ARCH from CMAKE_CUDA_ARCHITECTURES failed. "
"Please keep only one entry in CMAKE_CUDA_ARCHITECTURES or set OFFLOAD_ARCH.")
endif()
endif()

if(DEFINED OFFLOAD_ARCH)
set(OPENMP_OFFLOAD_COMPILE_OPTIONS
"${OPENMP_OFFLOAD_COMPILE_OPTIONS} -Xopenmp-target=${OFFLOAD_TARGET} -march=${OFFLOAD_ARCH}")
Expand Down
20 changes: 16 additions & 4 deletions CMake/NVHPCCompilers.cmake
Expand Up @@ -7,12 +7,24 @@ if(QMC_OMP)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mp=allcores")
if(ENABLE_OFFLOAD AND NOT CMAKE_SYSTEM_NAME STREQUAL "CrayLinuxEnvironment")
message(WARNING "QMCPACK OpenMP offload is not ready for NVIDIA HPC compiler.")
if(NOT DEFINED OFFLOAD_ARCH)
message(FATAL_ERROR "NVIDIA HPC compiler requires -gpu=ccXX option set based on the target GPU architecture! "
"Please add -DOFFLOAD_ARCH=ccXX to cmake. For example, cc70 is for Volta.")
if(NOT DEFINED OFFLOAD_ARCH AND DEFINED CMAKE_CUDA_ARCHITECTURES)
list(LENGTH CMAKE_CUDA_ARCHITECTURES NUMBER_CUDA_ARCHITECTURES)
if(NUMBER_CUDA_ARCHITECTURES EQUAL "1")
set(OFFLOAD_ARCH cc${CMAKE_CUDA_ARCHITECTURES})
else()
string(REPLACE ";" ",cc" OFFLOAD_ARCH "${CMAKE_CUDA_ARCHITECTURES}")
set(OFFLOAD_ARCH "cc${OFFLOAD_ARCH}")
endif()
endif()

if(DEFINED OFFLOAD_ARCH)
if(NOT OFFLOAD_ARCH MATCHES "cc")
message(FATAL_ERROR "NVIDIA HPC compiler requires -gpu=ccXX option set based on the target GPU architecture! "
"Please add -DOFFLOAD_ARCH=ccXX to cmake. For example, cc70 is for Volta.")
endif()
set(OPENMP_OFFLOAD_COMPILE_OPTIONS "-gpu=${OFFLOAD_ARCH}")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mp=gpu")
set(OPENMP_OFFLOAD_COMPILE_OPTIONS "-gpu=${OFFLOAD_ARCH}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mp=allcores")
endif()
Expand Down
60 changes: 29 additions & 31 deletions CMakeLists.txt
Expand Up @@ -72,6 +72,17 @@ if(ENABLE_CUDA AND QMC_CUDA)
message(FATAL_ERROR "ENABLE_CUDA=ON and QMC_CUDA=ON can not be set together!")
endif(ENABLE_CUDA AND QMC_CUDA)

# set CMAKE_CUDA_ARCHITECTURES early such that offload compilers may take advantage of it
if(ENABLE_CUDA OR QMC_CUDA AND NOT QMC_CUDA2HIP)
if(DEFINED CUDA_ARCH)
unset(CUDA_ARCH CACHE)
message(FATAL_ERROR "CUDA_ARCH option has been removed. Use -DCMAKE_CUDA_ARCHITECTURES=80 if -DCUDA_ARCH=sm_80 was used.")
endif()
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES 70)
endif()
endif()

#--------------------------------------------------------------------
# Set compiler-time parameters
# WALKER_MAX_PROPERTIES max number of observables + 12 or so standard
Expand Down Expand Up @@ -662,38 +673,25 @@ if(QMC_CUDA OR ENABLE_CUDA)
if(QMC_CUDA2HIP)
message(STATUS "CUDA2HIP enabled") # all the HIP and ROCm settings will be handled by ENABLE_ROCM
else(QMC_CUDA2HIP)
# FindCUDA default CUDA_PROPAGATE_HOST_FLAGS to ON but we prefer OFF
# It happened -ffast-math from host caused numerical issue in CUDA kernels.
option(CUDA_PROPAGATE_HOST_FLAGS "Propagate C/CXX_FLAGS and friends to the host compiler via -Xcompile" OFF)
find_package(CUDA REQUIRED)
set(CUDA_LINK_LIBRARIES_KEYWORD PRIVATE)
#set(CUDA_NVCC_FLAGS
# "-arch=sm_20;-Drestrict=__restrict__;-DNO_CUDA_MAIN;-O3;-use_fast_math")
if(CUDA_NVCC_FLAGS MATCHES "arch")
# User defined NVCC flags
message(STATUS "Setting CUDA FLAGS=${CUDA_NVCC_FLAGS}")
else(CUDA_NVCC_FLAGS MATCHES "arch")
# Automatically set the default NVCC flags
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-Drestrict=__restrict__;-DNO_CUDA_MAIN;-std=c++14")
if(QMC_COMPLEX)
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-DQMC_COMPLEX=${QMC_COMPLEX}")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-g;-G")
else()
# Temporarily disable fast_math because it causes multiple test failures
# SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-O3;-use_fast_math")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-O3")
endif()
set(CUDA_ARCH
sm_70
CACHE STRING "CUDA architecture sm_XX")
set(CUDA_NVCC_FLAGS "-arch=${CUDA_ARCH};${CUDA_NVCC_FLAGS}")
endif(CUDA_NVCC_FLAGS MATCHES "arch")
include_directories(${CUDA_INCLUDE_DIRS})
if (CMAKE_VERSION VERSION_LESS 3.18.0)
message(FATAL_ERROR "QMC_CUDA or ENABLE_CUDA require CMake 3.18.0 or later")
endif()
# a few production machines use CUDA 10 which only supports C++14.
if(NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 14)
endif()
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
set(CMAKE_CUDA_EXTENSIONS OFF)
enable_language(CUDA)
find_package(CUDAToolkit REQUIRED)
# Automatically set the default NVCC flags
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Drestrict=__restrict__ -DNO_CUDA_MAIN")
if(QMC_COMPLEX)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -DQMC_COMPLEX=${QMC_COMPLEX}")
endif()
set(HAVE_CUDA 1)
message(" CUDA_NVCC_FLAGS=${CUDA_NVCC_FLAGS}")
endif(QMC_CUDA2HIP)
message("Project CUDA_FLAGS: ${CMAKE_CUDA_FLAGS}")
endif()
else(QMC_CUDA OR ENABLE_CUDA)
if(QMC_CUDA2HIP)
message(FATAL_ERROR "QMC_CUDA2HIP requires QMC_CUDA=ON or ENABLE_CUDA=ON.")
Expand Down
4 changes: 2 additions & 2 deletions config/build_olcf_summit.sh
Expand Up @@ -12,8 +12,8 @@ echo "Either source $BUILD_MODULES or load these same modules to run QMCPACK"

declare -A builds=( ["cpu"]=" -DQMC_MATH_VENDOR=IBM_MASS -DMASS_ROOT=/sw/summit/xl/16.1.1-10/xlmass/9.1.1" \
["complex_cpu"]="-DQMC_COMPLEX=1 -DQMC_MATH_VENDOR=IBM_MASS -DMASS_ROOT=/sw/summit/xl/16.1.1-10/xlmass/9.1.1" \
["legacy_gpu"]="-DQMC_CUDA=1 -DCUDA_ARCH=sm_70 " \
["complex_legacy_gpu"]="-DQMC_CUDA=1 -DQMC_COMPLEX=1 -DCUDA_ARCH=sm_70 " )
["legacy_gpu"]="-DQMC_CUDA=1 -DCMAKE_CUDA_ARCHITECTURES=70 " \
["complex_legacy_gpu"]="-DQMC_CUDA=1 -DQMC_COMPLEX=1 -DCMAKE_CUDA_ARCHITECTURES=70 " )

mkdir bin

Expand Down
26 changes: 19 additions & 7 deletions config/build_olcf_summit_Clang.sh
Expand Up @@ -32,28 +32,40 @@ module load llvm/main-20210811-cuda10.1
TYPE=Release
Compiler=Clang

source_folder=..
if [[ $# -eq 0 ]]; then
source_folder=`pwd`
else
source_folder=$1
fi

if [[ -f $source_folder/CMakeLists.txt ]]; then
echo Using QMCPACK source directory $source_folder
else
echo "Source directory $source_folder doesn't contain CMakeLists.txt. Pass QMCPACK source directory as the first argument."
exit
fi

for name in offload_cuda_real_MP offload_cuda_real offload_cuda_cplx_MP offload_cuda_cplx \
cpu_real_MP cpu_real cpu_cplx_MP cpu_cplx
do

CMAKE_FLAGS="-D CMAKE_BUILD_TYPE=$TYPE -D QMC_MATH_VENDOR=IBM_MASS -D MASS_ROOT=/sw/summit/xl/16.1.1-10/xlmass/9.1.1 -D MPIEXEC_EXECUTABLE=`which jsrun` -D MPIEXEC_NUMPROC_FLAG='-n' -D MPIEXEC_PREFLAGS='-c;16;-g;1;-b;packed:16;--smpiargs=off'"
CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$TYPE -DQMC_MATH_VENDOR=IBM_MASS -DMASS_ROOT=/sw/summit/xl/16.1.1-10/xlmass/9.1.1 -DMPIEXEC_EXECUTABLE=`which jsrun` -DMPIEXEC_NUMPROC_FLAG='-n' -DMPIEXEC_PREFLAGS='-c;16;-g;1;-b;packed:16;--smpiargs=off' -DCMAKE_CXX_STANDARD_LIBRARIES=/sw/summit/gcc/9.3.0-2/lib64/libstdc++.a"

if [[ $name == *"cplx"* ]]; then
CMAKE_FLAGS="$CMAKE_FLAGS -D QMC_COMPLEX=1"
CMAKE_FLAGS="$CMAKE_FLAGS -DQMC_COMPLEX=ON"
fi

if [[ $name == *"_MP"* ]]; then
CMAKE_FLAGS="$CMAKE_FLAGS -D QMC_MIXED_PRECISION=1"
CMAKE_FLAGS="$CMAKE_FLAGS -DQMC_MIXED_PRECISION=ON"
fi

if [[ $name == *"offload"* ]]; then
CMAKE_FLAGS="$CMAKE_FLAGS -D ENABLE_OFFLOAD=ON -D USE_OBJECT_TARGET=ON -DOFFLOAD_ARCH=sm_70"
CMAKE_FLAGS="$CMAKE_FLAGS -DENABLE_OFFLOAD=ON -DUSE_OBJECT_TARGET=ON -DOFFLOAD_ARCH=sm_70"
fi

if [[ $name == *"cuda"* ]]; then
CMAKE_FLAGS="$CMAKE_FLAGS -D ENABLE_CUDA=1 -D CUDA_ARCH=sm_70 -D CUDA_HOST_COMPILER=/usr/bin/gcc -D CUDA_NVCC_FLAGS='-Xcompiler;-mno-float128'"
CMAKE_FLAGS="$CMAKE_FLAGS -DENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=70 -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++"
CUDA_FLAGS="-Xcompiler -mno-float128"
fi

folder=build_summit_${Compiler}_${name}
Expand All @@ -64,7 +76,7 @@ echo "**********************************"
mkdir $folder
cd $folder
if [ ! -f CMakeCache.txt ] ; then
cmake $CMAKE_FLAGS -D CMAKE_C_COMPILER=mpicc -D CMAKE_CXX_COMPILER=mpicxx $source_folder
cmake $CMAKE_FLAGS -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_CUDA_FLAGS="$CUDA_FLAGS" $source_folder
cmake .
fi
make -j16
Expand Down

0 comments on commit 4042431

Please sign in to comment.