Update c-cpp.yml with tests on macos #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: C/C++ CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build-and-test-linux: | |
runs-on: ubuntu-latest | |
env: | |
CXX: g++-10 | |
steps: | |
- uses: actions/checkout@master | |
- uses: seanmiddleditch/gha-setup-ninja@master # ninja | |
- name: install intel-mkl | |
#timeout-minutes: 5 | |
run: sudo apt install intel-mkl | |
#- name: install cuda | |
# run: | | |
# wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb | |
# sudo dpkg -i cuda-keyring_1.0-1_all.deb | |
# sudo apt-get update | |
# sudo apt-get -y install cuda | |
# #sudo apt install nvidia-cuda-toolkit | |
# echo "cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}" | |
# nvcc -V | |
# export CMAKE_CUDA_COMPILER=nvcc | |
- uses: Jimver/cuda-toolkit@v0.2.15 | |
id: cuda-toolkit | |
with: | |
cuda: '11.8.0' | |
- name: install cuda | |
run: | | |
echo "Installed cuda version is: ${{steps.cuda-toolkit.outputs.cuda}}" | |
echo "cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}" | |
nvcc -V | |
export CMAKE_CUDA_COMPILER=nvcc | |
- name: configure debug | |
run: cmake -G Ninja /home/runner/work/neoml/neoml/NeoML -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/home/runner/work/neoml/build.debug | |
- name: make debug | |
run: cmake --build . --target install | |
- name: configure release | |
run: cmake -G Ninja /home/runner/work/neoml/neoml/NeoML -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/runner/work/neoml/build.release | |
- name: make release | |
run: cmake --build . --target install | |
- name: test NeoMathEngine release CPU | |
run: | | |
cd /home/runner/work/neoml/build.release/bin | |
./NeoMathEngineFullTestDesktop --MathEngine=cpu | |
- name: test NeoML release CPU | |
run: | | |
cd /home/runner/work/neoml/build.release/bin | |
./NeoMLTest --MathEngine=cpu | |
- name: test NeoMathEngine release CUDA | |
run: | | |
cd /home/runner/work/neoml/build.release/bin | |
./NeoMathEngineFullTestDesktop --MathEngine=cuda | |
- name: test NeoML release CUDA | |
run: | | |
cd /home/runner/work/neoml/build.release/bin | |
./NeoMLTest --MathEngine=cuda | |
build-and-test-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: seanmiddleditch/gha-setup-ninja@master # ninja | |
- name: check gcc | |
run: gcc --version | |
- name: install gcc | |
run: | | |
brew install g++ | |
# link the selected version, but first try unlinking both | |
# without and with specified version (cover case in which | |
# multiple versions are already installed and/or linked) | |
brew unlink gcc | |
brew unlink gcc@${version} | |
brew link gcc@${version} | |
os_ver=$(sw_vers -productVersion | cut -d'.' -f1) | |
# default homebrew bin dir changed with macos 14 | |
if (( "$os_ver" > 13 )); then | |
ln -fs /opt/homebrew/bin/gfortran-${version} /usr/local/bin/gfortran | |
ln -fs /opt/homebrew/bin/gcc-${version} /usr/local/bin/gcc | |
ln -fs /opt/homebrew/bin/g++-${version} /usr/local/bin/g++ | |
else | |
ln -fs /usr/local/bin/gfortran-${version} /usr/local/bin/gfortran | |
ln -fs /usr/local/bin/gcc-${version} /usr/local/bin/gcc | |
ln -fs /usr/local/bin/g++-${version} /usr/local/bin/g++ | |
fi | |
export CC="gcc" | |
export CXX="g++" | |
- name: install intel-mkl | |
run: | | |
MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17426/m_BaseKit_p_2021.1.0.2427.dmg | |
MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17398/m_HPCKit_p_2021.1.0.2681.dmg | |
#MACOS_BASEKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17426/m_BaseKit_p_2021.1.0.2427.dmg | |
#MACOS_HPCKIT_URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17398/m_HPCKit_p_2021.1.0.2681.dmg | |
require_fetch | |
$fetch $MACOS_HPCKIT_URL > m_HPCKit.dmg | |
hdiutil attach m_HPCKit.dmg | |
sudo /Volumes/"$(basename "$MACOS_HPCKIT_URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s \ | |
--action install \ | |
--eula=accept \ | |
--continue-with-optional-error=yes \ | |
--log-dir=. | |
hdiutil detach /Volumes/"$(basename "$MACOS_HPCKIT_URL" .dmg)" -quiet | |
rm m_HPCKit.dmg | |
source /opt/intel/oneapi/setvars.sh | |
cat >> $GITHUB_ENV <<EOF | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH | |
LIBRARY_PATH=$LIBRARY_PATH | |
INFOPATH=$INFOPATH | |
MANPATH=$MANPATH | |
ONEAPI_ROOT=$ONEAPI_ROOT | |
CLASSPATH=$CLASSPATH | |
CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH | |
OCL_ICD_FILENAMES=$OCL_ICD_FILENAMES | |
INTEL_PYTHONHOME=$INTEL_PYTHONHOME | |
CPATH=$CPATH | |
SETVARS_COMPLETED=$SETVARS_COMPLETED | |
EOF | |
for path in ${PATH//:/ }; do | |
echo $path >> $GITHUB_PATH | |
done | |
- name: configure release | |
run: cmake -G Ninja /Users/runner/work/neoml/neoml/NeoML -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/Users/runner/work/neoml/build.release | |
- name: make release | |
run: cmake --build . --target install | |
- name: test NeoMathEngine release CPU | |
run: | | |
cd /Users/runner/work/neoml/build.release/bin | |
./NeoMathEngineFullTestDesktop --MathEngine=cpu | |
- name: test NeoML release CPU | |
run: | | |
cd /Users/runner/work/neoml/build.release/bin | |
./NeoMLTest --MathEngine=cpu | |