Skip to content

Commit

Permalink
Merge pull request #26 from AdhocMan/update_test_dependencies
Browse files Browse the repository at this point in the history
update test dependencies
  • Loading branch information
AdhocMan authored Mar 17, 2024
2 parents 1277f6c + ca2174b commit 62790dd
Show file tree
Hide file tree
Showing 13 changed files with 364 additions and 120 deletions.
43 changes: 23 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@ jobs:
#########################
build-test-gcc-cpu:
# The type of runner that the job will run on
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make g++ libopenblas-dev libscalapack-mpi-dev wget git make
cd ${HOME} && wget https://github.com/Kitware/CMake/releases/download/v3.11.4/cmake-3.11.4-Linux-x86_64.tar.gz && tar -xzvf cmake-3.11.4-Linux-x86_64.tar.gz
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC sudo apt-get install -y make g++ libopenblas-dev libscalapack-mpi-dev wget git make cmake
- name: Build
run: |
cd ${GITHUB_WORKSPACE}
mkdir -p build
cd build
${HOME}/cmake-3.11.4-Linux-x86_64/bin/cmake .. -DSPLA_BUILD_TESTS=ON
cmake .. -DSPLA_BUILD_TESTS=ON
make -j2
- name: Run tests
Expand All @@ -43,24 +42,23 @@ jobs:
###########################
build-test-clang-cpu:
# The type of runner that the job will run on
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make clang libopenblas-dev libscalapack-mpi-dev wget git make
cd ${HOME} && wget https://github.com/Kitware/CMake/releases/download/v3.11.4/cmake-3.11.4-Linux-x86_64.tar.gz && tar -xzvf cmake-3.11.4-Linux-x86_64.tar.gz
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC sudo apt-get install -y make clang libopenblas-dev libscalapack-mpi-dev wget git make cmake
- name: Build
run: |
cd ${GITHUB_WORKSPACE}
mkdir -p build
cd build
CXX=clang++ ${HOME}/cmake-3.11.4-Linux-x86_64/bin/cmake .. -DSPLA_BUILD_TESTS=ON -DSPLA_OMP=OFF
CXX=clang++ cmake .. -DSPLA_BUILD_TESTS=ON -DSPLA_OMP=OFF
make -j2
- name: Run tests
Expand All @@ -78,43 +76,48 @@ jobs:
# Build with CUDA
#################
build-cuda:
runs-on: ubuntu-latest
container: nvidia/cuda:9.2-devel-ubuntu18.04
runs-on: ubuntu-22.04
container: nvidia/cuda:11.0.3-devel-ubuntu20.04

steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install dependencies
run: |
apt-get update
apt-get install -y make g++ libopenblas-dev libscalapack-mpi-dev wget git make
cd ${HOME} && wget https://github.com/Kitware/CMake/releases/download/v3.11.4/cmake-3.11.4-Linux-x86_64.tar.gz && tar -xzvf cmake-3.11.4-Linux-x86_64.tar.gz
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y make g++ libopenblas-dev libscalapack-mpi-dev wget git make
cd ${HOME} && wget https://github.com/Kitware/CMake/releases/download/v3.14.1/cmake-3.14.1-Linux-x86_64.tar.gz && tar -xzvf cmake-3.14.1-Linux-x86_64.tar.gz
- name: Build
run: |
cd ${GITHUB_WORKSPACE}
mkdir -p build
cd build
${HOME}/cmake-3.11.4-Linux-x86_64/bin/cmake .. -DSPLA_BUILD_TESTS=ON -DSPLA_GPU_BACKEND=CUDA
${HOME}/cmake-3.14.1-Linux-x86_64/bin/cmake .. -DSPLA_BUILD_TESTS=ON -DSPLA_GPU_BACKEND=CUDA
make -j2
#################
# Build with ROCm
#################
build-rocm:
runs-on: ubuntu-latest
container: adhocman/master:ubuntu18.04_rocm
runs-on: ubuntu-22.04
container: rocm/dev-ubuntu-22.04:5.6-complete

steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install dependencies
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y make g++ libopenblas-dev libscalapack-mpi-dev wget git make cmake
- name: Build
run: |
cd ${GITHUB_WORKSPACE}
mkdir -p build
cd build
/root/cmake-3.11.4-Linux-x86_64/bin/cmake .. -DSPLA_BUILD_TESTS=ON -DSPLA_GPU_BACKEND=ROCM -DCMAKE_PREFIX_PATH="/opt/rocm;/opt/rocm/hip"
cmake .. -DSPLA_BUILD_TESTS=ON -DSPLA_GPU_BACKEND=ROCM -DCMAKE_PREFIX_PATH="/opt/rocm;/opt/rocm/hip"
make -j2
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(spla LANGUAGES CXX VERSION 1.5.4)
project(spla LANGUAGES CXX VERSION 1.5.5)
set(SPLA_SO_VERSION 1)
set(SPLA_VERSION ${PROJECT_VERSION})

Expand All @@ -26,6 +26,7 @@ set(CMAKE_CXX_STANDARD 11)

# Get GNU standard install prefixes
include(GNUInstallDirs)
include(CMakeDependentOption)

#add local module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/modules)
Expand All @@ -37,6 +38,10 @@ option(SPLA_BUILD_TESTS "Build tests" OFF)
option(SPLA_BUILD_EXAMPLES "Compile examples" OFF)
option(SPLA_INSTALL "Enable CMake install commands" ON)
option(SPLA_FORTRAN "Compile fortran module" OFF)
option(SPLA_BUNDLED_TEST_LIBS "Use bundled libraries for building tests" ON)

cmake_dependent_option(SPLA_BUNDLED_GOOGLETEST "Use bundled googletest lib" ON "SPLA_BUNDLED_TEST_LIBS" OFF)
cmake_dependent_option(SPLA_BUNDLED_CLI11 "Use bundled cli11 lib" ON "SPLA_BUNDLED_TEST_LIBS" OFF)

set(SPLA_GPU_BACKEND "OFF" CACHE STRING "GPU backend")
set_property(CACHE SPLA_GPU_BACKEND PROPERTY STRINGS
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ make -j8 install
```

### CMake options
| Option | Values | Default | Description |
|-----------------------|----------------------------------------------------------|---------|--------------------------------------------------|
| SPLA_OMP | ON, OFF | ON | Enable multi-threading with OpenMP |
| SPLA_HOST_BLAS | AUTO, MKL, OPENBLAS, BLIS, CRAY_LIBSCI, ATLAS, GENERIC | AUTO | BLAS library for computations on host |
| SPLA_GPU_BACKEND | OFF, CUDA, ROCM | OFF | Select GPU backend |
| SPLA_BUILD_TESTS | ON, OFF | OFF | Build test executables |
| SPLA_BUILD_EXAMPLES | ON, OFF | OFF | Build examples |
| SPLA_INSTALL | ON, OFF | ON | Add library to install target |
| SPLA_FORTRAN | ON, OFF | OFF | Build Fortan module |
| Option | Values | Default | Description |
|------------------------|----------------------------------------------------------|---------|--------------------------------------------------|
| SPLA_OMP | ON, OFF | ON | Enable multi-threading with OpenMP |
| SPLA_HOST_BLAS | AUTO, MKL, OPENBLAS, BLIS, CRAY_LIBSCI, ATLAS, GENERIC | AUTO | BLAS library for computations on host |
| SPLA_GPU_BACKEND | OFF, CUDA, ROCM | OFF | Select GPU backend |
| SPLA_BUILD_TESTS | ON, OFF | OFF | Build test executables |
| SPLA_BUNDLED_TEST_LIBS | ON, OFF | ON | Download libraries required for tests |
| SPLA_BUILD_EXAMPLES | ON, OFF | OFF | Build examples |
| SPLA_INSTALL | ON, OFF | ON | Add library to install target |
| SPLA_FORTRAN | ON, OFF | OFF | Build Fortan module |

## Implementation Details
The implementation is based on a ring communication pattern as described in the paper [Accelerating large-scale excited-state GW calculations on leadership HPC systems](https://dl.acm.org/doi/10.5555/3433701.3433706) by Mauro Del Ben Et Al. For distributed matrix-matrix multiplications with distributions as used in the `pgemm_ssb` function, each process contributes to the result of every element. Therefore, some form of reduction operation is required. Compared to other reduction schemes, a ring requires more communication volume. However, by splitting up the result and computing multiple reductions concurrently, all processes share the work load at every step and more opportunities for communication - computation overlap arise.
Expand Down
75 changes: 33 additions & 42 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,52 +1,41 @@
cmake_minimum_required(VERSION 3.11 FATAL_ERROR) # git fetch module requires at least 3.11
cmake_minimum_required(VERSION 3.14 FATAL_ERROR) # FetchContent_MakeAvailable requires at least 3.14
set(SPLA_TEST_LIBRARIES)
set(SPLA_TEST_INCLUDE_DIRS)

# update time stamps when using FetchContent
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()

set(BUILD_GMOCK OFF CACHE BOOL "")
set(INSTALL_GTEST OFF CACHE BOOL "")
mark_as_advanced(BUILD_GMOCK INSTALL_GTEST)
include(FetchContent)

# add googletest
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.1
)
FetchContent_GetProperties(googletest)
if(NOT googletest_POPULATED)
message(STATUS "Downloading Google Test repository...")
FetchContent_Populate(googletest)
if(SPLA_BUNDLED_GOOGLETEST)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz
URL_MD5 95b29f0038ec84a611df951d74d99897
)
FetchContent_MakeAvailable(googletest)
else()
find_package(googletest CONFIG REQUIRED)
endif()
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
list(APPEND SPLA_TEST_LIBRARIES gtest_main)

# add gtest_mpi
FetchContent_Declare(
gtest_mpi
GIT_REPOSITORY https://github.com/AdhocMan/gtest_mpi.git
GIT_TAG v1.0.0
)
FetchContent_GetProperties(gtest_mpi)
if(NOT gtest_mpi_POPULATED)
message(STATUS "Downloading Google Test MPI extension repository...")
FetchContent_Populate(gtest_mpi)
endif()
add_subdirectory(${gtest_mpi_SOURCE_DIR} ${gtest_mpi_BINARY_DIR})
list(APPEND SPLA_TEST_LIBRARIES gtest_mpi)

# add command line parser
FetchContent_Declare(
cli11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG v1.7.1
)
FetchContent_GetProperties(cli11)
if(NOT cli11_POPULATED)
message(STATUS "Downloading CLI11 command line parser repository...")
FetchContent_Populate(cli11)
if(SPLA_BUNDLED_CLI11)
FetchContent_Declare(
cli11
URL https://github.com/CLIUtils/CLI11/archive/refs/tags/v2.3.2.tar.gz
URL_MD5 b80cb645dee25982110b068b426363ff
)
FetchContent_MakeAvailable(cli11)
else()
find_package(CLI11 CONFIG REQUIRED)
endif()
list(APPEND SPLA_TEST_INCLUDE_DIRS ${cli11_SOURCE_DIR}/include)
list(APPEND SPLA_TEST_LIBRARIES CLI11::CLI11)


if(SPLA_BLAS_MKL)
Expand All @@ -69,20 +58,22 @@ endif()
if(UNIX AND NOT APPLE)
# on Daint, dl library appears to be required
find_library(SPLA_DL_LIBRARY dl)
list(APPEND SPLA_TEST_LIBRARIES ${SPLA_DL_LIBRARY})
if(SPLA_DL_LIBRARY)
list(APPEND SPLA_TEST_LIBRARIES ${SPLA_DL_LIBRARY})
endif()
endif()

add_executable(run_tests programs/run_tests.cpp test_pool_allocator.cpp test_gemm.cpp test_gemm_ssb.cpp test_gemm_sbs.cpp)
add_executable(run_tests programs/run_tests.cpp test_pool_allocator.cpp test_gemm.cpp test_gemm_ssb.cpp test_gemm_sbs.cpp gtest_mpi.cpp)
target_link_libraries(run_tests PUBLIC spla_test ${SPLA_EXTERNAL_LIBS} ${SPLA_TEST_LIBRARIES})
target_include_directories(run_tests PUBLIC ${SPLA_INCLUDE_DIRS} ${SPLA_EXTERNAL_INCLUDE_DIRS} ${SPLA_TEST_INCLUDE_DIRS})
target_include_directories(run_tests PUBLIC ${SPLA_INCLUDE_DIRS} ${SPLA_EXTERNAL_INCLUDE_DIRS} ${CMAKE_CURRENT_LIST_DIR})
target_compile_options(run_tests PRIVATE ${SPLA_DEFINITIONS} ${SPLA_EXTERNAL_COMPILE_OPTIONS})

add_executable(benchmark programs/benchmark.cpp)
target_link_libraries(benchmark PUBLIC spla_test ${SPLA_EXTERNAL_LIBS})
target_include_directories(benchmark PUBLIC ${SPLA_INCLUDE_DIRS} ${SPLA_EXTERNAL_INCLUDE_DIRS} ${SPLA_TEST_INCLUDE_DIRS})
target_link_libraries(benchmark PUBLIC spla_test ${SPLA_EXTERNAL_LIBS} ${SPLA_TEST_LIBRARIES})
target_include_directories(benchmark PUBLIC ${SPLA_INCLUDE_DIRS} ${SPLA_EXTERNAL_INCLUDE_DIRS})
target_compile_options(benchmark PRIVATE ${SPLA_DEFINITIONS} ${SPLA_EXTERNAL_COMPILE_OPTIONS})

add_executable(benchmark_scalapack programs/benchmark_scalapack.cpp)
target_link_libraries(benchmark_scalapack PUBLIC spla_test ${SPLA_EXTERNAL_LIBS} ${SPLA_TEST_LIBRARIES})
target_include_directories(benchmark_scalapack PUBLIC ${SPLA_INCLUDE_DIRS} ${SPLA_EXTERNAL_INCLUDE_DIRS} ${SPLA_TEST_INCLUDE_DIRS})
target_include_directories(benchmark_scalapack PUBLIC ${SPLA_INCLUDE_DIRS} ${SPLA_EXTERNAL_INCLUDE_DIRS})
target_compile_options(benchmark_scalapack PRIVATE ${SPLA_DEFINITIONS} ${SPLA_EXTERNAL_COMPILE_OPTIONS})
Loading

0 comments on commit 62790dd

Please sign in to comment.