Skip to content

Commit

Permalink
Merge pull request #23 from weslleyspereira/master
Browse files Browse the repository at this point in the history
Improve cmake.yml. Make targets in testBLAS compatible to other projects that include it
  • Loading branch information
weslleyspereira authored Aug 30, 2023
2 parents 1cc1842 + 6650674 commit 3693e5f
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 49 deletions.
83 changes: 48 additions & 35 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,23 @@ jobs:
repository: catchorg/Catch2
ref: 6e79e682b726f524310d55dec8ddac4e9c52fb5f # v3.4.0
path: Catch2

- name: Checkout BLAS++
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
repository: icl-utk-edu/blaspp
ref: f8f983d5b45a8f366aae41fbe9888b14cbae20f8 # v2023.08.25
path: blaspp

- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3

- name: Install Reference BLAS
run: sudo apt install libblas-dev liblapack-dev

- name: Checkout BLAS++
run: |
git clone https://bitbucket.org/weslleyspereira/blaspp ${{env.blaspp_DIR}}
- name: Build and install BLAS++
working-directory: ${{env.blaspp_DIR}}
run: |
git checkout tlapack
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -Dbuild_tests=OFF -DCMAKE_INSTALL_PREFIX=${{env.blaspp_DIR}}
cmake --build build --target install
Expand Down Expand Up @@ -148,18 +150,20 @@ jobs:
repository: catchorg/Catch2
ref: 6e79e682b726f524310d55dec8ddac4e9c52fb5f # v3.4.0
path: Catch2

- name: Checkout BLAS++
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
repository: icl-utk-edu/blaspp
ref: f8f983d5b45a8f366aae41fbe9888b14cbae20f8 # v2023.08.25
path: blaspp

- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3

- name: Checkout BLAS++
run: |
git clone https://github.com/icl-utk-edu/blaspp.git ${{env.blaspp_DIR}}
- name: Build and install BLAS++
working-directory: ${{env.blaspp_DIR}}
run: |
git checkout master
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -Dbuild_tests=OFF -DCMAKE_INSTALL_PREFIX=${{env.blaspp_DIR}}
cmake --build build --target install
Expand Down Expand Up @@ -198,10 +202,9 @@ jobs:
# add signed entry to apt sources and configure the APT client to use Intel repository:
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt update
- name: Install Intel oneAPI
timeout-minutes: 5
run: sudo apt install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-mkl
- name: Checkout testBLAS
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Checkout Catch2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
Expand All @@ -210,25 +213,28 @@ jobs:
ref: 6e79e682b726f524310d55dec8ddac4e9c52fb5f # v3.4.0
path: Catch2

- name: Checkout testBLAS
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Checkout BLAS++
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
repository: icl-utk-edu/blaspp
ref: f8f983d5b45a8f366aae41fbe9888b14cbae20f8 # v2023.08.25
path: blaspp

- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3

- name: Install Intel oneAPI
timeout-minutes: 5
run: sudo apt install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-mkl

- name: Setup Intel oneAPI environment
run: |
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
- name: Checkout BLAS++
run: |
git clone https://github.com/icl-utk-edu/blaspp.git ${{env.blaspp_DIR}}
- name: Build and install BLAS++
working-directory: ${{env.blaspp_DIR}}
run: |
git checkout master
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -Dbuild_tests=OFF -DCMAKE_INSTALL_PREFIX=${{env.blaspp_DIR}}
cmake --build build --target install
Expand Down Expand Up @@ -268,31 +274,36 @@ jobs:
repository: catchorg/Catch2
ref: 6e79e682b726f524310d55dec8ddac4e9c52fb5f # v3.4.0
path: Catch2

- name: Checkout BLAS++
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
repository: icl-utk-edu/blaspp
ref: f8f983d5b45a8f366aae41fbe9888b14cbae20f8 # v2023.08.25
path: blaspp

- name: Checkout LAPACK
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
repository: Reference-LAPACK/lapack
ref: 7866626840f5d5e7e27f027a55182da8b3303872 # v3.11.0
path: lapack

- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3

- name: Install BLIS
run: sudo apt install libblis-dev

- name: Checkout LAPACK
run: |
git clone https://github.com/Reference-LAPACK/lapack.git ${{env.lapack_DIR}}
- name: Build and install LAPACK
working-directory: ${{env.lapack_DIR}}
run: |
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -D CMAKE_INSTALL_PREFIX=${{env.lapack_DIR}} -D USE_OPTIMIZED_BLAS=ON -D BLA_VENDOR=FLAME
cmake --build build --target install
- name: Checkout BLAS++
run: |
git clone https://github.com/icl-utk-edu/blaspp.git ${{env.blaspp_DIR}}
- name: Build and install BLAS++
working-directory: ${{env.blaspp_DIR}}
run: |
git checkout master
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBLA_VENDOR=FLAME -Dbuild_tests=OFF -DCMAKE_INSTALL_PREFIX=${{env.blaspp_DIR}} -D CMAKE_CXX_FLAGS="${{env.CXXFLAGS}} -D LAPACK_FORTRAN_ADD_" -D LAPACK_LIBRARIES="${{env.lapack_DIR}}/lib/liblapack.a;-lgfortran"
cmake --build build --target install
Expand Down Expand Up @@ -329,21 +340,23 @@ jobs:
repository: catchorg/Catch2
ref: 6e79e682b726f524310d55dec8ddac4e9c52fb5f # v3.4.0
path: Catch2

- name: Checkout BLAS++
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
repository: icl-utk-edu/blaspp
ref: f8f983d5b45a8f366aae41fbe9888b14cbae20f8 # v2023.08.25
path: blaspp

- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@16b940825621068d98711680b6c3ff92201f8fc0 # v3

- name: Install OpenBLAS
run: sudo apt install libopenblas-dev

- name: Checkout BLAS++
run: |
git clone https://github.com/icl-utk-edu/blaspp.git ${{env.blaspp_DIR}}
- name: Build and install BLAS++
working-directory: ${{env.blaspp_DIR}}
run: |
git checkout master
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBLA_VENDOR=OpenBLAS -Dbuild_tests=OFF -DCMAKE_INSTALL_PREFIX=${{env.blaspp_DIR}}
cmake --build build --target install
Expand Down
30 changes: 16 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
#-------------------------------------------------------------------------------
# Packages

include(FetchContent)

# Load C++ BLAS wrappers
if( NOT TARGET ${TESTBLAS_BLAS} )
find_package( ${TESTBLAS_BLAS} REQUIRED )
Expand All @@ -69,12 +67,16 @@ endif()
#-------------------------------------------------------------------------------
# Targets

# corner-cases: Generate C++ file for tests with corner cases
add_custom_target( corner-cases
COMMAND
cd "${CMAKE_CURRENT_SOURCE_DIR}/scripts" &&
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/wrapper_tests.py"
> "${CMAKE_CURRENT_SOURCE_DIR}/src/test_corner_cases.cpp" )
if( PROJECT_IS_TOP_LEVEL )

# corner-cases: Generate C++ file for tests with corner cases
add_custom_target( corner-cases
COMMAND
cd "${CMAKE_CURRENT_SOURCE_DIR}/scripts" &&
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/wrapper_tests.py"
> "${CMAKE_CURRENT_SOURCE_DIR}/src/test_corner_cases.cpp" )

endif()

# Test sources
file( GLOB test_sources
Expand All @@ -83,17 +85,17 @@ file( GLOB test_sources
#-------------------------------------------------------------------------------
# tester: Program for tests

add_executable( tester ${test_sources} )
add_executable( testBLAS ${test_sources} )

target_include_directories( tester PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" )
target_link_libraries( tester PRIVATE Catch2::Catch2WithMain ${TESTBLAS_BLAS} )
target_include_directories( testBLAS PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" )
target_link_libraries( testBLAS PRIVATE Catch2::Catch2WithMain ${TESTBLAS_BLAS} )
if( TESTBLAS_BLAS STREQUAL "tlapack" )
target_compile_definitions( tester PRIVATE TESTBLAS_USE_TLAPACK )
target_compile_definitions( testBLAS PRIVATE TESTBLAS_USE_TLAPACK )
else()
target_compile_definitions( tester PRIVATE TESTBLAS_USE_BLASPP )
target_compile_definitions( testBLAS PRIVATE TESTBLAS_USE_BLASPP )
endif()

# Add tests to CTest
include(CTest)
include(Catch)
catch_discover_tests(tester)
catch_discover_tests(testBLAS)

0 comments on commit 3693e5f

Please sign in to comment.