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

fixes for Windows #8

Open
wants to merge 9 commits into
base: external-mem-sample
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,17 @@ jobs:
fetch-depth: 0
submodules: recursive

- name: Install samples dependencies
run: |
if [[ "${{ matrix.BIN }}" == "64" ]]; then
apt-get update -qq;
apt-get install -y libvulkan-dev;
else
dpkg --add-architecture i386;
apt-get update -qq;
apt-get install -y libvulkan-dev:i386;
fi

- name: Configure, package & install OpenCL-Headers
run: $CMAKE_EXE
-G "${{matrix.CONF.GEN}}"
Expand Down Expand Up @@ -400,6 +411,8 @@ jobs:
INTEL_OCL_URL: https://github.com/intel/llvm/releases/download/2023-WW27/win-oclcpuexp-2023.16.6.0.28_rel.zip
INTEL_TBB_URL: https://github.com/oneapi-src/oneTBB/releases/download/v2021.10.0/oneapi-tbb-2021.10.0-win.zip
IMAGE_INTEL_PREFIX: C:\Tools\Intel
VULKAN_SDK_URL: https://sdk.lunarg.com/sdk/download/1.3.261.1/windows/VulkanSDK-1.3.261.1-Installer.exe
VULKAN_SDK: C:/VulkanSDK/1.3.261.1

steps:
- name: Cache Ninja install
Expand Down Expand Up @@ -436,6 +449,18 @@ jobs:
New-Item -Type File HKLM:\SOFTWARE\Khronos\OpenCL\Vendors | Out-Null; `
Set-ItemProperty -Path HKLM:\SOFTWARE\Khronos\OpenCL\Vendors -Name ${env:IMAGE_INTEL_PREFIX}\oclcpuexp\intelocl64.dll -Type DWord -Value 0;

- name: Install samples dependencies
run: |
Invoke-WebRequest ${env:VULKAN_SDK_URL} -OutFile vulkan-sdk-installer.exe
.\vulkan-sdk-installer.exe --accept-licenses --default-answer --confirm-command install com.lunarg.vulkan.32bit
Remove-Item vulkan-sdk-installer.exe
if ('${{ matrix.BIN }}' -eq 'x64')
{
echo "Vulkan_LIB_DIR=$env:VULKAN_SDK/Lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} else {
echo "Vulkan_LIB_DIR=$env:VULKAN_SDK/Lib32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}

- name: Cache dependencies (vcpkg)
if: matrix.DEPS == 'vcpkg'
id: vcpkg-install
Expand Down Expand Up @@ -480,6 +505,8 @@ jobs:
-D CMAKE_C_STANDARD=${{matrix.STD.C}} `
-D CMAKE_CXX_STANDARD=${{matrix.STD.CXX}} `
-D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\install `
-D Vulkan_INCLUDE_DIR=${env:VULKAN_SDK}/Include `
-D Vulkan_LIBRARY=${env:Vulkan_LIB_DIR}/vulkan-1.lib `
-S ${env:GITHUB_WORKSPACE} `
-B ${env:GITHUB_WORKSPACE}\build
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-SDK failed." }
Expand Down Expand Up @@ -508,6 +535,8 @@ jobs:
-D CMAKE_CXX_STANDARD=${{matrix.STD.CXX}} `
-D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL `
-D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\install `
-D Vulkan_INCLUDE_DIR=${env:VULKAN_SDK}/Include `
-D Vulkan_LIBRARY=${env:Vulkan_LIB_DIR}/vulkan-1.lib `
-S ${env:GITHUB_WORKSPACE} `
-B ${env:GITHUB_WORKSPACE}\build
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-SDK failed." }
Expand Down Expand Up @@ -545,12 +574,14 @@ jobs:
if: matrix.BIN != 'x86'
working-directory: ${{runner.workspace}}/OpenCL-SDK/build
run: |
$EXCLUDE_REGEX = 'externalmemory.*'
foreach ($Config in 'Release','Debug') {
& ctest `
--build-config ${Config} `
--output-on-failure `
--no-tests=error `
--parallel ${env:NUMBER_OF_PROCESSORS}
--parallel ${env:NUMBER_OF_PROCESSORS} `
--exclude-regex "$EXCLUDE_REGEX"
if ($LASTEXITCODE -ne 0) { throw "Running OpenCL-SDK tests in $Config failed." }
}

Expand Down Expand Up @@ -661,6 +692,10 @@ jobs:
echo "OCL_ICD_VENDORS=/opt/homebrew/Cellar/pocl/6.0/etc/OpenCL/vendors" >> $GITHUB_ENV
cmake --version

- name: Install samples dependencies
run: |
brew install vulkan-loader

- name: Install dependencies (Homebrew)
if: matrix.DEPS == 'system'
run: brew install tclap glm glew sfml mesa-glu
Expand Down Expand Up @@ -709,7 +744,7 @@ jobs:
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-SDK/build
run: |
EXCLUDE_REGEX="multidevice.*"
EXCLUDE_REGEX="(multidevice|externalmemory).*"
ctest -C Debug --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu` --exclude-regex "$EXCLUDE_REGEX"
ctest -C Release --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu` --exclude-regex "$EXCLUDE_REGEX"

Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ include(CMakeDependentOption)
option(OPENCL_SDK_BUILD_UTILITY_LIBRARIES "Build utility libraries" ON)
cmake_dependent_option(OPENCL_SDK_BUILD_SAMPLES "Build sample code" ON OPENCL_SDK_BUILD_UTILITY_LIBRARIES OFF)
cmake_dependent_option(OPENCL_SDK_BUILD_OPENGL_SAMPLES "Build OpenCL-OpenGL interop sample code" ON OPENCL_SDK_BUILD_SAMPLES OFF)
cmake_dependent_option(OPENCL_SDK_BUILD_VULKAN_SAMPLES "Build OpenCL-Vulkan interop sample code" ON OPENCL_SDK_BUILD_SAMPLES OFF)
cmake_dependent_option(OPENCL_SDK_TEST_SAMPLES "Add CTest to samples (where applicable)" ON OPENCL_SDK_BUILD_SAMPLES OFF)

option(OPENCL_SDK_BUILD_CLINFO "Build clinfo utility" ON)
Expand Down
5 changes: 5 additions & 0 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ if(OPENCL_SDK_BUILD_SAMPLES)
include(${DEP})
endforeach()
endif(OPENCL_SDK_BUILD_OPENGL_SAMPLES)

if(OPENCL_SDK_BUILD_VULKAN_SAMPLES)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Dependencies/Vulkan")
include(Vulkan)
endif(OPENCL_SDK_BUILD_VULKAN_SAMPLES)
endif(OPENCL_SDK_BUILD_SAMPLES)

if(OPENCL_SDK_BUILD_CLINFO)
Expand Down
1 change: 1 addition & 0 deletions cmake/Dependencies/Vulkan/Vulkan.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
find_package(Vulkan REQUIRED)
2 changes: 1 addition & 1 deletion external/OpenCL-Headers
4 changes: 3 additions & 1 deletion samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ CHECK_LIBRARY_EXISTS(m sin "" HAVE_LIB_M)
# KERNELS <file0> <file1> ... # optional, specifies kernel files for the sample
# INCLUDES <dir0> <dir1> ... # optional, specifies additional include directories for the sample
# LIBS <lib0> <lib1> ... # optional, specifies additional libraries for the sample
# DEFINITIONS <def0> <def1> # optional, specifies additional compile definitions for the sample
# )
macro(add_sample)
set(options TEST)
set(one_value_args TARGET VERSION CATEGORY)
set(multi_value_args SOURCES KERNELS SHADERS INCLUDES LIBS)
set(multi_value_args SOURCES KERNELS SHADERS INCLUDES LIBS DEFINITIONS)
cmake_parse_arguments(OPENCL_SAMPLE
"${options}" "${one_value_args}" "${multi_value_args}"
${ARGN}
Expand Down Expand Up @@ -75,6 +76,7 @@ macro(add_sample)
CL_HPP_MINIMUM_OPENCL_VERSION=${OPENCL_SAMPLE_VERSION}
CL_HPP_ENABLE_EXCEPTIONS
$<$<PLATFORM_ID:Windows>:_CRT_SECURE_NO_WARNINGS> # TODO: remove
${OPENCL_SAMPLE_DEFINITIONS}
)

set_target_properties(${OPENCL_SAMPLE_TARGET}
Expand Down
3 changes: 3 additions & 0 deletions samples/extensions/khr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ if(OPENCL_SDK_BUILD_OPENGL_SAMPLES)
add_subdirectory(conway)
add_subdirectory(nbody)
endif()
if(OPENCL_SDK_BUILD_VULKAN_SAMPLES)
add_subdirectory(externalmemory)
endif()
31 changes: 31 additions & 0 deletions samples/extensions/khr/externalmemory/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2021 The Khronos Group Inc.
#
# 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.

add_sample(
TEST
TARGET externalmemory
VERSION 300
SOURCES main.c
KERNELS external_saxpy.cl
LIBS Vulkan::Vulkan
DEFINITIONS $<$<PLATFORM_ID:Windows>:VK_USE_PLATFORM_WIN32_KHR>)

add_sample(
TEST
TARGET externalmemorycpp
VERSION 300
SOURCES main.cpp
KERNELS external_saxpy.cl
LIBS Vulkan::Vulkan
DEFINITIONS $<$<PLATFORM_ID:Windows>:VK_USE_PLATFORM_WIN32_KHR>)
Loading