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
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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.
3
+
4
+
For comprehensive instructions regarding DPC++ Programming, go to https://software.intel.com/en-us/oneapi-programming-guide and search based on relevant terms noted in the comments.
| What you will learn | The Sepia Filter sample demonstrates the following using the oneAPI DPC++ compiler <ul><li>Writing a custom device selector class</li><li>Offloading compute intensive parts of the application using both lamba and functor kernels</li><li>Measuring kernel execution time by enabling profiling</li></ul>
12
+
| Time to complete | 20 minutes
13
+
14
+
## Purpose
15
+
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 the help of lambda and functor kernels. 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 along with the time taken to execute each of the kernels. The application also outputs a sepia tone image of the input image.
17
+
18
+
## Key implementation details
19
+
The basic DPC++ implementation explained in the code includes device selector, buffer, accessor, kernel, and command groups. In addition, this sample demonstrates implementation of a custom device selector by over writing the SYCL device selector class, offloading computation using both lambda and functor kernels and using event objects to time command group execution by enabling profiling.
20
+
21
+
## License
22
+
This code sample is licensed under MIT license
23
+
24
+
## Building the Program
25
+
26
+
### Include Files
27
+
The include folder is located at `%ONEAPI_ROOT%\dev-utilities\latest\include` on your development system.
28
+
29
+
### Running Samples in DevCloud
30
+
If running a sample in the Intel DevCloud, remember that you must specify the compute node (CPU, GPU, FPGA) as well whether to run in batch or interactive mode. For more information see the Intel® oneAPI Base Toolkit Get Started Guide (https://devcloud.intel.com/oneapi/get-started/base-toolkit/)
31
+
32
+
### On a Linux* System
33
+
34
+
Perform the following steps:
35
+
36
+
37
+
1. Build sepia-filter program
38
+
```
39
+
$ cd sepia-filter
40
+
$ mkdir build
41
+
$ cd build
42
+
$ cmake ../.
43
+
$ make
44
+
```
45
+
46
+
2. Run the program <br>
47
+
```
48
+
$ make run
49
+
50
+
```
51
+
52
+
### On a Windows* System Using Visual Studio* version 2017 or Newer
53
+
54
+
* Build the program using VS2017 or VS2019: Right click on the solution file and open using either VS2017 or VS2019 IDE. Right click on the project in Solution explorer and select Rebuild. From top menu select Debug -> Start without Debugging.
55
+
* Build the program using MSBuild: Open "x64 Native Tools Command Prompt for VS2017" or "x64 Native Tools Command Prompt for VS2019". Run - MSBuild mandelbrot.sln /t:Rebuild /p:Configuration="Release"
56
+
57
+
58
+
## Running the sample
59
+
60
+
### Application Parameters
61
+
The Sepia-filter application expects a png image as an input parameter. The application comes with some sample images in the input folder. One of these is specified as the default input image to be converted in the cmake file and the default output image is generated in the same folder as the application.
62
+
63
+
### Example Output
64
+
```
65
+
Loaded image with a width of 3264, a height of 2448 and 3 channels
66
+
Running on Intel(R) Gen9
67
+
Submitting lambda kernel...
68
+
Submitting functor kernel...
69
+
Waiting for execution to complete...
70
+
Execution completed
71
+
Lambda kernel time: 10.5153 milliseconds
72
+
Functor kernel time: 9.99602 milliseconds
73
+
Sepia tone successfully applied to image:[input/silverfalls1.png]
0 commit comments