• Stars
    star
    240
  • Rank 168,229 (Top 4 %)
  • Language CMake
  • License
    Other
  • Created about 4 years ago
  • Updated 7 months ago

Reviews

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

Repository Details

Source code for 'Data Parallel C++: Mastering DPC++ for Programming of Heterogeneous Systems using C++ and SYCL' by James Reinders, Ben Ashbaugh, James Brodman, Michael Kinsner, John Pennycook, Xinmin Tian (Apress, 2020).

Data Parallel C++ Book Source Samples

This repository accompanies Data Parallel C++: Mastering C++ for Programming of Heterogeneous Systems using C++ with SYCL by James Reinders, Ben Ashbaugh, James Brodman, Michael Kinsner, John Pennycook, Xinmin Tian (Apress, 2020) and the upcoming second edition (available late 2023).

Cover image

Purpose of this branch (main)

This branch (main) contains source code derived from what will be published with the Second Edition of the DPC++ book (2023). We say 'derived' because we will update it as needed to keep it useful - as we did after the first edition was published. We welcome feedback. The sycl121_original_publication branch contains the source code published in the first edition. The first edition's book source was primarily based on the older SYCL 1.2.1 specification, and many enhancements and changes were added by the time the SYCL 2020 specification was published after our book. Since current toolchains which support SYCL are based on SYCL 2020, so this main branch is intended to be compatible with recent compiler and toolchain releases.

The Second Edition of the DPC++ book, will be released before the end of 2023, will be based on the updated code examples in this main branch.

Overview

Many of the samples in the book are snips from the more complete files in this repository. The full files contain supporting code, such as header inclusions, which are not shown in every listing within the book. The complete listings are intended to compile and be modifiable for experimentation.

Samples in this repository are updated to align with the most recent changes to the language and toolchains, and are more current than captured in the book text due to lag between finalization and actual publication of a print book. If experimenting with the code samples, start with the versions in this repository. DPC++ and SYCL are evolving to be more powerful and easier to use, and updates to the sample code in this repository are a good sign of forward progress!

Download the files as a zip using the green button, or clone the repository to your machine using Git.

How to Build the Samples

The samples in this repository are intended to compile with any modern C++ with SYCL compiler. We have tested it with the open source DPC++ project toolchain linked below, and with the 2023.0 release and newer of the oneAPI prebuilt icpx compilers based on the DPC++ open source project. If you have an older toolchain installed, you may encounter compilation errors due to evolution of the features and extensions. Recent testing verified that OpenSYCL (previously HipSYCL), with a few rare exceptions that should be resolved soon, is able to support all these examples as well. We will welcome any feedback regarding compatibility with any C++ compiler that has SYCL support.

Prerequisites

  1. An installed SYCL toolchain. See below for details on the tested DPC++ toolchain
  2. CMake 3.10 or newer (Linux) or CMake 3.25 or newer (Windows)
  3. Ninja or Make - to use the build steps described below

To build and use these examples, you will need an installed DPC++ toolchain. For one such toolchain, please visit:

https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/dpc-compiler.html

Alternatively, much of the toolchain can be built directly from:

https://github.com/intel/llvm

Some of the samples require other dependencies. To disable samples requiring these dependencies use the CMake variables described below.

Setting Up an Environment to Build the Samples

Setup environment variables if using a oneAPI / DPC++ implementation:

On Windows:

\path\to\inteloneapi\setvars.bat

On Linux:

source /path/to/inteloneapi/setvars.sh

Building the Samples:

Note: CMake supports different generators to create build files for different build systems. Some popular generators are Unix Makefiles or Ninja when building from the command line, and Visual Studio-based generators when building from a Windows IDE. The examples below generate build files for Unix Makefiles, but feel free to substitute a different generator, if preferred.

  1. Create build files using CMake. For example:

    mkdir build && cd build
    cmake -G "Unix Makefiles" ..
  2. Build with the generated build files:

    cmake --build . --target install --parallel

    Or, use the generated Makefiles directly:

    make install -j8

If your SYCL compiler is not detected automatically, or to explicitly specify a different SYCL compiler, use the CMAKE_CXX_COMPILER variable. For example:

cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=/path/to/your/sycl/compiler ..

CMake Variables:

The following CMake variables are supported. To specify one of these variables via the command line generator, use the CMake syntax -D<option name>=<value>. See your CMake documentation for more details.

Variable Type Description
NODPL BOOL Disable samples that require the oneAPI DPC++ Library (oneDPL). Default: FALSE
NODPCT BOOL Disable samples that require the DPC++ Compatibility Tool (dpct). Default: FALSE
NOL0 BOOL Disable samples that require the oneAPI Level Zero Headers and Loader. Default: TRUE
WITHCUDA BOOL Enable CUDA device support for the samples. Default: FALSE

More Repositories

1

ray-tracing-gems

Source Code for "Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs" by Eric Haines and Tomas Akenine-Möller
C
919
star
2

Ray-Tracing-Gems-II

Source Code for "Ray Tracing Gems II: Next Generation Real-Time Rendering with DXR, Vulkan, and OptiX" by Adam Marrs, Peter Shirley, and Ingo Wald
C++
692
star
3

low-level-programming

Source code for 'Low-Level Programming' by Igor Zhirkov
Assembly
644
star
4

design-patterns-in-modern-cpp

Source code for 'Design Patterns in Modern C++' by Dmitri Nesteruk
C++
534
star
5

pro-spring-5

Source code for 'Pro Spring 5' by Iuliana Cosmina, Rob Harrop, Chris Schaefer, and Clarence Ho
JavaScript
404
star
6

pro-asp.net-core-mvc-2

Source code for 'Pro ASP.NET Core MVC 2' by Adam Freeman
HTML
375
star
7

js-data-structures-and-algorithms

Source code for 'JavaScript Data Structures and Algorithms' by Sammie Bae
JavaScript
322
star
8

hands-on-time-series-analylsis-python

Source Code for 'Hands-on Time Series Analysis with Python' by B V Vishwas and Ashish Patel
Jupyter Notebook
321
star
9

python-projects-for-beginners

Source Code for 'Python Projects for Beginners' by Connor Milliken
Jupyter Notebook
297
star
10

pro-csharp-7

Source code for 'Pro C# 7' by Andrew Troelsen and Philip Japikse
C#
290
star
11

pro-react-16

Source Code for 'Pro React 16' by Adam Freeman
JavaScript
273
star
12

practical-tla-plus

Source Code for 'Practical TLA+' by Hillel Wayne
TLA
271
star
13

pro-angular-2ed

Source code for 'Pro Angular' by Adam Freeman
TypeScript
244
star
14

pro-asp.net-core-3

Source Code for 'Pro ASP.NET Core 3' by Adam Freeman
JavaScript
211
star
15

Devel-2D-Games-Unity

Source Code for 'Developing 2D Games with Unity: Independent Game Programming with C#' by Jared Halpern
C#
211
star
16

beginning-python-3ed

Source code for 'Beginning Python' by Magnus Lie Hetland
Python
207
star
17

pro-angular-6

Source Code for 'Pro Angular 6' by Adam Freeman
TypeScript
193
star
18

pro-asp.net-mvc-5

Source code for 'Pro ASP.NET MVC 5' by Adam Freeman
PowerShell
189
star
19

pivotal-certified-pro-spring-dev-exam-02

Source Code for 'Pivotal Certified Professional Core Spring 5 Developer Exam' by Iuliana Cosmina
Java
168
star
20

frameworkless-front-end-development

Source code for 'Frameworkless Front-End Development' by Francesco Strazzullo
JavaScript
167
star
21

pro-TBB

Source Code for 'Pro TBB: C++ Parallel Programming with Threading Building Blocks' by Michael Voss, Rafael Asenjo, and James Reinders
C++
166
star
22

pro-c-sharp-10

Source Code for 'Pro C# 10 with .NET 6' by Andrew Troelsen and Phil Japikse
C#
162
star
23

def-guide-spring-batch

Source Code for The Definitive Guide to Spring Batch by Michael Minella
Java
159
star
24

pro-angular-9

Source Code for 'Pro Angular 9' by Adam Freeman
TypeScript
154
star
25

build-your-own-2d-game-engine

Source code for 'Build your own 2D Game Engine and Create Great Web Games' by Kelvin Sung, Jebediah Pavleas, Fernando Arnez, and Jason Pace
JavaScript
150
star
26

practical-ddd-in-enterprise-java

Source Code for 'Practical Domain-Driven Design in Enterprise Java' by Vijay Nair
Java
144
star
27

modern-x86-assembly-language-programming

Source code for 'Modern X86 Assembly Language Programming' by Daniel Kusswurm
Assembly
143
star
28

pro-go

Source Code for 'Pro Go' by Adam Freeman
Go
143
star
29

pro-.net-memory

Source Code for 'Pro .NET Memory Management' by Konrad Kokosa
C#
135
star
30

monetizing-machine-learning

Source code for 'Monetizing Machine Learning' by Manuel Amunategui and Mehdi Roopaei
Jupyter Notebook
131
star
31

programming-with-64-bit-ARM-assembly-language

Source Code for 'Programming with 64-Bit ARM Assembly Language: Single Board Computer Development for Raspberry Pi and Mobile Devices' by Stephen Smith
128
star
32

building-quality-shaders-unity

Source Code for 'Building Quality Shaders for Unity' by Daniel Ilett
ShaderLab
126
star
33

practical-flutter

Source Code for 'Practical Flutter' by Frank Zammetti
Dart
126
star
34

beginning-x64-assembly-programming

Source Code for 'Beginning x64 Assembly Programming' by Jo Van Hoey
Assembly
125
star
35

pro-asp.net-core-6

Source Code for 'Pro ASP.NET Core 6' by Adam Freeman
SCSS
124
star
36

pro-asp.net-core-mvc

Source code for 'Pro ASP.NET Core MVC' by Adam Freeman
CSS
123
star
37

os-x-ios-kernel-programming

Source code for 'OS X and iOS Kernel Programming' by Ole Henry Halvorsen and Douglas Clarke
C++
122
star
38

pro-vue-js-2

Source Code for Pro Vue.js 2 by Adam Freeman
Vue
116
star
39

practical-ml-w-python

Source code for 'Practical Machine Learning with Python' by Dipanjan Sarkar, Raghav Bali, and Tushar Sharma
Jupyter Notebook
113
star
40

pro-objective-c-design-patterns-for-ios

Source code for 'Pro Objective-C Design Patterns for iOS' by Carlo Chung
Objective-C
113
star
41

pro-spring-boot-2

Source Code for Pro Spring Boot 2 by Felipe Gutierrez
Java
111
star
42

beginning-cpp20

Source Code for 'Beginning C++20' by Ivor Horton and Peter Van Weert
C++
111
star
43

malware-analysis-detection-engineering

Source Code for 'Malware Analysis and Detection Engineering' by Abhijit Mohanta and Anoop Saldanha
C
109
star
44

programming-persistent-memory

Source Code for 'Programming Persistent Memory: A Comprehensive Guide for Developers' by Steve Scargall
C
109
star
45

numerical-python-second-ed

Source code for 'Numerical Python Second Edition' by Robert Johansson
Jupyter Notebook
109
star
46

network-prog-with-go

Source code for 'Network Programming with Go' by Jan Newmarch
Go
107
star
47

essential-typescript

Source Code for 'Essential TypeScript' by Adam Freeman
TypeScript
107
star
48

css-mastery-16

Source code for 'CSS Mastery' by Andy Budd and Emil Björklund
106
star
49

pivotal-certified-pro-spring-dev-exam

Source code for 'Pivotal Certified Professional Spring Developer Exam' by Iuliana Cosmina
Java
105
star
50

genetic-algorithms-in-java-basics

Source code for 'Genetic Algorithms in Java Basics' by Lee Jacobson and Burak Kanber
Java
104
star
51

machine-learning-with-pyspark

Source Code for 'Machine Learning with PySpark' by Pramod Singh
Jupyter Notebook
103
star
52

physically-based-shader-dev-for-unity-2017

Source code for 'Physically Based Shader Development for Unity 2017' by Claudia Doppioslash
C#
102
star
53

building-chatbots-with-python

Source Code for 'Building Chatbots with Python' by Sumit Raj
Jupyter Notebook
100
star
54

mastering-ml-w-python-in-six-steps

Source code for 'Mastering Machine Learning with Python in Six Steps' by Manohar Swamynathan
Jupyter Notebook
100
star
55

common-lisp-condition-system

Source Code for 'The Common Lisp Condition System' by Michal "phoe" Herda
Common Lisp
98
star
56

java-game-dev-LibGDX

Source Code for Java Game Development with LibGDX by Lee Stemkoski
Java
96
star
57

practical-rust-projects

Source Code for 'Practical Rust Projects' by Shing Lyu
Rust
93
star
58

spring-5-recipes

Source code for 'Spring 5 Recipes' by Marten Deinum, Daniel Rubio, and Josh Long
Java
93
star
59

Beg-STM32-Devel-FreeRTOS-libopencm3-GCC

Source code for 'Beginning STM32: Developing with FreeRTOS, libopencm3 and GCC' by Warren Gay
C
92
star
60

beg-cplusplus17

Source code for 'Beginning C++17' by Ivor Horton and Peter Van Weert
C++
91
star
61

esntl-angular-for-asp.net-core-mvc

Source code for 'Essential Angular for ASP.NET Core MVC' by Adam Freeman
HTML
88
star
62

pro-ef-core-2-for-asp.net-core-mvc

Source code for 'Pro Entity Framework Core 2 for ASP.NET Core MVC' by Adam Freeman
HTML
88
star
63

pro-design-patterns-in-swift

Source code for 'Pro Design Patterns in Swift' by Adam Freeman
Swift
87
star
64

practical-shader-dev

Source code for 'Practical Shader Development' by Kyle Halladay
C++
87
star
65

practical-web-scraping-for-data-science

Source code for 'Practical Web Scraping for Data Science' by Seppe vanden Broucke and Bart Baesens
Python
87
star
66

practical-python-ai-projects

Source code for 'Practical Python AI Projects' by Serge Kruk
Python
86
star
67

modern-full-stack-development

Source code for 'Modern Full-Stack Development' by Frank Zammetti
TypeScript
86
star
68

practical-django2-and-channels2

Source Code for 'Practical Django 2 and Channels 2' by Federico Marani
Python
86
star
69

practical-microservices-architectural-patterns

Source Code for 'Practical Microservices Architectural Patterns' by Binildas Christudas
Java
83
star
70

modern-x86-assembly-language-programming-2e

Source Code for 'Modern X86 Assembly Language Programming' by Daniel Kusswurm
C++
81
star
71

pro-deep-learning-w-tensorflow

Source code for 'Pro Deep Learning with TensorFlow' by Santanu Pattanayak
Jupyter Notebook
81
star
72

matlab-deep-learning

Source code for 'MATLAB Deep Learning' by Phil Kim
Python
80
star
73

practical-machine-learning-w-rust

Source Code for 'Practical Machine Learning with Rust' by Joydeep Bhattacharjee
Rust
80
star
74

design-patterns-c-sharp

Source Code for 'Design Patterns in C#' by Vaskaran Sarcar
C#
80
star
75

beginning-anomaly-detection-using-python-based-dl

Source Code for 'Beginning Anomaly Detection Using Python-Based Deep Learning' by Sridhar Alla and Suman Kalyan Adari
Jupyter Notebook
80
star
76

pro-wpf-4.5-in-csharp

Source code for 'Pro WPF 4.5 in C#' by Matthew MacDonald
C#
79
star
77

domain-driven-laravel

Source Code for 'Domain-Driven Laravel' by Jesse Griffin
PHP
77
star
78

pro-python-best-practices

Source code for 'Pro Python Best Practices' by Kristian Rother
Python
76
star
79

csharp-6.0-and-.net-4.6

Source code for 'C# 6.0 and the .NET 4.6 Framework' by Andrew Troelsen and Philip Japikse
C#
76
star
80

matlab-machine-learning

Source Code for 'MATLAB Machine Learning' by Michael Paluszek and Stephanie Thomas
MATLAB
74
star
81

building-javascript-games

Source code for 'Building JavaScript Games' by Arjan Egges
JavaScript
73
star
82

beg-cobol-for-programmers

Source code for 'Beginning COBOL for Programmers' by Michael Coughlan
COBOL
73
star
83

db-performance-at-scale

Source code for "Database Performance at Scale: A Practical Guide (Apress, 2023)," by Felipe Cardeneti Mendes, Piotr Sarna, Pavel Emelyanov & Cynthia Dunlop
73
star
84

programming-algorithms-lisp

Source Code for 'Programming Algorithms in Lisp' by Vsevolod Domkin
Common Lisp
73
star
85

practical-docker-with-python

Source Code for 'Practical Docker with Python' by Sathyajith Bhat
Python
72
star
86

Test-Driven-Development-in-Swift

Source code for the tutorials in the Test-Driven Development in Swift book
Swift
72
star
87

machine-learning-oil-gas-industry

Source Code for 'Machine Learning in the Oil and Gas Industry' by Yogendra Narayan Pandey, Ayush Rastogi, Sribharath Kainkaryam, Srimoyee Bhattacharya, and Luigi Saputelli
70
star
88

dom-scripting-10

Source code for 'DOM Scripting' by Jeremy Keith and Jeffrey Sambells
JavaScript
70
star
89

practical-cryptography-in-python

Source code for 'Cryptography in Python Source Code' by Seth Nielson and Christopher K. Monson
Python
69
star
90

text-analytics-w-python-2e

Source Code for 'Text Analytics with Python,' 2nd Edition by Dipanjan Sarkar
Jupyter Notebook
69
star
91

python-ml-case-studies

Source code for 'Python Machine Learning Case Studies' by Danish Haroon
68
star
92

foundation-game-design-w-html5-javascript

Source code for 'Foundation Game Design with HTML5 and JavaScript' by Rex van der Spuy
HTML
68
star
93

advanced-data-analytics-using-python

Source Code for 'Advanced Data Analytics Using Python' by Sayan Mukhopadhyay
Python
67
star
94

cryptography-in-c-cpp

Source code for 'Cryptography in C and C++' by Michael Welschenbach
C
67
star
95

android-espresso-revealed

Source Code for 'Android Espresso Revealed' by Denys Zelenchuk
Java
65
star
96

beg-spring-boot-2

Source code for 'Beginning Spring Boot 2' by K. Siva Prasad Reddy
Java
65
star
97

modern-arm-assembly-language-programming

Source Code for 'Modern Arm Assembly Language Programming' by Daniel Kusswurm
C++
63
star
98

python-data-analytics-2e

Source Code for 'Python Data Analytics, 2nd Edition' by Fabio Nelli
Jupyter Notebook
63
star
99

physics-for-game-programmers

Source code for 'Physics for Game Programmers' by Grant Palmer
Java
63
star
100

beg-iphone-dev-w-swift-3

Source code for 'Beginning iPhone Development with Swift 3' by Molly Maskrey, Kim Topley, David Mark, Fredrik Olsson, and JEFF LAMARCHE
Swift
63
star