mirror of
https://github.com/fumiama/base16384-sycl.git
synced 2026-06-28 16:50:27 +08:00
feat: add -DBUILD=test & test CI
This commit is contained in:
47
.github/workflows/test.yml
vendored
Normal file
47
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
name: test
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test_ubuntu:
|
||||||
|
name: Run CMake Test on Ubuntu (oneAPI) 🧪
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Build Tools
|
||||||
|
run: |
|
||||||
|
# download the key to system keyring
|
||||||
|
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
|
||||||
|
|
||||||
|
# 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-get update
|
||||||
|
sudo apt-get install -y intel-basekit cmake
|
||||||
|
|
||||||
|
- name: Build and Run Tests
|
||||||
|
run: |
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD=test ..
|
||||||
|
cmake --build . || ctest --output-on-failure
|
||||||
|
|
||||||
|
test_windows:
|
||||||
|
name: Run CMake Test on Windows (MSVC) 🧪
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Build Tools
|
||||||
|
run: |
|
||||||
|
Invoke-WebRequest -Uri "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/f5881e61-dcdc-40f1-9bd9-717081ac623c/intel-oneapi-base-toolkit-2025.2.1.46_offline.exe" -OutFile "install.exe"
|
||||||
|
./install.exe -s -a --silent --eula accept
|
||||||
|
|
||||||
|
- name: Build and Run Tests
|
||||||
|
run: |
|
||||||
|
mkdir build
|
||||||
|
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ..
|
||||||
|
cmake --build .; if ($?) { ctest --output-on-failure }
|
||||||
@@ -70,9 +70,11 @@ endif()
|
|||||||
add_subdirectory(libs)
|
add_subdirectory(libs)
|
||||||
message(STATUS "Collected libs: ${B14LIBS}")
|
message(STATUS "Collected libs: ${B14LIBS}")
|
||||||
|
|
||||||
enable_testing()
|
if (BUILD STREQUAL "test")
|
||||||
add_subdirectory(tests)
|
enable_testing()
|
||||||
message(STATUS "Collected tests: ${B14TESTS}")
|
add_subdirectory(tests)
|
||||||
|
message(STATUS "Collected tests: ${B14TESTS}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
foreach(TARGET_NAME ${B14TESTS})
|
foreach(TARGET_NAME ${B14TESTS})
|
||||||
target_link_libraries(${TARGET_NAME} ${B14LIBS})
|
target_link_libraries(${TARGET_NAME} ${B14LIBS})
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -39,8 +39,7 @@ Base16384-SYCL is an optimized implementation of the [Base16384 encoding algorit
|
|||||||
|
|
||||||
### 1. Environment Setup
|
### 1. Environment Setup
|
||||||
|
|
||||||
> [!Tip]
|
> [!Tip] > **For VS Code Users**: If you're using Visual Studio Code, the environment variable setup commands will be executed automatically when you open a terminal. If this fails, it may be due to a non-standard installation path. Please modify the paths in `.vscode/settings.json` accordingly.
|
||||||
> **For VS Code Users**: If you're using Visual Studio Code, the environment variable setup commands will be executed automatically when you open a terminal. If this fails, it may be due to a non-standard installation path. Please modify the paths in `.vscode/settings.json` accordingly.
|
|
||||||
|
|
||||||
**Windows:**
|
**Windows:**
|
||||||
|
|
||||||
@@ -71,9 +70,16 @@ cd build
|
|||||||
|
|
||||||
**Configure the build system:**
|
**Configure the build system:**
|
||||||
|
|
||||||
```cmd
|
> Add `-DBUILD=test` to enable testing.
|
||||||
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
```
|
- Windows
|
||||||
|
```cmd
|
||||||
|
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ..
|
||||||
|
```
|
||||||
|
- Unix-Like
|
||||||
|
```sh
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||||
|
```
|
||||||
|
|
||||||
**Compile the project:**
|
**Compile the project:**
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ set(LOCAL_B14LIBS "")
|
|||||||
foreach(CPP_FILE ${CPP_FILES})
|
foreach(CPP_FILE ${CPP_FILES})
|
||||||
# name without .cpp
|
# name without .cpp
|
||||||
get_filename_component(TARGET_NAME ${CPP_FILE} NAME_WE)
|
get_filename_component(TARGET_NAME ${CPP_FILE} NAME_WE)
|
||||||
|
|
||||||
|
# Skip test files if BUILD is not "test"
|
||||||
|
if(NOT BUILD STREQUAL "test" AND TARGET_NAME MATCHES "^test_")
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
|
||||||
message(STATUS "Add CPP lib: ${TARGET_NAME}")
|
message(STATUS "Add CPP lib: ${TARGET_NAME}")
|
||||||
add_library(${TARGET_NAME} STATIC ${CPP_FILE})
|
add_library(${TARGET_NAME} STATIC ${CPP_FILE})
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sycl/sycl.hpp>
|
#include <sycl/sycl.hpp>
|
||||||
|
|
||||||
#include "test.hpp"
|
#include "test/kernels.hpp"
|
||||||
|
|
||||||
SYCL_EXTERNAL std::uint8_t base16384::test::kernels_basic(uint8_t in) {
|
SYCL_EXTERNAL std::uint8_t base16384::test::kernels_basic(uint8_t in) {
|
||||||
in *= in;
|
in *= in;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "errors.hpp"
|
#include "errors.hpp"
|
||||||
#include "test.hpp"
|
#include "test/kernels.hpp"
|
||||||
#include "xeinfo.hpp"
|
#include "xeinfo.hpp"
|
||||||
|
|
||||||
constexpr int iter_count = 65536;
|
constexpr int iter_count = 65536;
|
||||||
|
|||||||
Reference in New Issue
Block a user