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

Implemented external memory sample #90

Open
wants to merge 46 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6703858
Add DEB packaging
Beanavil Jul 6, 2024
4473ce0
Update check-format script
Beanavil Jul 6, 2024
7f032c6
Android build in CI
mfep Jul 6, 2024
d7fde2b
Add linux CI
Beanavil Jul 6, 2024
f3b6346
Remove the C headers, C++ headers and loader from the SDK deb package
Beanavil Jul 6, 2024
7c9a7e9
Submodules update
Beanavil Jul 6, 2024
ad82569
Add Windows CI job
Beanavil Jul 6, 2024
3262347
Add MacOS CI job
Beanavil Jul 6, 2024
8697570
Unify C/C++ standards
Beanavil Jul 6, 2024
6fa9eeb
Fix warnings and errors gcc
Beanavil Jul 6, 2024
155dc4f
Fix warnings and errors clang
Beanavil Jul 6, 2024
1fd7920
Fix multi-config
Beanavil Jul 6, 2024
27ea08b
Fix MacOS errors
Beanavil Jul 6, 2024
92f5e4c
Fix Windows errors
Beanavil Jul 6, 2024
d5994da
Install Windows OpenCL runtime
Beanavil Jul 6, 2024
bbb8c20
Fix blur/blurcpp samples failures
Beanavil Jul 6, 2024
bbb4e48
Fix MacOS test execution
Beanavil Jul 6, 2024
09b102e
Fixed blur/blucpp OpenCL 2.0 check
Beanavil Jul 6, 2024
ca75f3e
Various minor improvements
mfep Jul 6, 2024
4eb99c1
Updated release scripts
mfep Jul 6, 2024
a50c61c
Building and packaging clinfo
mfep Jul 6, 2024
a20b454
Minor fixes and improvements
mfep Jul 6, 2024
e171043
Removed ToDos
mfep Jul 6, 2024
caf368f
Updated RELEASE.md
mfep Jul 6, 2024
26b835d
Removed _get_platform(cl_platform_id platform) from mako
mfep Jul 6, 2024
6d31877
Fixed resource release bug in binaries sample
mfep Jul 6, 2024
9320dec
Remove null pointer checks
Beanavil Jul 6, 2024
8d1c13e
Re-added whereami
mfep Jul 6, 2024
419c16f
Using upstream main for OpenCL-Headers submodule
mfep Jul 6, 2024
492bfdb
Bump deprecated actions
mfep Jul 6, 2024
a89ab83
Removed MSVC++ v141 jobs
mfep Jul 6, 2024
1ec6a1d
Whereami workaround
mfep Jul 6, 2024
0c9e688
fix(ci): Fetch a newer version of SFML, update patch
mfep Jul 6, 2024
94b92f9
fix(ci): Set up OSX architecture
mfep Jul 6, 2024
120a6e0
fix(binaries): Sample lang in binary name
mfep Jul 6, 2024
5d5f7a6
fix(ci): Fixed system deps in Linux builds
mfep Jul 6, 2024
ce3b855
Update docker images
Beanavil Jul 6, 2024
958ff01
Fix MSVC compiler toolset version
Beanavil Jul 6, 2024
b9d0dca
Removed OpenCL 2.0 check and cl_khr_subgroups from blur sample
Beanavil Jul 6, 2024
5ed64c4
Fixed compiler options being reset
Beanavil Jul 6, 2024
807a04a
Bumped version of pocl
Beanavil Jul 6, 2024
e5221a1
External memory C/C++ example
Beanavil Sep 29, 2023
8b4f18b
Fixes from review
Beanavil Dec 14, 2023
a6f5c7b
Fix find_suitable_device logic to conditionally increment cl_device_c…
Beanavil May 29, 2024
801c687
Conform to OpenCL v3.0.15 specification release
Beanavil May 29, 2024
4bf7ad4
Fix kernel execution time report
Beanavil Jun 5, 2024
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
868 changes: 791 additions & 77 deletions .github/workflows/presubmit.yml

Large diffs are not rendered by default.

163 changes: 127 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,26 @@ name: Create Release
jobs:
windows-binary:
runs-on: windows-2022
defaults:
run:
shell: pwsh
strategy:
matrix:
VER: [v143]
GEN: [Visual Studio 17 2022]
BIN: [x64, x86]

env:
UseMultiToolTask: true
EnforceProcessCountAcrossBuilds: true
MultiProcMaxCount: 3
steps:
- name: Checkout OpenCL-SDK
uses: actions/checkout@v2

- name: Initialize git submodules
shell: pwsh
run: |
& git submodule init
& git submodule update

- name: Create Build Environment
shell: pwsh
run: |
# Parallelize MSBuild across projects
[Environment]::SetEnvironmentVariable('UseMultiToolTask', 'true', [EnvironmentVariableTarget]::User)
[Environment]::SetEnvironmentVariable('EnforceProcessCountAcrossBuilds', 'true', [EnvironmentVariableTarget]::User)
[Environment]::SetEnvironmentVariable('MultiProcMaxCount', "$env:NUMBER_OF_PROCESSORS", [EnvironmentVariableTarget]::User)
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Configure
shell: pwsh
run: |
$Bin = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
& cmake `
Expand All @@ -42,15 +36,16 @@ jobs:
-T ${{matrix.VER}} `
-S "${env:GITHUB_WORKSPACE}" `
-B "${env:GITHUB_WORKSPACE}\build" `
-D CMAKE_INSTALL_PREFIX="${env:GITHUB_WORKSPACE}\install" `
-D BUILD_DOCS=OFF `
-D BUILD_TESTING=OFF `
-D BUILD_EXAMPLES=OFF `
-D OPENCL_SDK_BUILD_SAMPLES=OFF `
-D OPENCL_ICD_LOADER_BUILD_TESTING=OFF `
-D CMAKE_POLICY_DEFAULT_CMP0096=NEW
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-SDK failed." }

- name: Check version number
shell: pwsh
run: |
if ( -not (`
Get-Content ${env:GITHUB_WORKSPACE}\build\CMakeCache.txt | `
Expand All @@ -59,30 +54,29 @@ jobs:
{ throw 'CMake project version mismatches Git tag name (without leading "v")'}

- name: Build
shell: pwsh
run: |
foreach ($Config in "Debug","Release") { `
& cmake `
--build "${env:GITHUB_WORKSPACE}\build" `
--config $Config `
-- `
/verbosity:minimal `
/noLogo `
/noLogo
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-SDK in $Config failed." }
}

- name: Package Binary
shell: pwsh
run: |
& cpack `
--config "${env:GITHUB_WORKSPACE}\build\CPackConfig.cmake" `
-G ZIP `
-C 'Debug;Release' `
-D CPACK_PACKAGE_FILE_NAME='OpenCL-SDK-${{github.ref_name}}-Win-${{matrix.BIN}}' `
-B "${env:GITHUB_WORKSPACE}\package"
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK failed." }

- name: Upload Package
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: |
Expand All @@ -91,22 +85,24 @@ jobs:
source:
name: Source Release (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: pwsh
strategy:
matrix:
OS: [ubuntu-20.04, windows-2022]

env:
DEB_INSTALLATION_PATH: /usr

steps:
- name: Checkout OpenCL-SDK
uses: actions/checkout@v2

- name: Initialize git submodules
shell: pwsh
run: |
& git submodule init
& git submodule update
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Configure
shell: pwsh
run: |
& cmake `
-S "${env:GITHUB_WORKSPACE}" `
Expand All @@ -116,19 +112,29 @@ jobs:
-D BUILD_EXAMPLES=OFF `
-D OPENCL_SDK_BUILD_SAMPLES=OFF `
-D OPENCL_ICD_LOADER_BUILD_TESTING=OFF `
-D CMAKE_POLICY_DEFAULT_CMP0096=NEW
-D CMAKE_POLICY_DEFAULT_CMP0096=NEW `
-D CPACK_PACKAGING_INSTALL_PREFIX=$DEB_INSTALLATION_PATH
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-SDK failed." }

- name: Check version number
shell: pwsh
run: |
if ( -not (`
Get-Content ${env:GITHUB_WORKSPACE}/build/CMakeCache.txt | `
Select-String -Pattern ('CMAKE_PROJECT_VERSION:STATIC=' + '${{github.ref_name}}'.Replace('v','')) `
)) `
{ throw 'CMake project version mismatches Git tag name (without leading "v")'}

- name: Package DEB
if: ${{ contains(matrix.OS, 'ubuntu') }}
run: |
cpack `
--config "${env:GITHUB_WORKSPACE}/build/CPackSourceConfig.cmake" `
-G DEB `
-C Release `
"${env:GITHUB_WORKSPACE}/package-deb"
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK deb failed." }

- name: Package Source
shell: pwsh
run: |
$Generator = if('${{matrix.OS}}' -match 'windows') {'ZIP'} else {'TGZ'}
& cpack `
Expand All @@ -138,11 +144,96 @@ jobs:
-D CPACK_SOURCE_IGNORE_FILES="/\\.git/;/\\.gitignore;/\\.gitmodules;/\\.gitlab/;/\\.github/;/\\.reuse/;/\\.appveyor.yml;/build/;/install/;/package/" `
-D CPACK_PACKAGE_FILE_NAME='OpenCL-SDK-${{github.ref_name}}-Source' `
-B "${env:GITHUB_WORKSPACE}/package"
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK source failed." }

- name: Release Source
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: |
package/OpenCL-SDK-${{github.ref_name}}-Source.*
package/OpenCL-SDK-${{github.ref_name}}-Source.*

ppa:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
OPENCL_HEADERS_REPOSITORY: mfep/OpenCL-Headers
OPENCL_ICD_LOADER_REPOSITORY: mfep/OpenCL-ICD-Loader
OPENCL_CLHPP_REPOSITORY: mfep/OpenCL-CLHPP
distroseries: jammy
steps:
- name: Add PPA
run: sudo add-apt-repository -y ppa:${{ vars.PPA }}

- name: Install prerequisites
run: sudo apt-get update -qq && sudo apt-get install -y
cmake
devscripts
debhelper-compat=13
opencl-c-headers
opencl-clhpp-headers
khronos-opencl-loader-libopencl1
khronos-opencl-loader-opencl-dev
clinfo

- name: Import GPG signing key
run: echo "${{ secrets.DEB_SIGNING_KEY }}" | gpg --import

- name: Download and extract source code (OpenCL-SDK)
run: |
wget -O $GITHUB_WORKSPACE/source.orig.tar.gz https://github.com/$GITHUB_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/source.orig.tar.gz -C $GITHUB_WORKSPACE
mv $GITHUB_WORKSPACE/OpenCL-SDK-* $GITHUB_WORKSPACE/OpenCL-SDK

- name: Download and extract source code (OpenCL-Headers)
run: |
wget -O $GITHUB_WORKSPACE/opencl-headers.tar.gz https://github.com/$OPENCL_HEADERS_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-headers.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers

- name: Download and extract source code (OpenCL-ICD-Loader)
run: |
wget -O $GITHUB_WORKSPACE/opencl-icd-loader.tar.gz https://github.com/$OPENCL_ICD_LOADER_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-icd-loader.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader

- name: Download and extract source code (OpenCL-CLHPP)
run: |
wget -O $GITHUB_WORKSPACE/opencl-clhpp.tar.gz https://github.com/$OPENCL_CLHPP_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-clhpp.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP

- name: Configure project out-of-tree
run: cmake
-S $GITHUB_WORKSPACE/OpenCL-SDK*
-B $GITHUB_WORKSPACE/../build
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_INSTALL_PREFIX=/usr
-D BUILD_TESTING=OFF
-D OPENCL_SDK_BUILD_SAMPLES=OFF
-D LATEST_RELEASE_VERSION=$GITHUB_REF_NAME
-D CPACK_DEBIAN_PACKAGE_MAINTAINER="${{ vars.DEB_MAINTAINER }}"
-D DEBIAN_VERSION_SUFFIX=${{ vars.DEB_VERSION_SUFFIX }}

- name: Generate packaging scripts
run: cmake
-D CMAKE_CACHE_PATH=$GITHUB_WORKSPACE/../build/CMakeCache.txt
-D ORIG_ARCHIVE=$GITHUB_WORKSPACE/source.orig.tar.gz
-D LATEST_RELEASE_VERSION=$GITHUB_REF_NAME
-D DEBIAN_DISTROSERIES=${{ env.distroseries }}
-D DEBIAN_PACKAGE_MAINTAINER="${{ vars.DEB_MAINTAINER }}"
-D DEBIAN_VERSION_SUFFIX=${{ vars.DEB_VERSION_SUFFIX }}
-P $GITHUB_WORKSPACE/OpenCL-SDK*/cmake/DebSourcePkg.cmake

- name: Build source package
run: |
cd $GITHUB_WORKSPACE/OpenCL-SDK*/
debuild -S -sa

- name: Push source package to the PPA
run: dput ppa:${{ vars.PPA }} $GITHUB_WORKSPACE/*source.changes
14 changes: 12 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
build/
install/
# Build dir
[Bb]uild/

# Install dir
[Ii]nstall/

# Package dirs
[Pp]ackage/
[Pp]ackage-deb/

# Cmake
CMakeFiles/

# vim
*~
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "loader"]
path = external/OpenCL-ICD-Loader
url = https://github.com/KhronosGroup/OpenCL-ICD-Loader.git
url = https://github.com/StreamHPC/OpenCL-ICD-Loader.git
[submodule "headers"]
path = external/OpenCL-Headers
url = https://github.com/KhronosGroup/OpenCL-Headers.git
[submodule "headers-cpp"]
path = external/OpenCL-CLHPP
url = https://github.com/KhronosGroup/OpenCL-CLHPP.git
url = https://github.com/StreamHPC/OpenCL-CLHPP.git
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.16)

set(CMAKE_CXX_STANDARD 14)

Expand All @@ -26,8 +26,14 @@ 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)
if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libstdc++")
endif()

include(CTest)

if (NOT CMAKE_BUILD_TYPE)
Expand All @@ -48,6 +54,7 @@ list(APPEND CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake/Modules
)
include(Dependencies)
include(Package)
if(OPENCL_SDK_BUILD_UTILITY_LIBRARIES)
add_subdirectory(lib)
endif()
Expand All @@ -71,6 +78,7 @@ set(config_package_location ${CMAKE_INSTALL_DATADIR}/cmake/OpenCL)
install(
FILES ${PROJECT_BINARY_DIR}/OpenCL/OpenCLConfig.cmake
DESTINATION ${config_package_location}
COMPONENT binary
)

unset(CMAKE_SIZEOF_VOID_P)
Expand All @@ -83,6 +91,7 @@ write_basic_package_version_file(
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenCL/OpenCLConfigVersion.cmake
DESTINATION ${config_package_location}
COMPONENT binary
)

include(CPack)
Loading