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.
matrix_mul is a simple program that multiplies together two large matrices and
3
+
verifies the results. This program is implemented using two ways:
4
+
1. Data Parallel C++ (DPC++)
5
+
2. OpenMP (omp)
6
+
7
+
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 | Offloads computations on 2D arrays to GPU using Intel DPC++ and OpenMP
15
+
| Time to complete | 15 minutes
16
+
17
+
### Purpose
18
+
matrix_mul is a slightly more complex computation than vector_add by
19
+
multiplying two large matrices. The code will attempt to run the calculation
20
+
on both the GPU and CPU, and then verifies the results. The size of the
21
+
computation can be adjusted for heavier workloads (defined below). If
22
+
successful, the name of the offload device and a success message are
23
+
displayed.
24
+
25
+
This sample uses buffers to manage memory. For more information regarding
26
+
different memory management options, refer to the vector_add sample.
27
+
28
+
matrix_mul includes C++ implementations of both Data Parallel (DPC++) and
29
+
OpenMP; each is contained in its own .cpp file. This provides a way to compare
30
+
existing offload techniques such as OpenMP with Data Parallel C++ within a
31
+
relatively simple sample. The default will build the DPC++ application.
32
+
Separate OpenMP build instructions are provided below. Note: matrix_mul does not
33
+
support OpenMP on Windows.
34
+
35
+
The code will attempt first to execute on an available GPU and fallback to the system's CPU if a compatible GPU is not detected. The device used for compilation is displayed in the output.
36
+
37
+
## Key implementation details
38
+
SYCL implementation explained.
39
+
OpenMP offload implementation explained.
40
+
41
+
## License
42
+
This code sample is licensed under MIT license.
43
+
44
+
## Building the `matrrix_mul` Program for DPC++ and OpenMP
45
+
46
+
## Include Files
47
+
The include folder is located at "%ONEAPI_ROOT%\dev-utilities\latest\include" on your development system.
48
+
49
+
### Running Samples In DevCloud
50
+
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/hpc-toolkit/)
51
+
52
+
### How to build for DPC++ on Linux
53
+
* Build the program using Make
54
+
cd matrix_mul &&
55
+
make all
56
+
57
+
* Run the program
58
+
make run
59
+
60
+
* Clean the program
61
+
make clean
62
+
63
+
### How to Build for OpenMP on Linux
64
+
* Build the program using Make
65
+
cd matrix_mul &&
66
+
make build_omp
67
+
68
+
* Run the program
69
+
make run_omp
70
+
71
+
* Clean the program
72
+
make clean
73
+
74
+
### How to build for DPC++ on Windows
75
+
The OpenMP offload target is not supported on Windows yet.
0 commit comments