Skip to content

Commit 38b1f88

Browse files
authored
fixed type in oneAPI essentials jupyter notebooks (#931)
1 parent 493ceb9 commit 38b1f88

File tree

9 files changed

+67
-61
lines changed

9 files changed

+67
-61
lines changed

DirectProgramming/DPC++/Jupyter/oneapi-essentials-training/01_oneAPI_Intro/oneAPI_Intro.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
"metadata": {},
170170
"source": [
171171
"## What is Data Parallel C++\n",
172-
"__Data Parallel C++ (DPC++)__ is oneAPI's implementation of SYCL compiler. It takes advantage of modern C++ productivity benefits and familiar constructs, and incorporates the __SYCL*__ standard for data parallelism and heterogeneous programming. DPC++ is a __single source__ language where host code and __heterogeneous accelerator kernels__ can be mixed in same source files. A DPC++ program is invoked on the host computer and offloads the computation to an accelerator. Programmers use familiar C++ and library constructs with added functionliaties like a __queue__ for work targeting, __buffer__ for data management, and __parallel_for__ for parallelism to direct which parts of the computation and data should be offloaded."
172+
"__Data Parallel C++ (DPC++)__ is oneAPI's implementation of SYCL compiler. It takes advantage of modern C++ productivity benefits and familiar constructs, and incorporates the __SYCL*__ standard for data parallelism and heterogeneous programming. DPC++ is a __single source__ language where host code and __heterogeneous accelerator kernels__ can be mixed in same source files. A DPC++ program is invoked on the host computer and offloads the computation to an accelerator. Programmers use familiar C++ and library constructs with added functionalities like a __queue__ for work targeting, __buffer__ for data management, and __parallel_for__ for parallelism to direct which parts of the computation and data should be offloaded."
173173
]
174174
},
175175
{
@@ -185,7 +185,7 @@
185185
"metadata": {},
186186
"source": [
187187
"## HPC Single Node Workflow with oneAPI \n",
188-
"Accelerated code can be written in either a kernel (SYCL) or __directive based style__. Developers can use the __Intel® DPC++ Compatibility tool__ to perform a one-time migration from __CUDA__ to __SYCL__. Existing __Fortran__ applications can use a __directive style based on OpenMP__. Existing __C++__ applications can choose either the __Kernel style__ or the __directive based style option__ and existing __OpenCL__ applications can remain in the OpenCL language or migrate to Data Parallel C++.\n",
188+
"Accelerated code can be written in either a kernel (SYCL) or __directive-based style__. Developers can use the __Intel® DPC++ Compatibility tool__ to perform a one-time migration from __CUDA__ to __SYCL__. Existing __Fortran__ applications can use a __directive-based style in OpenMP__. Existing __C++__ applications can choose either the __Kernel style__ or the __directive-based style option__ and existing __OpenCL__ applications can remain in the OpenCL language or migrate to Data Parallel C++.\n",
189189
"\n",
190190
"__Intel® Advisor__ is recommended to __Optimize__ the design for __vectorization and memory__ (CPU and GPU) and __Identify__ loops that are candidates for __offload__ and project the __performance on target accelerators.__\n",
191191
"\n",
@@ -285,7 +285,7 @@
285285
" \n",
286286
"#### Compiling and Running on Intel® DevCloud:\n",
287287
" \n",
288-
"For this training, we have written a script (q) to aid developers in developing projects on DevCloud. This script submits the `run.sh` script to a gpu node on DevCloud for execution, waits for the job to complete and prints out the output/errors. We will be using this command to run on DevCloud: `./q run.sh`\n",
288+
"For this training, we have written a script (q) to aid developers in developing projects on DevCloud. This script submits the `run.sh` script to a GPU node on DevCloud for execution, waits for the job to complete and prints out the output/errors. We will be using this command to run on DevCloud: `./q run.sh`\n",
289289
"\n",
290290
"\n",
291291
"\n",

DirectProgramming/DPC++/Jupyter/oneapi-essentials-training/02_DPCPP_Program_Structure/DPCPP_Program_Structure.ipynb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"metadata": {},
4444
"source": [
4545
"## What is Data Parallel C++ and SYCL?\n",
46-
"__Data Parallel C++ (DPC++)__ is oneAPI's implementation of SYCL. It is based on modern C++ productivity benefits and familiar constructs and incorporates the __SYCL__ standard for data parallelism and heterogeneous programming. SYCL is a __single source__ where __host code__ and __heterogeneous accelerator kernels__ can be mixed in same source files. A SYCL program is invoked on the host computer and offloads the computation to an accelerator. Programmers use familiar C++ and library constructs with added functionliaties like a __queue__ for work targeting, __buffer__ for data management, and __parallel_for__ for parallelism to direct which parts of the computation and data should be offloaded."
46+
"__Data Parallel C++ (DPC++)__ is oneAPI's implementation of SYCL. It is based on modern C++ productivity benefits and familiar constructs and incorporates the __SYCL__ standard for data parallelism and heterogeneous programming. SYCL is a __single source__ where __host code__ and __heterogeneous accelerator kernels__ can be mixed in same source files. A SYCL program is invoked on the host computer and offloads the computation to an accelerator. Programmers use familiar C++ and library constructs with added functionalities like a __queue__ for work targeting, __buffer__ for data management, and __parallel_for__ for parallelism to direct which parts of the computation and data should be offloaded."
4747
]
4848
},
4949
{
@@ -156,7 +156,7 @@
156156
"metadata": {},
157157
"source": [
158158
"## Kernel\n",
159-
"The __kernel__ class encapsulates methods and data for executing code on the device when a command group is instantiated. Kernel object is not explicitly constructed by the user and is is constructed when a kernel dispatch function, such as __parallel_for__, is called \n",
159+
"The __kernel__ class encapsulates methods and data for executing code on the device when a command group is instantiated. Kernel object is not explicitly constructed by the user and is constructed when a kernel dispatch function, such as __parallel_for__, is called \n",
160160
" ```cpp\n",
161161
" q.submit([&](handler& h) {\n",
162162
"  h.parallel_for(range<1>(N), [=](id<1> i) {\n",
@@ -199,7 +199,7 @@
199199
"## SYCL Language and Runtime\n",
200200
"SYCL language and runtime consists of a set of C++ classes, templates, and libraries.\n",
201201
"\n",
202-
" __Application scope__ and __command group scope__ :\n",
202+
" __Application scope__ and __command group scope__:\n",
203203
" * Code that executes on the host\n",
204204
" * The full capabilities of C++ are available at application and command group scope \n",
205205
"\n",
@@ -247,7 +247,7 @@
247247
"});\n",
248248
"\n",
249249
"```\n",
250-
"The above example is good if all you need is the __index (id)__, but if you need the __range__ value in your kernel code, then you can use __item__ class instead of __id__ class , which you can use to query for the __range__ as shown below. __item__ class represents an __individual instance__ of a kernel function, exposes additional functions to query properties of the execution range\n",
250+
"The above example is good if all you need is the __index (id)__, but if you need the __range__ value in your kernel code, then you can use __item__ class instead of __id__ class, which you can use to query for the __range__ as shown below. __item__ class represents an __individual instance__ of a kernel function, exposes additional functions to query properties of the execution range\n",
251251
"\n",
252252
"\n",
253253
"```cpp\n",
@@ -871,7 +871,6 @@
871871
{
872872
"cell_type": "markdown",
873873
"metadata": {
874-
"jp-MarkdownHeadingCollapsed": true,
875874
"tags": []
876875
},
877876
"source": [
@@ -883,7 +882,7 @@
883882
"- Create a new second `vector2` and initialize to value 20.\n",
884883
"- Create sycl buffers for the above second vector\n",
885884
"- In the kernel code, create a second accessor for the second vector buffer\n",
886-
"- Modify the vector increment to vector add, byt adding `vector2` to `vector1`\n",
885+
"- Modify the vector increment to vector add, by adding `vector2` to `vector1`\n",
887886
"\n",
888887
"1. Edit the code cell below by following the steps and then click run ▶ to save the code to a file.\n",
889888
"2. Next run ▶ the cell in the __Build and Run__ section below the code to compile and execute the code."

DirectProgramming/DPC++/Jupyter/oneapi-essentials-training/03_DPCPP_Unified_Shared_Memory/Unified_Shared_Memory.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"cell_type": "markdown",
5050
"metadata": {},
5151
"source": [
52-
"Unified Shared Memory (USM) is a pointer based memory management in SYCL. USM is a\n",
52+
"Unified Shared Memory (USM) is a pointer-based memory management in SYCL. USM is a\n",
5353
"__pointer-based approach__ that should be familiar to C and C++ programmers who use malloc\n",
5454
"or new to allocate data. USM __simplifies development__ for the programmer when __porting existing\n",
5555
"C/C++ code__ to SYCL."
@@ -115,7 +115,7 @@
115115
"metadata": {},
116116
"source": [
117117
"__USM Initialization__:\n",
118-
"The initialization below shows example of shared allocation using `malloc_shared`, the \"q\" queue parameter provides information about the device that memory is accessable.\n",
118+
"The initialization below shows example of shared allocation using `malloc_shared`, the \"q\" queue parameter provides information about the device that memory is accessible.\n",
119119
"```cpp\n",
120120
"int *data = malloc_shared<int>(N, q);\n",
121121
" ^ ^\n",
@@ -320,11 +320,11 @@
320320
"cell_type": "markdown",
321321
"metadata": {},
322322
"source": [
323-
"When using unified shared memory, dependences between tasks must be specified using events since tasks execute asynchronously and mulitple tasks can execute simultaneously. \n",
323+
"When using unified shared memory, dependences between tasks must be specified using events since tasks execute asynchronously and multiple tasks can execute simultaneously. \n",
324324
"\n",
325325
"Programmers may either explicitly <code>wait</code> on event objects or use the <code>depends_on</code> method inside a command group to specify a list of events that must complete before a task may begin.\n",
326326
"\n",
327-
"In the example below, the two kernel tasks are updating the same `data` array, these two kernels can execute simultanously and may cause undesired result. The first task must be complete before the second can begin, the next section will show different ways the data dependency can be resolved.\n",
327+
"In the example below, the two kernel tasks are updating the same `data` array, these two kernels can execute simultaneously and may cause undesired result. The first task must be complete before the second can begin, the next section will show different ways the data dependency can be resolved.\n",
328328
"```cpp\n",
329329
" q.parallel_for(range<1>(N), [=](id<1> i) { data[i] += 2; });\n",
330330
"\n",
@@ -475,7 +475,7 @@
475475
"cell_type": "markdown",
476476
"metadata": {},
477477
"source": [
478-
"The code below uses USM and has three kernels that are submitted to device. The first two kernels modify two different memeory objects and the third one has a dependency on the first two. There is no data dependency between the three queue submissions, so the code can be fixed to get desired output of 25.\n",
478+
"The code below uses USM and has three kernels that are submitted to device. The first two kernels modify two different memory objects and the third one has a dependency on the first two. There is no data dependency between the three queue submissions, so the code can be fixed to get desired output of 25.\n",
479479
"\n",
480480
"- Implementing **depends_on()** method gets the best performance\n",
481481
"- Using **in_order** queue property or **wait()** will get results but not the most efficient\n",

DirectProgramming/DPC++/Jupyter/oneapi-essentials-training/04_DPCPP_Sub_Groups/Sub_Groups.ipynb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"metadata": {},
3939
"source": [
4040
"- Understand advantages of using Subgroups in SYCL\n",
41-
"- Take advantage of Subgroup collectives in ND-Range kernel implementation\n",
41+
"- Take advantage of Subgroup algorithms for performance and productivity\n",
4242
"- Use Subgroup Shuffle operations to avoid explicit memory operations"
4343
]
4444
},
@@ -158,7 +158,7 @@
158158
"cell_type": "markdown",
159159
"metadata": {},
160160
"source": [
161-
"Once you have the subgroup handle, you can query for more information about the subgroup, do shuffle operations or use collective functions."
161+
"Once you have the subgroup handle, you can query for more information about the subgroup, do shuffle operations or use group algorithm."
162162
]
163163
},
164164
{
@@ -280,7 +280,7 @@
280280
"cell_type": "markdown",
281281
"metadata": {},
282282
"source": [
283-
"For tuning applications for performance, sub-group size may have to be set a specific value. For example Intel(R) GPU supports sub-groups sizes of 8, 16 and 32; by default the compiler implimentation will pick optimal sub-group size, but it can also be forced to use a specific value.\n",
283+
"For tuning applications for performance, sub-group size may have to be set a specific value. For example, Intel(R) GPU supports sub-groups sizes of 8, 16 and 32; by default the compiler implementation will pick optimal sub-group size, but it can also be forced to use a specific value.\n",
284284
"\n",
285285
"The supported sub-group sizes for a GPU can be queried from device information as shown below:\n",
286286
"\n",
@@ -405,7 +405,7 @@
405405
"Providing these implementations as library functions instead __increases developer productivity__ and gives implementations the ability to __generate highly optimized \n",
406406
"code__ for individual target devices.\n",
407407
"\n",
408-
"Below are some of the group algorithms available for sub-groups, they include useful fuctionalities to perform shuffles, reductions, scans and votes:\n",
408+
"Below are some of the group algorithms available for sub-groups, they include useful functionalities to perform shuffles, reductions, scans and votes:\n",
409409
"\n",
410410
"- select_by_group\n",
411411
"- shift_group_left\n",
@@ -470,7 +470,7 @@
470470
"cell_type": "markdown",
471471
"metadata": {},
472472
"source": [
473-
"The code below uses subgroup shuffle to swap items in a subgroup. You can try other shuffle operations or change the fixed constant in the shuffle function to express some common commuinication patterns using `permute_group_by_xor`.\n",
473+
"The code below uses subgroup shuffle to swap items in a subgroup. You can try other shuffle operations or change the fixed constant in the shuffle function to express some common communication patterns using `permute_group_by_xor`.\n",
474474
"\n",
475475
"The SYCL code below demonstrates sub-group shuffle operations, the code shows how `permute_group_by_xor` can be used to swap adjacent elements in sub-group, and also you can change the code to reverse the order of element in sub-group using a different mask.\n",
476476
"\n",
@@ -561,15 +561,15 @@
561561
" h.parallel_for(nd_range<1>(N,B), [=](nd_item<1> item){\n",
562562
"      auto sg = item.get_sub_group();\n",
563563
"      auto i = item.get_global_id(0);\n",
564-
"      /* Reduction Collective on Sub-group */\n",
564+
"      /* Reduction algorithm on Sub-group */\n",
565565
"      int result = reduce_over_group(sg, data[i], plus<>());\n",
566566
"      //int result = reduce_over_group(sg, data[i], maximum<>());\n",
567567
"      //int result = reduce_over_group(sg, data[i], minimum<>());\n",
568568
" });\n",
569569
"\n",
570570
"```\n",
571571
"\n",
572-
"The SYCL code below demonstrates sub-group collectives: Inspect code, you can change the operator \"_plus_\" to \"_maximum_\" or \"_minimum_\" and check output:\n",
572+
"The SYCL code below demonstrates sub-group algorithm: Inspect code, you can change the operator \"_plus_\" to \"_maximum_\" or \"_minimum_\" and check output:\n",
573573
"\n",
574574
"1. Inspect the code cell below and click run ▶ to save the code to file.\n",
575575
"\n",
@@ -608,7 +608,7 @@
608608
" auto sg = item.get_sub_group();\n",
609609
" auto i = item.get_global_id(0);\n",
610610
"\n",
611-
" //# Add all elements in sub_group using sub_group collectives\n",
611+
" //# Add all elements in sub_group using sub_group algorithm\n",
612612
" int result = reduce_over_group(sg, data[i], plus<>());\n",
613613
"\n",
614614
" //# write sub_group sum in first location for each sub_group\n",
@@ -655,7 +655,7 @@
655655
"cell_type": "markdown",
656656
"metadata": {},
657657
"source": [
658-
"The code below uses subgroup collectives `group_broadcast` function, this enables one work-item in a group to share the value of a variable with all other work-items in the group.\n",
658+
"The code below uses subgroup algorithm `group_broadcast` function, this enables one work-item in a group to share the value of a variable with all other work-items in the group.\n",
659659
"\n",
660660
"The SYCL code below demonstrates sub-group broadcast function: Inspect code, there are no modifications necessary:\n",
661661
"\n",
@@ -742,7 +742,7 @@
742742
"“vote” functions) enable work-items to compare the result of a Boolean\n",
743743
"condition across their group.\n",
744744
"\n",
745-
"The SYCL code below demonstrates sub-group collectives `any_of_group`, `all_of_group` and `none_of_group` functions: Inspect code, there are no modifications necessary:\n",
745+
"The SYCL code below demonstrates sub-group algorithms `any_of_group`, `all_of_group` and `none_of_group` functions: Inspect code, there are no modifications necessary:\n",
746746
"\n",
747747
"1. Inspect the code cell below and click run ▶ to save the code to file.\n",
748748
"\n",
@@ -839,10 +839,10 @@
839839
"cell_type": "markdown",
840840
"metadata": {},
841841
"source": [
842-
"Complete the coding excercise below using Sub-Group concepts:\n",
842+
"Complete the coding exercise below using Sub-Group concepts:\n",
843843
"- The code has an array `data` of size `N=1024` elements initialized\n",
844844
"- We will offload kernel task to compute the sum of all items in each sub-group and save in new array `sg_data`\n",
845-
"- We will set a the sub-group size to `S=32`, which will make the `sg_data` array of size `N/S`\n",
845+
"- We will set the sub-group size to `S=32`, which will make the `sg_data` array of size `N/S`\n",
846846
"- Create USM shared allocation for `data` and `sg_data`\n",
847847
"- Create a nd-range kernel task with fixed sub-group size of `S`\n",
848848
"- In the kernel task, compute the sub-group sum using `reduce_over_group` function\n",

0 commit comments

Comments
 (0)