• This repository has been archived on 26/Jan/2024
  • Stars
    star
    515
  • Rank 85,879 (Top 2 %)
  • Language
    C++
  • License
    Other
  • Created over 9 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Open Source Parallel STL implementation

SYCL Parallel STL Build Status

This project features an implementation of the Parallel STL library using the Khronos SYCL standard.

What is Parallel STL

Parallel STL is an implementation of the Technical Specification for C++ Extensions for Parallelism, current document number N4507. This technical specification describes a set of requirements for implementations of an interface that computer programs written in the C++ programming language may use to invoke algorithms with parallel execution. In practice, this specification is aimed at the next C++ standard (C++20) and offers the opportunity to users to specify execution policies to traditional STL algorithms which will enable the execution of those algorithms in parallel. The various policies can specify different kinds of parallel execution. For example,

std::vector<int> v = ...
// Traditional sequential sort
std::sort(vec.begin(), vec.end());
// Explicit sequential sort
std::sort(seq, vec.begin(), vec.end());
// Explicit parallel sort
std::sort(par, vec.begin(), vec.end());

What is SYCL?

SYCL is a royalty-free, cross-platform C++ abstraction layer that builds on top of OpenCL. SYCL enables single-source development of OpenCL applications in C++ whilst enabling traditional host compilers to produce standard C++ code.

SyclParallelSTL

SyclParallelSTL exposes a SYCL policy in the experimental::parallel namespace that can be passed to standard STL algorithms for them to run on SYCL. Currently, only some STL algorithms are implemented, such as:

  • sort : Bitonic sort for ranges where the size is a power of two, or sequential sort otherwise.
  • transform : Parallel iteration (one thread per element) on the device.
  • fill : Parallel iteration (one thread per element) on the device.
  • fill_n : Parallel iteration (one thread per element) on the device.
  • generate : Parallel iteration (one thread per element) on the device.
  • generate_n : Parallel iteration (one thread per element) on the device.
  • for_each : Parallel iteration (one thread per element) on the device.
  • for_each_n : Parallel iteration (one work-item per element) on the device.
  • replace : Parallel iteration (one thread per element) on the device.
  • replace_if : Parallel iteration (one thread per element) on the device.
  • replace_copy : Parallel iteration (one thread per element) on the device.
  • replace_copy_if : Parallel iteration (one thread per element) on the device.
  • reverse: Parallel iteration (one work-item per 2 elements) on device.
  • reverse_copy : Parallel iteration (one work-item per element) on the device.
  • count : Parallel iteration (one work-item per 2 elements) on device.
  • count_if : Parallel iteration (one work-item per 2 elements) on device.
  • reduce : Parallel iteration (one work-item per 2 elements) on device.
  • inner_product: Parallel iteration (one work-item per 2 elements) on device.
  • transform_reduce : Parallel iteration (one work-item per 2 elements) on device.
  • inclusive_scan : Parallel iteration (one work-item per 2 elements) on device.
  • exclusive_scan : Parallel iteration (one work-item per 2 elements) on device.
  • mismatch : Parallel iteration (one work-item per 2 elements) on device.
  • all_of: Parallel iteration (one work-item per 2 elements) on device.
  • any_of: Parallel iteration (one work-item per 2 elements) on device.
  • none_of: Parallel iteration (one work-item per 2 elements) on device.
  • equal: Parallel iteration (one work-item per 2 elements) on device.

Some optimizations are implemented. For example:

  • the ability to pass iterators to buffers rather than STL containers to reduce the amount of information copied in and out
  • the ability to specify a queue to the SYCL policy so that the queue is used for the various kernels (potentially enabling asynchronous execution of the calls).

Building the project

This project currently supports the SYCL beta implementation from Codeplay, ComputeCPP and the open-source triSYCL implementation.

The project uses CMake 3.5 in order to produce build files, but more recent versions may work.

In Linux, simply create a build directory and run CMake as follows:

$ mkdir build
$ cd build
$ cmake ../ -DCOMPUTECPP_PACKAGE_ROOT_DIR=/path/to/sycl \
$ make

Usual CMake options are available (e.g. building debug or release). Makefile and Ninja generators are supported on Linux.

To simplify configuration, the FindComputeCpp cmake module from the ComputeCPP SDK is included verbatim in this package within the cmake/Modules/ directory.

If Google Mock is found in external/gmock, a set of unit tests is built. Unit tests can be run by running Ctest in the binary directory. To install gmock, run the following commands from the root directory of the SYCL parallel stl project:

$ mkdir external
$ cd external
$ git clone [email protected]:google/googletest.git
$ cd googletest/googlemock/make
$ make

To enable building the benchmarks, enable the PARALLEL_STL_BENCHMARKS option in the cmake configuration line, i.e. -DPARALLEL_STL_BENCHMARKS=ON.

When building with a SYCL implementation that has no device compiler, enable the SYCL_NO_DEVICE_COMPILER option to disable the specific CMake rules for intermediate file generation.

Refer to your SYCL implementation documentation for implementation-specific building options.

To quickly build the project and run some non-regression tests with benchmarks, you can use the script build.sh:

If you want to compile it with ComputeCpp:

./build.sh "path/to/ComputeCpp" (this path can be relative)

for example (on Ubuntu 16.04):

./build.sh ~/ComputeCpp

If you want to compile it with triSYCL:

./build.sh --trisycl [-DTRISYCL_INCLUDE_DIR=path/to/triSYCL/include] [-DBOOST_COMPUTE_INCLUDE_DIR=path/to/boost/compute/include] [-DTRISYCL_OPENCL=ON]

for example (on Ubuntu 16.04):

./build.sh --trisycl -DTRISYCL_INCLUDE_DIR=~/triSYCL/include -DBOOST_COMPUTE_INCLUDE_DIR=~/compute/include [-DTRISYCL_OPENCL=ON]

or if Boost compute is in your library's default path, just with:

./build.sh --trisycl -DTRISYCL_INCLUDE_DIR=~/triSYCL/include [-DTRISYCL_OPENCL=ON]

Just run build.sh alone to get a small help message.

For triSYCL some benchmarks may display messages saying that unimplemented features are used, you can ignore those messages as these features do not affect the benchmarks executions, if you wish you can also contribute to the triSYCL implementation to make those messages definitely disapear.

Building the documentation

Source code is documented using Doxygen. To build the documentation as an HTML file, navigate to the doc directory and run doxygen from there.

$ cd doc
$ doxygen

This will generate the html pages inside the doc_output directory.

Limitations

  • The Lambda functions that you can pass to the algorithms have the same restrictions as any SYCL kernel. See the SYCL specification for details on the limitations.

  • While using lambda functions, the compiler needs to find a name for that lambda function. To provide a lambda name, the user has to do the following:

    cl::sycl::queue q; sycl::sycl_execution_policy snp(q); sort(snp, v.begin(), v.end(), [=](int a, int b) { return a >= b; });

  • Be aware that some algorithms may run sequential versions if the number of elements to be computed are not power of two. The following algorithms have this limitation: sort, inner_product, reduce, count_if and transform_reduce.

  • Refer to SYCL implementation documentation for implementation-specific building options.

Copyright and Trademarks

Intel and the Intel logo are trademarks of Intel Inc. AMD, the AMD Arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc. OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos. Other names are for informational purposes only and may be trademarks of their respective owners.

More Repositories

1

glTF

glTF – Runtime 3D Asset Delivery
HTML
7,152
star
2

MoltenVK

MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.
Objective-C++
4,788
star
3

Vulkan-Samples

One stop solution for all Vulkan samples
C++
4,176
star
4

glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
C++
3,009
star
5

Vulkan-Hpp

Open-Source Vulkan C++ API
C++
2,691
star
6

WebGL

The Official Khronos WebGL Repository
HTML
2,637
star
7

glTF-Sample-Models

glTF Sample Models
Mathematica
2,593
star
8

Vulkan-Docs

The Vulkan API Specification and related tools
JavaScript
2,527
star
9

UnityGLTF

Runtime glTF 2.0 Loader for Unity3D
C#
1,818
star
10

SPIRV-Cross

SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
GLSL
1,748
star
11

Vulkan-Guide

One stop shop for getting started with the Vulkan API
Makefile
1,586
star
12

glTF-Blender-IO

Blender glTF 2.0 importer and exporter
Python
1,488
star
13

glTF-Sample-Viewer

Physically-Based Rendering in glTF 2.0 using WebGL
JavaScript
1,084
star
14

SPIRV-Tools

C++
1,071
star
15

glTF-Tutorials

glTF Tutorials
Python
951
star
16

KTX-Software

KTX (Khronos Texture) Library and Tools
C++
866
star
17

Vulkan-Headers

Vulkan header files and API registry
C++
838
star
18

glTF-Blender-Exporter

Moved to https://github.com/KhronosGroup/glTF-Blender-IO.
Python
836
star
19

Vulkan-ValidationLayers

Vulkan Validation Layers (VVL)
C++
739
star
20

Khronosdotorg

Website resource pages for Khronos.org. Community is encouraged to help keep up-to-date
HTML
716
star
21

OpenXR-SDK

Generated headers and sources for OpenXR loader.
C++
688
star
22

OpenGL-Registry

OpenGL, OpenGL ES, and OpenGL ES-SC API and Extension Registry
C
683
star
23

SPIRV-Reflect

SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications.
C
665
star
24

OpenCOLLADA

C++
652
star
25

OpenCL-Headers

Khronos OpenCL-Headers
C
620
star
26

OpenCL-SDK

OpenCL SDK
C++
539
star
27

OpenXR-SDK-Source

Sources for OpenXR loader, basic API layers, and example code.
Python
518
star
28

Vulkan-Loader

Vulkan Loader
C
508
star
29

COLLADA2GLTF

COLLADA to glTF converter
C++
499
star
30

VK-GL-CTS

Khronos Vulkan, OpenGL, and OpenGL ES Conformance Tests
C++
464
star
31

Vulkan-Samples-Deprecated

Vulkan sample code
454
star
32

SPIRV-LLVM-Translator

A tool and a library for bi-directional translation between SPIR-V and LLVM IR
LLVM
422
star
33

Vulkan-LoaderAndValidationLayers

**Deprecated repository** for Vulkan loader and validation layers
C++
414
star
34

OpenGL-Refpages

OpenGL and OpenGL ES reference page sources, and generated HTML used as backing store for khronos.org
HTML
392
star
35

OpenCL-CLHPP

Khronos OpenCL-CLHPP
C++
329
star
36

glTF-Validator

Tool to validate glTF assets.
Dart
321
star
37

OpenCL-Docs

OpenCL API, OpenCL C, Extensions, SPIR-V Environment Specs, Ref page, and C++ for OpenCL doc sources.
Python
296
star
38

OpenCL-Guide

A guide to help developers get up and running quickly with the OpenCL programming framework
CMake
295
star
39

GLSL

GLSL Shading Language Issue Tracker
282
star
40

Vulkan-Tools

Vulkan Utilities and Tools
C++
270
star
41

SPIRV-LLVM

This project is no longer active. Please join us at
C++
259
star
42

SPIRV-Headers

SPIRV-Headers
C++
229
star
43

OpenCL-ICD-Loader

The OpenCL ICD Loader project.
C
226
star
44

NNEF-Tools

The NNEF Tools repository contains tools to generate and consume NNEF documents
Python
220
star
45

ANARI-SDK

ANARI Software Development Kit (SDK)
C++
207
star
46

WebGLDeveloperTools

JavaScript
200
star
47

glTF-CSharp-Loader

C# Reference Loader for glTF
C#
193
star
48

SPIR

C++
178
star
49

glTF-Asset-Generator

Tool for generating various glTF assets for importer validation
C#
160
star
50

OpenCL-CTS

The OpenCL Conformance Tests
C++
149
star
51

Vulkan-Ecosystem

Public repository for Vulkan Ecosystem issues
134
star
52

WebGLNext-Proposals

Proposals for the design of the WebGL Next API.
WebIDL
132
star
53

OpenXR-Docs

OpenXR Specification sources and related material
Python
128
star
54

Vulkan-ExtensionLayer

Layer providing Vulkan features when native support is unavailable
C
128
star
55

SYCL-Docs

SYCL Open Source Specification
JavaScript
114
star
56

libclcxx

OpenCL specific C++ libraries implemented in C++ for OpenCL kernel language published in releases of OpenCL-Docs
109
star
57

SPIRV-Registry

SPIR-V specs
HTML
108
star
58

SPIRV-Guide

One stop shop for getting started with SPIR-V.
104
star
59

OpenCL-Registry

OpenCL API and Extension Registry.
HTML
100
star
60

openvx-samples

OpenVX Samples to use with any conformant implementation of OpenVX
C++
99
star
61

Vulkan-MemoryModel

Vulkan Memory Model
C++
98
star
62

3D-Formats-Guidelines

Guidelines for artists and developers using Khronos Group 3D formats.
98
star
63

EGL-Registry

EGL API and Extension Registry
HTML
98
star
64

glTF-IBL-Sampler

Sampler to create the glTF sample environments
C++
89
star
65

LLVM-SPIRV-Backend

An LLVM backend generating SPIR-V binary.
86
star
66

Vulkan-Profiles

Vulkan Profiles Tools
C++
84
star
67

glTF-External-Reference

glTF Experience Format (glXF)
73
star
68

Basis-Universal-Transcoders

A collection of optimized WebAssembly transcoders for Basis Universal compressed GPU texture formats.
WebAssembly
72
star
69

Vulkan-Samples-Assets

Vulkan Samples Assets
72
star
70

KTX-Specification

KTX file format source
CSS
70
star
71

OpenXR-Registry

Registry of OpenXR Specifications and related material
HTML
70
star
72

glTF-Sample-Environments

glTF sample environments for the glTF Sample Viewer
Batchfile
68
star
73

glTF-Project-Explorer

Tool to provide a filterable registry of glTF community projects.
TypeScript
67
star
74

3DC-Asset-Creation

Asset creation guidelines and workflows to streamline the creation of 3D digital content for use in e-commerce
Shell
66
star
75

SYCL-CTS

SYCL Conformance Tests
C++
61
star
76

OpenXR-CTS

Conformance test suite for OpenXR
C++
56
star
77

Vulkan-Utility-Libraries

Utility libraries for Vulkan developers
C++
55
star
78

siggraph2012course

Presentations for SIGGRAPH 2012 course "Graphics Programming on the Web" covering HTML5 technologies (Canvas, CSS, etc.), WebGL and WebCL
HTML
53
star
79

WebCL

The Official Khronos WebCL Repository
HTML
50
star
80

ToneMapping

A collection of tone mappers for the display of 3D graphics
JavaScript
47
star
81

OpenVX-Registry

OpenVX API and Extension Registry.
HTML
44
star
82

SPIR-Tools

SPIR-Tools
C
44
star
83

Vulkan-Portability

40
star
84

OpenXR-Hpp

Open-Source OpenXR C++ language projection
C++
40
star
85

OpenCL-CXX

OpenCL C++ Kernel Language Spec sources.
TeX
39
star
86

webcl-validator

WebCL Validator
C++
38
star
87

DataFormat

Khronos Data Format Specification
C
36
star
88

OpenCL-TTL

Tensor Tiling Library
C
33
star
89

OpenXR-Tutorials

OpenXR Tutorials [Work in progress, do not use to study OpenXR yet]
C++
32
star
90

WebGLPerf

WebGL performance regression tests
HTML
32
star
91

COLLADA-CTS

Welcome to the COLLADA Conformance Test Suite
Python
32
star
92

ANARI-Docs

ANARI Documentation
JavaScript
30
star
93

glTF-Compressonator

Fork of AMD GPUOpen Compressonator tool , for the purpose of further enhancing glTF support. and prototyping for ETC1S CRN, CTTF_128 Universal Formats, Transcoders, and Supercompression
C++
30
star
94

Education-Forum

content to support educators developing courses on Khronos technologies
29
star
95

khronosgroup.github.io

Visit https://github.khronos.org for a directory of all our GitHub Repositories
HTML
27
star
96

SPIRV-Visualizer

Client side only Javascript to visualize a SPIR-V Module binary
JavaScript
26
star
97

OpenVG-Docs

OpenVG Specification source
C
25
star
98

Vulkan-Site

Vulkan Documentation Project framework for integrated documentation site with spec, proposals, guide, and more
JavaScript
25
star
99

glTF-Generator-Registry

An open registry of tools that create glTF assets.
25
star
100

SYCL_Reference

SYCL Reference Manual
C++
25
star