From e77653a9d15437d5ec2798d691f59302c538ee81 Mon Sep 17 00:00:00 2001
From: Diogo <dgcruz983@gmail.com>
Date: Fri, 8 Sep 2023 11:07:53 -0400
Subject: [PATCH] ci : add CLBlast build (#513)

* added clblast test to ci

* moved threads to env

* changed name

* upgraded checkout to v3
---
 .github/workflows/ci.yml | 40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e635257c1..06ec47f67 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,6 +7,44 @@ on:
     branches: [ master ]
 
 jobs:
+  test-ubuntu-opencl:
+    runs-on: ubuntu-latest
+    env:
+      GGML_NLOOP: 3
+      GGML_NITER: 1
+      GGML_N_THREADS: 2
+
+    steps:
+    - uses: actions/checkout@v3
+
+    - name: Dependencies
+      run: |
+        wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
+        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-get update
+        sudo apt-get install -y --no-install-recommends llvm intel-oneapi-runtime-opencl intel-oneapi-runtime-compilers libclblast-dev
+    - name: Create Build Environment
+      run: mkdir build
+
+    - name: Configure CMake
+      working-directory: ./build
+      run: cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DGGML_TEST_COVERAGE=ON -DGGML_CLBLAST=ON ..
+
+    - name: Build
+      working-directory: ./build
+      run: make
+
+    - name: Test
+      working-directory: ./build
+      run: ctest --verbose --timeout 900
+
+    - name: Test Coverage
+      working-directory: ./build
+      run: |
+        llvm-profdata merge -sparse tests/*.profraw -o ggml.profdata
+        llvm-cov      report ./bin/test-grad0 -instr-profile=ggml.profdata
+        llvm-cov      report ./bin/test-opt   -instr-profile=ggml.profdata
+
   build:
 
     strategy:
@@ -20,7 +58,7 @@ jobs:
       GGML_NITER: 1
 
     steps:
-    - uses: actions/checkout@v2
+    - uses: actions/checkout@v3
 
     - name: Dependencies for Ubuntu
       if: matrix.os == 'ubuntu-latest'