Skip to content

Commit cf10750

Browse files
2024.0 Bug Fixes (oneapi-src#2100)
* Update README.md Updated preset table per UAT recommendations * Updated project files to support 2024.0 builds in Visual Studio (oneapi-src#2067) * Updated Windows samples that contain VS project files to support 2024.0 * Renamed matrix_mul_dpcpp.vcxproj to matrix_mul_sycl.vcxproj * 2024.0 windows fixes (oneapi-src#2076) * Updated Windows samples that contain VS project files to support 2024.0 * Renamed matrix_mul_dpcpp.vcxproj to matrix_mul_sycl.vcxproj * Updated AdditionalIncludeDirectories in VS project files to support both oneapi-vars and setvars.bat * Bug fixes (oneapi-src#2078) * README updates for Windows samples using Microsoft Visual Studio (oneapi-src#2093) * README updates * Update README.md * README update * README update * README Updates * README Update * README Update * README Updates * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update sample.json file * Update sample.json * Sepia Filter Dynamic Selection Visual Studio Fixes (oneapi-src#2099) --------- Co-authored-by: ishaghosh27 <[email protected]>
1 parent 277635f commit cf10750

File tree

39 files changed

+676
-1539
lines changed

39 files changed

+676
-1539
lines changed
Lines changed: 18 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,40 @@
11
# `Mandelbrot` Sample
22

3-
Mandelbrot is an infinitely complex fractal pattern that is derived from a
4-
simple formula. This `Mandelbrot` sample demonstrates how to use SYCL*-compliant code for offloading computations to a GPU (or other devices) and further demonstrates how to optimize and improve processing time using parallelism.
3+
Mandelbrot is an infinitely complex fractal pattern that is derived from a simple formula. This `Mandelbrot` sample demonstrates how to use SYCL*-compliant code for offloading computations to a GPU (or other devices) and further demonstrates how to optimize and improve processing time using parallelism.
54

65
| Property | Description
7-
|:--- |:---
8-
| What you will learn | How to offload the computation to GPU using the Intel&reg; oneAPI DPC++/C++ Compiler
9-
| Time to complete | 15 minutes
6+
|:--- |:---
7+
| What you will learn | How to offload the computation to GPU using the Intel&reg; oneAPI DPC++/C++ Compiler
8+
| Time to complete | 15 minutes
109

1110
For comprehensive information in oneAPI programming, see the [Intel&reg; oneAPI Programming Guide](https://software.intel.com/en-us/oneapi-programming-guide). (Use search or the table of contents to find relevant information.)
1211

1312
## Purpose
1413

15-
This `Mandelbrot` sample is a SYCL-compliant application that generates a fractal image by
16-
initializing a matrix of 512 x 512, where the computation at each point (pixel)
17-
is entirely independent of the computation at other points. The sample includes
18-
both parallel and serial calculations of the set, which allows for direct results comparison. The parallel implementation demonstrates the use of
19-
Unified Shared Memory (USM) or buffers. You can modify parameters such as the
20-
number of rows, columns, and iterations to evaluate the difference in
21-
performance and load between USM and buffers.
22-
14+
This `Mandelbrot` sample is a SYCL-compliant 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
15+
both parallel and serial calculations of the set, which allows for direct results comparison. The parallel implementation demonstrates 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.
2316

2417
## Prerequisites
2518
| Property | Description
26-
|:--- |:---
27-
| OS | Ubuntu* 18.04 <br>Windows* 10
28-
| Hardware | Skylake with GEN9 or newer
29-
| Software | Intel&reg; oneAPI DPC++/C++ Compiler
19+
|:--- |:---
20+
| OS | Ubuntu* 18.04 <br>Windows* 10
21+
| Hardware | Skylake with GEN9 or newer
22+
| Software | Intel&reg; oneAPI DPC++/C++ Compiler
3023

3124
## Key Implementation Details
3225

3326
The program attempts first to run on an available GPU, and it will fall back to the system CPU if it does not detect a compatible GPU.
3427

3528
The program output displays the compilation device and elapsed render time for the Mandelbrot image, which helps compare different offload implementations based on the complexity of the computation.
3629

37-
The basic SYCL implementation explained in the code includes device selector,
38-
buffer, accessor, kernel, and command groups.
30+
The basic SYCL implementation explained in the code includes device selector, buffer, accessor, kernel, and command groups.
3931

4032
## Build the `Mandelbrot` Sample
4133

4234
### Setting Environment Variables
43-
For working with the Command-Line Interface (CLI), you should configure the oneAPI toolkits using environment variables. Set up your CLI environment by
44-
sourcing the `setvars` script every time you open a new terminal window. This practice ensures your compiler, libraries, and tools are ready for development.
35+
When working with the Command Line Interface (CLI), you should configure the oneAPI toolkits using environment variables. Set up your CLI environment by sourcing the `setvars` script every time you open a new terminal window. This practice ensures your compiler, libraries, and tools are ready for development.
4536

46-
> **Note**: If you have not already done so, set up your CLI
47-
> environment by sourcing the `setvars` script located in
48-
> the root of your oneAPI installation.
37+
> **Note**: If you have not already done so, set up your CLI environment by sourcing the `setvars` script located in the root of your oneAPI installation.
4938
>
5039
> Linux*:
5140
> - For system wide installations: `. /opt/intel/oneapi/setvars.sh`
@@ -56,19 +45,18 @@ sourcing the `setvars` script every time you open a new terminal window. This pr
5645
> - `C:\Program Files(x86)\Intel\oneAPI\setvars.bat`
5746
> - For Windows PowerShell*, use the following command: `cmd.exe "/K" '"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" && powershell'`
5847
>
48+
> Microsoft Visual Studio:
49+
> - Open a command prompt window and execute `setx SETVARS_CONFIG " "`. This only needs to be set once and will automatically execute the `setvars` script every time Visual Studio is launched.
50+
>
5951
>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).
6052
6153
You can use [Modulefiles scripts](https://www.intel.com/content/www/us/en/develop/documentation/oneapi-programming-guide/top/oneapi-development-environment-setup/use-modulefiles-with-linux.html) to set up your development environment. The modulefiles scripts work with all Linux shells.
6254

6355
If you wish to fine tune the list of components and the version of those components, use
6456
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) to set up your development environment.
6557

66-
### Include Files
67-
The include folder is located on your development system at `%ONEAPI_ROOT%\dev-utilities\latest\include`.
68-
6958
### Using Visual Studio Code* (Optional)
70-
You can use Visual Studio Code* (VS Code) extensions to set your environment,
71-
create launch configurations, and browse and download samples.
59+
You can use Visual Studio Code* (VS Code) extensions to set your environment, create launch configurations, and browse and download samples.
7260

7361
The basic steps to build and run a sample using VS Code include:
7462
- Download a sample using the extension **Code Sample Browser for Intel&reg; oneAPI Toolkits**.
@@ -149,120 +137,8 @@ Rendered image output to file: mandelbrot.png (output too large to display in te
149137
Successfully computed Mandelbrot set.
150138
```
151139
152-
## Build the `Mandelbrot` Sample in Intel&reg; DevCloud
153-
If running a sample in the Intel&reg; DevCloud, you must specify the compute node (CPU, GPU, FPGA) and whether to run in batch or interactive mode. For more information, see the Intel&reg; oneAPI Base Toolkit [Get Started Guide](https://devcloud.intel.com/oneapi/get_started/).
154-
155-
1. Open a terminal on a Linux system.
156-
157-
2. Log in to the Intel&reg; DevCloud.
158-
```
159-
ssh devcloud
160-
```
161-
162-
3. Download the samples from GitHub.
163-
```
164-
git clone https://github.com/oneapi-src/oneAPI-samples.git
165-
```
166-
167-
4. Change directories to the sample directory.
168-
```
169-
cd ~/oneAPI-samples/DirectProgramming/DPC++/CombinationalLogic/mandelbrot
170-
```
171-
172-
### Build and Run the Sample in Batch Mode (optional)
173-
The following instruction describe the optional process of submitting build and run jobs
174-
in a Portable Bash Script (PBS). A job is a script that is submitted to PBS through the qsub utility. By default, the qsub utility does not inherit the current environment variables or your current working directory. For this reason, it is necessary to submit jobs as scripts that handle the setup of the environment variables. In order to address the working directory issue, you can either use absolute paths or pass the `-d \<dir\>` option to qsub to set the working directory.
175-
176-
### Create the Job Scripts
177-
178-
1. Create a **build.sh** script in a text editor.
179-
```
180-
nano build.sh
181-
```
182-
183-
2. Add the following text to the **build.sh** file.
184-
```
185-
source /opt/intel/inteloneapi/setvars.sh > /dev/null 2>&1
186-
mkdir build
187-
cd build
188-
cmake ..
189-
make
190-
```
191-
192-
3. Save and close the **build.sh** file.
193-
194-
4. Create a **run.sh** script in a text editor.
195-
```
196-
nano run.sh
197-
```
198-
199-
5. Add the following text to the **run.sh** file.
200-
```
201-
source /opt/intel/inteloneapi/setvars.sh > /dev/null 2>&1
202-
cd build
203-
make run
204-
```
205-
206-
6. Save and close the **run.sh** file.
207-
208-
### Build and Run the Sample
209-
210-
Jobs submitted in batch mode are placed in a queue waiting for the necessary resources (compute nodes) to become available. The jobs are executed on a first-come, first-run basis on the first available node(s) having the requested property or label.
211-
212-
1. Build the sample on a GPU node.
213-
```
214-
qsub -l nodes=1:gpu:ppn=2 -d . build.sh
215-
```
216-
- `-l nodes=1:gpu:ppn=2` (lower case L) assigns one full GPU node to the job.
217-
- `-d .` configures the current folder as the working directory for the task.
218-
219-
2. Use the qstat utility to inspect the job progress.
220-
```
221-
watch -n 1 qstat -n -1
222-
```
223-
- The watch `-n 1` command is used to run `qstat -n -1` and display its results every second.
224-
225-
When the build job completes, there will be a **build.sh.oXXXXXX** file in the directory.
226-
227-
> **Note**: Some files are written to the disk when each job terminates.
228-
>- **<script_name>.sh.eXXXX** = the job stderr
229-
> - **<script_name>.sh.oXXXX** = the job stdout
230-
> - where **XXXX** is the job ID printed to the screen after each qsub command.
231-
232-
3. Once the job completes, run the sample on a GPU node.
233-
```
234-
qsub -l nodes=1:gpu:ppn=2 -d . run.sh
235-
```
236-
4. Inspect the output of the sample.
237-
```
238-
cat run.sh.oXXXX
239-
```
240-
### Example Output in Intel&reg; DevCloud
241-
242-
You should see output similar to the following:
243-
```
244-
Platform Name: Intel(R) OpenCL HD Graphics
245-
Platform Version: OpenCL 2.1
246-
Device Name: Intel(R) Gen9 HD Graphics NEO
247-
Max Work Group: 256
248-
Max Compute Units: 24
249-
250-
Parallel Mandelbrot set using buffers.
251-
Rendered image output to file: mandelbrot.png (output too large to display in text)
252-
Serial time: 0.0430331s
253-
Parallel time: 0.00224131s
254-
Successfully computed Mandelbrot set.
255-
```
256-
5. Optionally, remove the stdout and stderr files and clean-up the project files.
257-
```
258-
rm build.sh.*; rm run.sh.*; make clean
259-
```
260-
6. Disconnect from the Intel&reg; DevCloud.
261-
```
262-
exit
263-
```
264140
## License
265141
Code samples are licensed under the MIT license. See
266142
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt) for details.
267143
268-
Third party program licenses are at [third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt).
144+
Third party program licenses are at [third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt).

0 commit comments

Comments
 (0)