Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate workflows by OS #6

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
17 changes: 17 additions & 0 deletions .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Linux CI - oneMKL backend

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
workflow_dispatch:

jobs:
CI:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build oneMKL
run: |
docker build . --file Dockerfile.ci --tag onemkl_0.2
15 changes: 15 additions & 0 deletions .github/workflows/linux-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Linux Nightly - oneMKL backend

on:
schedule:
- cron: '00 7 * * 0,1,2,3,4,5,6'
workflow_dispatch:

jobs:
Nightly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build oneMKL
run: |
docker build . --file Dockerfile.nightly --tag onemkl_nightly_0.2:$(date +%Y%m%d)
75 changes: 75 additions & 0 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Windows CI - oneMKL backend

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

jobs:
CI:
runs-on: ["${{ matrix.os }}"]
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
matrix:
os: [windows-latest]
build_type: [Release]
include:
- os: windows-latest
cpp_compiler: icx

steps:
- name: Install oneMKL and Intel C++/DPC++ compiler
id: basekit-install
shell: cmd
run: |
curl -o C:\oneapi_installer.exe https://registrationcenter-download.intel.com/akdlm/IRC_NAS/f96c71db-2c6c-45d9-8c1f-0348ef5885cf/w_BaseKit_p_2023.2.0.49396_offline.exe
dir C:
call "C:\oneapi_installer.exe" -s -a --silent --eula accept --install-dir "C:\Program Files (x86)\Intel\oneAPI"

- name: Setup oneAPI environment
id: env-setup
shell: cmd
run: |
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
echo "oneapi_libpath=%LIBRARY_PATH%" >> "%GITHUB_ENV%"
echo "oneapi_path=%PATH%" >> "%GITHUB_ENV%"
echo "oneapi_cpath=%CPATH%" >> "%GITHUB_ENV%"
echo "oneapi_mklroot=%MKLROOT%" >> "%GITHUB_ENV%"

- uses: actions/checkout@v3
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

- uses: seanmiddleditch/gha-setup-ninja@master
- name: Configure and Build
id: build-step
env:
PATH: ${{ env.oneapi_path }}
CPATH: ${{ env.oneapi_cpath }}
LIBRARY_PATH: ${{ env.oneapi_libpath }}
LD_LIBRARY_PATH: ${{ env.oneapi_ld_libpath }}
MKLROOT: ${{ env.oneapi_mklroot }}
shell: cmd
run: |
${{ matrix.cpp_compiler }} --version
cmake -B ${{ steps.strings.outputs.build-output-dir }} -G "Ninja" -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBUILD_FUNCTIONAL_TESTS=OFF -S ${{ github.workspace }}
cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
# Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
shell: cmd
env:
PATH: ${{ env.oneapi_path }}
CPATH: ${{ env.oneapi_cpath }}
LIBRARY_PATH: ${{ env.oneapi_libpath }}
LD_LIBRARY_PATH: ${{ env.oneapi_ld_libpath }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# Github actions does not provide GPU-accelerated hosts, so run cpu only
run: ctest -V -R cpu --build-config ${{ matrix.build_type }}
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ else()
endif()

if(DEFINED REF_BLAS_ROOT)
find_file(REF_BLAS_LIBNAME NAMES blas.dll libblas.so HINTS ${REF_BLAS_ROOT} PATH_SUFFIXES lib lib64)
find_file(REF_CBLAS_LIBNAME NAMES cblas.dll libcblas.so HINTS ${REF_BLAS_ROOT} PATH_SUFFIXES lib lib64)
find_file(REF_BLAS_LIBNAME NAMES blas.dll libblas64.so HINTS ${REF_BLAS_ROOT} PATH_SUFFIXES lib lib64)
find_file(REF_CBLAS_LIBNAME NAMES cblas.dll libcblas64.so HINTS ${REF_BLAS_ROOT} PATH_SUFFIXES lib lib64)
endif()

# Add source directory and output to bin/
Expand Down
54 changes: 54 additions & 0 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#===============================================================================
# Copyright 2023 Intel Corporation
# Copyright (C) 2022 Heidelberg University, Engineering Mathematics and Computing Lab (EMCL) and Computing Centre (URZ)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions
# and limitations under the License.
#
#
# SPDX-License-Identifier: Apache-2.0
#===============================================================================

# Get oneAPI BaseKit image from the Docker Hub Intel repo
FROM intel/oneapi-basekit:2023.2.1-devel-ubuntu22.04 AS BACKEND_MKL

ARG DEBIAN_FRONTEND=noninteractive
ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1

# Make space in the docker image
RUN echo "Removing large directories"
# deleting 15GB
RUN rm -rf /usr/share/dotnet/
RUN df -h

RUN apt-get install -y gpg-agent
RUN wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg
RUN echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu focal main' | tee -a /etc/apt/sources.list.d/intel.list

# Install build essentials
RUN apt-get update -y && \
apt-get install -y -o=Dpkg::Use-Pty=0 \
cmake ninja-build

# Setup Working Directory
COPY . /home/oneMKL
RUN mkdir -p /home/oneMKL/BUILD
WORKDIR /home/oneMKL/BUILD

# Build
RUN cmake -G "Ninja" .. -DBUILD_FUNCTIONAL_TESTS=OFF -DCMAKE_CXX_COMPILER=icpx
RUN ninja

# Run cpu device only
# Known Intel GPU support issue in docker https://github.com/docker/cli/issues/2063.
# Test
RUN ctest -R cpu
61 changes: 61 additions & 0 deletions Dockerfile.nightly
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#===============================================================================
# Copyright 2023 Intel Corporation
# Copyright (C) 2022 Heidelberg University, Engineering Mathematics and Computing Lab (EMCL) and Computing Centre (URZ)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions
# and limitations under the License.
#
#
# SPDX-License-Identifier: Apache-2.0
#===============================================================================

# Get oneAPI BaseKit image from the Docker Hub Intel repo
FROM intel/oneapi-basekit:2023.2.1-devel-ubuntu22.04 AS BACKEND_MKL

ARG DEBIAN_FRONTEND=noninteractive
ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
ARG NETLIB_VERSION_TAG=3.11.0

# Make space in the docker image
RUN echo "Removing large directories"
# deleting 15GB
RUN rm -rf /usr/share/dotnet/
RUN df -h

# Install build essentials
RUN apt-get update -y && \
apt-get install -y -o=Dpkg::Use-Pty=0 \
cmake ninja-build gcc gfortran

# Setup Reference BLAS and LAPACK Implementation for functional testing
RUN mkdir -p /home/Reference-LAPACK
WORKDIR /home/Reference-LAPACK
RUN wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v${NETLIB_VERSION_TAG}.tar.gz && tar -xf v${NETLIB_VERSION_TAG}.tar.gz

# Build Reference BLAS and LAPACK
WORKDIR /home/Reference-LAPACK/lapack-${NETLIB_VERSION_TAG}/BUILD
RUN cmake -G "Ninja" -DBUILD_INDEX64=ON -DCBLAS=ON -DLAPACKE=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_LIBDIR=/home/Reference-LAPACK/OUTPUT/lib ..
RUN ninja install

# Setup Working Directory
COPY . /home/oneMKL
RUN mkdir -p /home/oneMKL/BUILD
WORKDIR /home/oneMKL/BUILD

# Build
RUN cmake -G "Ninja" .. -DBUILD_EXAMPLES=OFF -DCMAKE_CXX_COMPILER=icpx -DREF_BLAS_ROOT=/home/Reference-LAPACK/OUTPUT -DREF_LAPACK_ROOT=/home/Reference-LAPACK/OUTPUT
RUN ninja

# Run cpu device only
# Known Intel GPU support issue in docker https://github.com/docker/cli/issues/2063.
# Test
RUN ctest -R cpu
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# oneAPI Math Kernel Library (oneMKL) Interfaces

|Linux|Windows
|---|---|
|[![oneMKL backend](https://github.com/virajmalia/oneMKL/actions/workflows/linux-ci.yml/badge.svg)](https://github.com/virajmalia/oneMKL/actions/workflows/linux-ci.yml)|[![oneMKL backend](https://github.com/virajmalia/oneMKL/actions/workflows/windows-ci.yml/badge.svg)](https://github.com/virajmalia/oneMKL/actions/workflows/windows-ci.yml)|

<img align="left" src="https://spec.oneapi.io/oneapi-logo-white-scaled.jpg" alt="oneAPI logo">

oneMKL Interfaces is an open-source implementation of the oneMKL Data Parallel C++ (DPC++) interface according to the [oneMKL specification](https://spec.oneapi.com/versions/latest/elements/oneMKL/source/index.html). It works with multiple devices (backends) using device-specific libraries underneath.
Expand Down
6 changes: 1 addition & 5 deletions tests/unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
# SPDX-License-Identifier: Apache-2.0
#===============================================================================

if("blas" IN_LIST TARGET_DOMAINS)
find_package(CBLAS REQUIRED)
endif()

if("lapack" IN_LIST TARGET_DOMAINS)
if("blas" IN_LIST TARGET_DOMAINS OR "lapack" IN_LIST TARGET_DOMAINS)
find_package(LAPACKE REQUIRED)
endif()

Expand Down