You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mandelbrot is an infinitely complex fractal patterning that is derived from a simple formula. It demonstrates using DPC++ for offloading computations to a GPU (or other devices) and shows how processing time can be optimized and improved with parallelism.
3
+
Mandelbrot is an infinitely complex fractal patterning that is derived from a
4
+
simple formula. It demonstrates using DPC++ for offloading computations to a
5
+
GPU (or other devices) and shows how processing time can be optimized and
6
+
improved with parallelism.
4
7
5
8
For comprehensive instructions see the [DPC++ Programming](https://software.intel.com/en-us/oneapi-programming-guide) and search based on relevant terms noted in the comments.
6
9
@@ -13,40 +16,132 @@ For comprehensive instructions see the [DPC++ Programming](https://software.inte
13
16
| Time to complete | 15 minutes
14
17
15
18
## Purpose
16
-
Mandelbrot is a DPC++ application that generates a fractal image by initializing a matrix of 512 x 512, where the computation at each point (pixel) is entirely independent of the computation at other points. The sample includes both parallel and serial calculation of the set, allowing for a direct comparison of results. The parallel implementation can demonstrate the use of Unified Shared Memory (USM) or buffers. You can modify parameters such as the number of rows, columns, and iterations to evaluate the difference in performance and load between USM and buffers. This is further described at the end of this document in the "Running the Sample" section.
17
19
18
-
The code will attempt to execute on an available GPU and fallback to the system's CPU if a compatible GPU is not detected. The compilation device is displayed in the output along with elapsed time to render the Mandelbrot image. This helps compare different offload implementations based on the complexity of the computation.
20
+
Mandelbrot is a DPC++ application that generates a fractal image by
21
+
initializing a matrix of 512 x 512, where the computation at each point (pixel)
22
+
is entirely independent of the computation at other points. The sample includes
23
+
both parallel and serial calculation of the set, allowing for a direct
24
+
comparison of results. The parallel implementation can demonstrate the use of
25
+
Unified Shared Memory (USM) or buffers. You can modify parameters such as the
26
+
number of rows, columns, and iterations to evaluate the difference in
27
+
performance and load between USM and buffers. This is further described at the
28
+
end of this document in the "Running the Sample" section.
29
+
30
+
The code will attempt to execute on an available GPU and fallback to the
31
+
system's CPU if a compatible GPU is not detected. The compilation device is
32
+
displayed in the output along with elapsed time to render the Mandelbrot image.
33
+
This helps compare different offload implementations based on the complexity of
34
+
the computation.
19
35
20
36
## Key Implementation Details
21
-
The basic DPC++ implementation explained in the code includes device selector, buffer, accessor, kernel, and command groups.
37
+
38
+
The basic DPC++ implementation explained in the code includes device selector,
39
+
buffer, accessor, kernel, and command groups.
22
40
23
41
## License
24
42
Code samples are licensed under the MIT license. See
25
43
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt) for details.
26
44
27
45
Third party program Licenses can be found here: [third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt)
28
46
47
+
48
+
## Setting Environment Variables
49
+
50
+
51
+
For working at a Command-Line Interface (CLI), the tools in the oneAPI toolkits
52
+
are configured using environment variables. Set up your CLI environment by
53
+
sourcing the ``setvars`` script every time you open a new terminal window. This
54
+
will ensure that your compiler, libraries, and tools are ready for development.
55
+
56
+
57
+
### Linux
58
+
Source the script from the installation location, which is typically in one of
59
+
these folders:
60
+
61
+
62
+
For root or sudo installations:
63
+
64
+
65
+
``. /opt/intel/oneapi/setvars.sh``
66
+
67
+
68
+
For normal user installations:
69
+
70
+
``. ~/intel/oneapi/setvars.sh``
71
+
72
+
**Note:** If you are using a non-POSIX shell, such as csh, use the following command:
can also be used to set up your development environment.
87
+
The modulefiles scripts work with all Linux shells.
88
+
89
+
90
+
**Note:** If you wish to fine
91
+
tune the list of components and the version of those components, use
92
+
a [setvars config file](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-linux-or-macos/use-a-config-file-for-setvars-sh-on-linux-or-macos.html)
93
+
to set up your development environment.
94
+
95
+
### Windows
96
+
97
+
Execute the ``setvars.bat`` script from the root folder of your
>For more information on environment variables, see Use the setvars Script for [Linux or macOS](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-linux-or-macos.html), or [Windows](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-windows.html).
131
+
38
132
39
133
### Include Files
40
134
The include folder is located at %ONEAPI_ROOT%\dev-utilities\latest\include on your development system.
41
135
42
136
### Running Samples In DevCloud
43
-
Running samples in the Intel DevCloud requires you to specify a compute node. For specific instructions, jump to [Run the sample in the DevCloud](#run-on-devcloud)
137
+
Running samples in the Intel DevCloud requires you to specify a compute node.
138
+
For specific instructions, jump to [Run the sample in the DevCloud](#run-on-devcloud)
44
139
45
140
46
141
### Using Visual Studio Code* (Optional)
47
142
48
-
You can use Visual Studio Code (VS Code) extensions to set your environment, create launch configurations,
49
-
and browse and download samples.
143
+
You can use Visual Studio Code (VS Code) extensions to set your environment,
144
+
create launch configurations, and browse and download samples.
50
145
51
146
The basic steps to build and run a sample using VS Code include:
52
147
- Download a sample using the extension **Code Sample Browser for Intel oneAPI Toolkits**.
@@ -55,11 +150,14 @@ The basic steps to build and run a sample using VS Code include:
55
150
- Run the sample in the VS Code terminal using the instructions below.
56
151
57
152
To learn more about the extensions and how to configure the oneAPI environment, see
58
-
[Using Visual Studio Code with Intel® oneAPI Toolkits](https://software.intel.com/content/www/us/en/develop/documentation/using-vs-code-with-intel-oneapi/top.html).
153
+
[Using Visual Studio Code with Intel® oneAPI Toolkits](https://www.intel.com/content/www/us/en/develop/documentation/using-vs-code-with-intel-oneapi/top.html).
154
+
155
+
After learning how to use the extensions for Intel oneAPI Toolkits, return to
156
+
this readme for instructions on how to build and run a sample.
59
157
60
-
After learning how to use the extensions for Intel oneAPI Toolkits, return to this readme for instructions on how to build and run a sample.
61
158
62
159
### On a Linux* System
160
+
63
161
Perform the following steps:
64
162
1. Build the program using the following `cmake` commands.
65
163
```
@@ -84,6 +182,13 @@ $ make
84
182
make clean
85
183
```
86
184
185
+
If an error occurs, you can get more details by running `make` with the `VERBOSE=1` argument:
186
+
``make VERBOSE=1``
187
+
For more comprehensive troubleshooting, use the Diagnostics Utility for
188
+
Intel® oneAPI Toolkits, which provides system checks to find missing dependencies and permissions errors.
Copy file name to clipboardExpand all lines: DirectProgramming/DPC++/CombinationalLogic/sepia-filter/README.md
+108-6Lines changed: 108 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# `Sepia-filter` Sample
2
-
The sepia filter is a program that converts a color image to a Sepia tone image, which is a monochromatic image with a distinctive Brown Gray color. The program works by offloading the compute intensive conversion of each pixel to Sepia tone and is implemented using DPC++ for CPU and GPU.
2
+
3
+
The sepia filter is a program that converts a color image to a Sepia tone
4
+
image, which is a monochromatic image with a distinctive Brown Gray color. The
5
+
program works by offloading the compute intensive conversion of each pixel to
6
+
Sepia tone and is implemented using DPC++ for CPU and GPU.
3
7
4
8
For comprehensive instructions see the [DPC++ Programming](https://software.intel.com/en-us/oneapi-programming-guide) and search based on relevant terms noted in the comments.
5
9
@@ -12,27 +16,118 @@ For comprehensive instructions see the [DPC++ Programming](https://software.inte
12
16
| Time to complete | 20 minutes
13
17
14
18
## Purpose
15
-
The sepia filter is a DPC++ application that accepts a color image as an input and converts it to a sepia tone image by applying the sepia filter coefficients to every pixel of the image. The sample demonstrates offloading the compute intensive part of the application, which is the processing of individual pixels to an accelerator with lambda and functor kernels' help. The sample also demonstrates the usage of a custom device selector, which sets precedence for a GPU device over other available devices on the system.
16
-
The device selected for offloading the kernel is displayed in the output and the time taken to execute each of the kernels. The application also outputs a sepia tone image of the input image.
19
+
20
+
The sepia filter is a DPC++ application that accepts a color image as an input
21
+
and converts it to a sepia tone image by applying the sepia filter coefficients
22
+
to every pixel of the image. The sample demonstrates offloading the compute
23
+
intensive part of the application, which is the processing of individual pixels
24
+
to an accelerator with lambda and functor kernels' help. The sample also
25
+
demonstrates the usage of a custom device selector, which sets precedence for a
26
+
GPU device over other available devices on the system. The device selected for
27
+
offloading the kernel is displayed in the output and the time taken to execute
28
+
each of the kernels. The application also outputs a sepia tone image of the
29
+
input image.
17
30
18
31
## Key implementation details
19
-
The basic DPC++ implementation explained in the code includes device selector, buffer, accessor, kernel, and command groups. This sample also demonstrates a custom device selector's implementation by overwriting the SYCL device selector class, offloading computation using both lambda and functor kernels, and using event objects to time command group execution, enabling profiling.
32
+
33
+
The basic DPC++ implementation explained in the code includes device selector,
34
+
buffer, accessor, kernel, and command groups. This sample also demonstrates a
35
+
custom device selector's implementation by overwriting the SYCL device selector
36
+
class, offloading computation using both lambda and functor kernels, and using
37
+
event objects to time command group execution, enabling profiling.
20
38
21
39
## License
22
40
Code samples are licensed under the MIT license. See
23
41
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt) for details.
24
42
25
43
Third party program Licenses can be found here: [third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt)
26
44
45
+
46
+
47
+
## Setting Environment Variables
48
+
49
+
50
+
For working at a Command-Line Interface (CLI), the tools in the oneAPI toolkits
51
+
are configured using environment variables. Set up your CLI environment by
52
+
sourcing the ``setvars`` script every time you open a new terminal window. This
53
+
will ensure that your compiler, libraries, and tools are ready for development.
54
+
55
+
56
+
### Linux
57
+
Source the script from the installation location, which is typically in one of
58
+
these folders:
59
+
60
+
61
+
For root or sudo installations:
62
+
63
+
64
+
``. /opt/intel/oneapi/setvars.sh``
65
+
66
+
67
+
For normal user installations:
68
+
69
+
``. ~/intel/oneapi/setvars.sh``
70
+
71
+
**Note:** If you are using a non-POSIX shell, such as csh, use the following command:
can also be used to set up your development environment.
86
+
The modulefiles scripts work with all Linux shells.
87
+
88
+
89
+
**Note:** If you wish to fine
90
+
tune the list of components and the version of those components, use
91
+
a [setvars config file](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-linux-or-macos/use-a-config-file-for-setvars-sh-on-linux-or-macos.html)
92
+
to set up your development environment.
93
+
94
+
### Windows
95
+
96
+
Execute the ``setvars.bat`` script from the root folder of your
>For more information on environment variables, see Use the setvars Script for [Linux or macOS](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-linux-or-macos.html), or [Windows](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-the-setvars-script-with-windows.html).
130
+
36
131
37
132
### Include Files
38
133
The include folder is located at `%ONEAPI_ROOT%\dev-utilities\latest\include` on your development system.
@@ -77,6 +172,13 @@ Perform the following steps:
77
172
78
173
```
79
174
175
+
176
+
If an error occurs, you can get more details by running `make` with the `VERBOSE=1` argument:
177
+
``make VERBOSE=1``
178
+
For more comprehensive troubleshooting, use the Diagnostics Utility for Intel® oneAPI Toolkits, which provides system checks to find missing dependencies and permissions errors.
0 commit comments