From 42d10e3950307537d4f2fa2116d6d01455f2452a Mon Sep 17 00:00:00 2001 From: Yuichi Motoyama Date: Fri, 25 Aug 2023 10:09:30 +0900 Subject: [PATCH 1/2] Update CONFIG=apple and add CI test on macOS-11 (#47) * test on macos * update * update * update * update * update * update * update * update --- .github/workflows/main.yml | 23 ++++++++++++++++++++--- config/apple.cmake | 12 ++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7d2322e3..fcedccb4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,16 +4,27 @@ on: [push] jobs: ctest: - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: ["ubuntu-22.04", "macos-11", "ubuntu-20.04"] + fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: apt + if: ${{ runner.os == 'Linux' }} run: | sudo apt update sudo apt install liblapack-dev openmpi-bin libopenmpi-dev libscalapack-openmpi-dev + - name: brew + if: ${{ runner.os == 'macOS' }} + run: | + brew install openmpi scalapack libomp + - name: pip run: | python -m pip install numpy @@ -26,7 +37,13 @@ jobs: working-directory: ${{runner.workspace}}/build shell: bash run: | - cmake -DCMAKE_VERBOSE_MAKEFILE=ON $GITHUB_WORKSPACE + if [ ${{ runner.os }} = "macOS" ] ; then + # CONFIG=apple requires gfortran but macOS runner has not, but gfortran-11, 12, ... + ln -s `which gfortran-11` gfortran + env PATH=`pwd`:$PATH HOMEBREW_PREFIX=/usr/local cmake -DCONFIG=apple -DCMAKE_VERBOSE_MAKEFILE=ON $GITHUB_WORKSPACE + else + cmake -DCMAKE_VERBOSE_MAKEFILE=ON $GITHUB_WORKSPACE + fi - name: build working-directory: ${{runner.workspace}}/build diff --git a/config/apple.cmake b/config/apple.cmake index 9b197129..73082407 100644 --- a/config/apple.cmake +++ b/config/apple.cmake @@ -1,15 +1,19 @@ # for Apple clang compiler # additional libomp and gfortran installation required # mac computers are suggested to use this configuration for better performance + +if(NOT $ENV{HOMEBREW_PREFIX}) + message(FATAL "Homebrew is not installed. Please install Homebrew first.") +endif() + set(CMAKE_C_COMPILER "clang" CACHE STRING "" FORCE) set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall -Wformat -Werror=format-security") set(CMAKE_C_FLAGS_RELEASE "-O3 -Wno-unknown-pragmas -Wno-logical-not-parentheses") -set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE) +# set(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "" FORCE) # OpenMP with libomp -set(CMAKE_EXE_LINKER_FLAGS "-L/usr/local/lib -lomp") -set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp" CACHE STRING "" FORCE) +set(CMAKE_EXE_LINKER_FLAGS "-L$ENV{HOMEBREW_PREFIX}/opt/libomp/lib -lomp") +set(OpenMP_C_FLAGS "-I$ENV{HOMEBREW_PREFIX}/opt/libomp/include -Xpreprocessor -fopenmp" CACHE STRING "" FORCE) set(OpenMP_C_LIB_NAMES "") set(CMAKE_OSX_SYSROOT "") - From a8b568667c54ed558fefbdfd59a324114e43d2d5 Mon Sep 17 00:00:00 2001 From: Yuichi Motoyama Date: Fri, 10 May 2024 11:25:33 +0900 Subject: [PATCH 2/2] update CI script (#56) * update CI script (macOS-latest, macOS-13) * update * OMP_NUM_THREADS=1 * set OMP=1 only for macos test * add scheduled CI --- .github/workflows/main.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fcedccb4..b49b05fe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,9 @@ name: CI -on: [push] +on: + push: + schedule: + - cron: '0 0 1,15 * *' # JST 9:00 on 1st and 15th every month jobs: ctest: @@ -8,11 +11,17 @@ jobs: strategy: matrix: - os: ["ubuntu-22.04", "macos-11", "ubuntu-20.04"] + os: ["ubuntu-22.04", "ubuntu-20.04", "macos-latest"] + ompsize: [1, 4] + exclude: + - os: "macos-latest" + ompsize: 4 # OMP on macOS is too slow fail-fast: false + env: + OMP_NUM_THREADS: ${{ matrix.ompsize }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: apt if: ${{ runner.os == 'Linux' }} @@ -25,9 +34,13 @@ jobs: run: | brew install openmpi scalapack libomp + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: pip run: | - python -m pip install numpy python3 -m pip install numpy - name: make workspace @@ -40,10 +53,12 @@ jobs: if [ ${{ runner.os }} = "macOS" ] ; then # CONFIG=apple requires gfortran but macOS runner has not, but gfortran-11, 12, ... ln -s `which gfortran-11` gfortran - env PATH=`pwd`:$PATH HOMEBREW_PREFIX=/usr/local cmake -DCONFIG=apple -DCMAKE_VERBOSE_MAKEFILE=ON $GITHUB_WORKSPACE + env PATH=`pwd`:$PATH cmake -DCONFIG=apple -DCMAKE_VERBOSE_MAKEFILE=ON $GITHUB_WORKSPACE else cmake -DCMAKE_VERBOSE_MAKEFILE=ON $GITHUB_WORKSPACE fi + env: + HOMEBREW_PREFIX: /opt/homebrew - name: build working-directory: ${{runner.workspace}}/build