From 627f1394d17e5e4284f9e447838893d726f34264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Mon, 13 Oct 2025 17:06:16 +0800 Subject: [PATCH] fix(tests): wait out-of-loop --- .github/workflows/test.yml | 29 ++++++++++++++++++++++++----- tests/basic.cpp | 24 ++++++++++++------------ 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f35a2e..17e200b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,12 +44,31 @@ jobs: # Install Visual Studio Build Tools and CMake choco install cmake visualstudio2022buildtools visualstudio2022-workload-vctools -y - # Download and install Intel oneAPI - 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 + # Download and install Intel oneAPI Base Toolkit using the web installer + $url = "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/d91caaa0-7306-46ea-a519-79a0423e1903/w_BaseKit_p_2024.2.1.101_offline.exe" + $installer = "oneapi_installer.exe" - # List installed Files - ls "C:\Program Files (x86)\Intel\oneAPI" + Write-Host "Downloading Intel oneAPI Base Toolkit..." + Invoke-WebRequest -Uri $url -OutFile $installer -UseBasicParsing + + if (Test-Path $installer) { + Write-Host "Installer downloaded successfully" + Write-Host "Installing Intel oneAPI Base Toolkit..." + Start-Process -FilePath $installer -ArgumentList "--silent", "--eula", "accept", "--components", "intel.oneapi.win.dpcpp-compiler" -Wait + Write-Host "Installation completed" + } else { + Write-Error "Failed to download installer" + exit 1 + } + + # Verify installation + if (Test-Path "C:\Program Files (x86)\Intel\oneAPI") { + Write-Host "oneAPI installation verified" + Get-ChildItem "C:\Program Files (x86)\Intel\oneAPI" | Format-Table Name + } else { + Write-Error "oneAPI installation failed" + exit 1 + } - name: Build and Run Tests shell: cmd diff --git a/tests/basic.cpp b/tests/basic.cpp index 96db315..a3d2e4b 100644 --- a/tests/basic.cpp +++ b/tests/basic.cpp @@ -85,11 +85,11 @@ int main() { // test basic parallel kernel start_time = std::chrono::high_resolution_clock::now(); auto errn = base16384::errors::try_failed([&]() { - for (int j = 0; j < iter_count; j++) { - q.parallel_for(sycl::range<1>(N), - [=](sycl::id<1> i) { data[i] = base16384::test::kernels_basic(data[i]); }); - } - q.wait(); + q.parallel_for(sycl::range<1>(N), [=](sycl::id<1> i) { + for (int j = 0; j < iter_count; j++) { + data[i] = base16384::test::kernels_basic(data[i]); + } + }).wait(); }); end_time = std::chrono::high_resolution_clock::now(); duration = std::chrono::duration_cast(end_time - start_time); @@ -115,14 +115,14 @@ int main() { start_time = std::chrono::high_resolution_clock::now(); errn = base16384::errors::try_failed([&]() { - for (int j = 0; j < iter_count; j++) { - q.parallel_for(sycl::nd_range<1>(N, work_group_size), - [=](sycl::nd_item<1> item) { // sub-group size - const auto i = item.get_global_id(0); + q.parallel_for(sycl::nd_range<1>(N, work_group_size), + [=](sycl::nd_item<1> item) { // sub-group size + const auto i = item.get_global_id(0); + for (int j = 0; j < iter_count; j++) { data[i] = base16384::test::kernels_basic(data[i]); - }); - } - q.wait(); + } + }) + .wait(); }); end_time = std::chrono::high_resolution_clock::now(); duration = std::chrono::duration_cast(end_time - start_time);