Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Tools/Advisor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Code Samples of Intel(R) Advisor

| Code sample name | Supported Intel(r) Architecture(s) | Description
|:--- |:--- |:---
| matrix_multiply | GPU, CPU | Simple matrix multiplication program


## License
The code samples are licensed under MIT license
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Matrix Multiply Sample
A sample containing multiple implementations of matrix multiplication. This sample code is implemented using DPC++ language for CPU and GPU.

| Optimized for | Description
|:--- |:---
| OS | Linux Ubuntu 18.04; Windows 10
| Hardware | Kaby Lake with GEN9 or newer
| Software | Intel(R) oneAPI DPC++ Compiler (beta); Intel(R) Advisor
| What you will learn | How to profile an application using Intel(R) Advisor
| Time to complete | 15 minutes

## Purpose

The Matrix Multiplication sample performs basic matrix multiplication. Three version are provided that use different features of DPC++.

## Key Implementation details

The basic DPC++ implementation explained in the code includes device selector, buffer, accessor, kernel, and command groups.

## License
This code sample is licensed under MIT license

## How to Build

This sample contains 3 version of matrix multiplication using DPC++:

multiply1 – basic implementation of matrix multiply using DPC++
multiply1_1 – basic implementation that replaces the buffer store with a local accessor “acc” to reduce memory traffic
multiply1_2 – basic implementation plus the local accessor and matrix tiling

Edit the line in multiply.h to select the version of the multiply function:
#define MULTIPLY multiply1


### On a Linux* System
To build DPC++ version:
cd <sample dir>
cmake .
make

Clean the program
make clean

### On a Windows* System Using Visual Studio 2017 or newer
* Open Visual Studio 2017
* Select Menu "File > Open > Project/Solution", find "matrix_multiply" folder and select "matrix_multiply.sln"
* Select Menu "Project > Build" to build the selected configuration
* Select Menu "Debug > Start Without Debugging" to run the program

### on Windows - command line - Build the program using MSBuild
DPCPP Configurations:
Release - MSBuild matrix_multiply.sln /t:Rebuild /p:Configuration="Release"
Debug - MSBuild matrix_multiply.sln /t:Rebuild /p:Configuration="Debug"


## Running the Sample

### Example of Output

./matrix.dpcpp
Address of buf1 = 0x7f5e687eb010
Offset of buf1 = 0x7f5e687eb180
Address of buf2 = 0x7f5e67fea010
Offset of buf2 = 0x7f5e67fea1c0
Address of buf3 = 0x7f5e677e9010
Offset of buf3 = 0x7f5e677e9100
Address of buf4 = 0x7f5e66fe8010
Offset of buf4 = 0x7f5e66fe8140
Using multiply kernel: multiply1
Running on Intel(R) Gen9
Elapsed Time: 0.539631s

## Running an Intel Advisor analysis
------------------------------------------

See the Advisor Cookbook here: https://software.intel.com/en-us/advisor-cookbook

6 changes: 6 additions & 0 deletions Tools/Advisor/matrix_multiply_advisor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(CMAKE_CXX_COMPILER dpcpp)
cmake_minimum_required(VERSION 3.0)
project(matrix_multiply)
set(CMAKE_CXX_FLAGS "-g -O3 -fsycl -Wno-write-strings -w -D_Linux")
add_executable(matrix.dpcpp src/matrix.cpp src/multiply.cpp)
add_custom_target(run ./matrix.dpcpp)
7 changes: 7 additions & 0 deletions Tools/Advisor/matrix_multiply_advisor/License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright Intel Corporation

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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.
72 changes: 72 additions & 0 deletions Tools/Advisor/matrix_multiply_advisor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Matrix Multiply Sample
A sample containing multiple implementations of matrix multiplication. This sample code is implemented using DPC++ language for CPU and GPU.

| Optimized for | Description
|:--- |:---
| OS | Linux Ubuntu 18.04; Windows 10
| Hardware | Kaby Lake with GEN9 or newer
| Software | Intel(R) oneAPI DPC++ Compiler (beta); Intel(R) Advisor
| What you will learn | How to profile an application using Intel(R) Advisor
| Time to complete | 15 minutes

## Purpose

The Matrix Multiplication sample performs basic matrix multiplication. Three version are provided that use different features of DPC++.

## Key Implementation details

The basic DPC++ implementation explained in the code includes device selector, buffer, accessor, kernel, and command groups.
The include folder is located at %ONEAPI_ROOT%\dev-utilities\latest\include on your development system.

## License
This code sample is licensed under MIT license

## How to Build
Copy link
Contributor

@JoeOster JoeOster Aug 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment to Readme in regards to the location of dpc_common.hpp, should look similar to this:

Building the Program for CPU and GPU
Include Files
The include folder is located at %ONEAPI_ROOT%\dev-utilities\latest\include on your development system.

as seen in https://github.com/oneapi-src/oneAPI-samples/tree/master/DirectProgramming/DPC%2B%2B/CombinationalLogic/sepia-filter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


This sample contains 3 version of matrix multiplication using DPC++:

multiply1 – basic implementation of matrix multiply using DPC++
multiply1_1 – basic implementation that replaces the buffer store with a local accessor “acc” to reduce memory traffic
multiply1_2 – basic implementation plus the local accessor and matrix tiling

Edit the line in multiply.h to select the version of the multiply function:
#define MULTIPLY multiply1


### On a Linux* System
To build DPC++ version:
cd <sample dir>
cmake .
make

Clean the program
make clean

### On a Windows* System Using Visual Studio 2017 or newer
* Open Visual Studio 2017
* Select Menu "File > Open > Project/Solution", find "matrix_multiply" folder and select "matrix_multiply.sln"
* Select Menu "Project > Build" to build the selected configuration
* Select Menu "Debug > Start Without Debugging" to run the program

### on Windows - command line - Build the program using MSBuild
DPCPP Configurations:
Release - MSBuild matrix_multiply.sln /t:Rebuild /p:Configuration="Release"
Debug - MSBuild matrix_multiply.sln /t:Rebuild /p:Configuration="Debug"



### Example of Output
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you view this file, the out put for the "example of output" is incorrectly formatted"


./matrix.dpcpp

Using multiply kernel: multiply1

Running on Intel(R) Gen9

Elapsed Time: 0.539631s

## Running an Intel Advisor analysis
------------------------------------------

See the Advisor Cookbook here: https://software.intel.com/en-us/advisor-cookbook

25 changes: 25 additions & 0 deletions Tools/Advisor/matrix_multiply_advisor/matrix_multiply.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29209.62
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "matrix_multiply", "matrix_multiply.vcxproj", "{D209315E-99B1-47B6-9E4B-C922C022BE8C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D209315E-99B1-47B6-9E4B-C922C022BE8C}.Debug|x64.ActiveCfg = Debug|x64
{D209315E-99B1-47B6-9E4B-C922C022BE8C}.Debug|x64.Build.0 = Debug|x64
{D209315E-99B1-47B6-9E4B-C922C022BE8C}.Release|x64.ActiveCfg = Release|x64
{D209315E-99B1-47B6-9E4B-C922C022BE8C}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6553E447-FADC-4836-9E68-26B86B68512B}
EndGlobalSection
EndGlobal
Loading