Skip to content

Commit 40eb650

Browse files
authored
2024.0 updates (#2045)
* AI README.md Updates * Missing updates to 2024.0
1 parent 24d3d6f commit 40eb650

File tree

240 files changed

+149506
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+149506
-1
lines changed

DirectProgramming/C++SYCL/DenseLinearAlgebra/guided_jacobiCudaGraphs_SYCLMigration/sample.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"toolchain": [ "dpcpp" ],
77
"languages": [ { "cpp": {} } ],
88
"targetDevice": [ "CPU", "GPU" ],
9+
"gpuRequired": ["pvc"],
910
"os": [ "linux" ],
1011
"builder": [ "cmake" ],
1112
"ciTests": {

Libraries/MPI/jacobian_solver/sample.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"dependencies": [ "compiler|icpx,icx","mpi" ],
88
"languages": [ { "cpp": { "properties": { "projectOptions": [ { "projectType": "makefile" } ] } } } ],
99
"targetDevice": [ "GPU" ],
10+
"gpuRequired": ["gen9"],
1011
"os": [ "linux" ],
1112
"builder": [ "make" ],
1213
"ciTests": {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
cmake_minimum_required (VERSION 3.4)
2+
3+
if(UNIX)
4+
# Direct CMake to use icpx rather than the default C++ compiler/linker
5+
set(CMAKE_CXX_COMPILER icpx)
6+
else() # Windows
7+
# Force CMake to use icx-cl rather than the default C++ compiler/linker
8+
# (needed on Windows only)
9+
include (CMakeForceCompiler)
10+
CMAKE_FORCE_CXX_COMPILER (icx-cl IntelDPCPP)
11+
include (Platform/Windows-Clang)
12+
endif()
13+
14+
project(nstreams_ds CXX)
15+
16+
set(CMAKE_CXX_FLAGS "-fsycl -Wall")
17+
18+
add_executable(1_nstreams_sycl ./src/1_nstreams_sycl.cpp)
19+
add_executable(2_nstreams_policies ./src/2_nstreams_policies.cpp)
20+
21+
target_link_libraries(1_nstreams_sycl sycl)
22+
target_link_libraries(2_nstreams_policies sycl)
23+
24+
add_custom_target(run_sycl 1_nstreams_sycl 1000)
25+
add_custom_target(run_policies 2_nstreams_policies 1000 1)
26+
add_custom_target(run_all 1_nstreams_sycl 1000
27+
COMMAND 2_nstreams_policies 1000 1)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright Intel Corporation
2+
3+
SPDX-License-Identifier: MIT
4+
https://opensource.org/licenses/MIT
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# `nstreams_device_selection` Sample
2+
3+
The `nstreams_device_selection` sample demonstrates how to use the Intel® oneAPI Base Toolkit (Base Kit) and Intel® oneAPI DPC++ Library (oneDPL) found in the Base Kit to apply device selection policies using a simple application based on nstreams.
4+
5+
For comprehensive instructions, see the [Intel® oneAPI Programming Guide](https://www.intel.com/content/www/us/en/docs/oneapi/programming-guide/current/overview.html) and search based on relevant terms noted in the comments.
6+
7+
| Property | Description
8+
|:--- |:---
9+
| What you will learn | How to offload the computation to specific devices and use policies to different dynamic offload strategies.
10+
| Time to complete | 30 minutes
11+
12+
## Purpose
13+
14+
This sample performs a simple element-wise parallel computation on three vectors: `A`, `B` and `C`. For each element `i`, it computes `A[i] += B[i] + scalar * C[i]`. Additional information can be found on the [Optimizing Memory Bandwidth on Stream Triad](https://www.intel.com/content/www/us/en/developer/articles/technical/optimizing-memory-bandwidth-on-stream-triad.html) page. This sample starts with a simple implementation of device offload using SYCL*. The second version of the code shows how to introduce Dynamic Device Selection and uses device specific policies that can be selected by supplying different arguments when invoking the application.
15+
16+
The sample includes two different versions of the nstreams project:
17+
1. `1_nstreams_sycl.cpp`: basic SYCL implementation; creates a kernel that targets the system's CPU.
18+
2. `2_nstreams_policies.cpp`: version of the sample that includes five policies:
19+
1. Static CPU
20+
2. Static GPU
21+
3. Round Robin policy CPU/GPU
22+
4. Dynamic Load policy CPU/GPU
23+
5. Auto Tune policy CPU/GPU
24+
25+
The varying policies are helpful as follows:
26+
1. **Fixed CPU:** This is the simplest implementation. It can be helpful to start implementations using fixed CPU since any debug or troubleshooting will be considerably easier.
27+
2. **Fixed GPU:** This an incremental step that simply designates the offload kernel to run on the GPU, isolating functionality to help triage any problems that may arise when targeting the GPU.
28+
3. **Round Robin:** Assigns the function to the next available device as specified in the "universe". The capability is particularly beneficial in *multi-GPU systems*. Note that performance benefits may not be realized on single GPU platforms but will scale accordingly on multi-GPU systems.
29+
4. **Dynamic Load** selects the device that has the most available capacity at that moment based on the number of unfinished submissions. This can be useful for offloading kernels of varying cost to devices of varying performance.
30+
5. **Auto-tune** performs run-time profile sampling of the performance of the kernel on the available devices before selecting a final device to use. The choice is made based on runtime performance history, so this policy is only useful for kernels that have stable performance.
31+
32+
[Detailed Descriptions of the Policies](https://www.intel.com/content/www/us/en/docs/onedpl/developer-guide/current/policies.html) are available in the Intel® oneAPI DPC++ Library Developer Guide and Reference.
33+
34+
>NOTE: Given the simplicity of this example, performance benefits may not be gained depending on the available devices.
35+
>
36+
37+
Dynamic Device Selection support customization to allow frameworks or application developers to define custom logic for making device selections. Complete reference documentation is available in the [oneAPI DPC++ Library Developer Guide](https://www.intel.com/content/www/us/en/docs/onedpl/developer-guide/2022-2/overview.html).
38+
39+
## Key Implementation Details
40+
41+
The basic SYCL standards implemented in the code include the use of the following:
42+
- Fixed (CPU and GPU) policies.
43+
- Dynamic policies Round Robin, Load, and Auto-tune.
44+
- Basic structure: header, namespace, define universe, setup policies, wrap kernel, and return event. **Note: a return event is required for all Dynamic Device Selection usage.**
45+
46+
## Building the `nstreams_device_selection` Program for CPU and GPU
47+
48+
> **Note**: If you have not already done so, set up your CLI
49+
> environment by sourcing the `setvars` script located in
50+
> the root of your oneAPI installation.
51+
>
52+
> Linux:
53+
> - For system wide installations: `. /opt/intel/oneapi/setvars.sh`
54+
> - For private installations: `. ~/intel/oneapi/setvars.sh`
55+
>
56+
> Windows:
57+
> - `C:\Program Files(x86)\Intel\oneAPI\setvars.bat`
58+
>
59+
>For more information on environment variables, see Use the setvars Script for [Linux or macOS](https://www.intel.com/content/www/us/en/docs/oneapi/programming-guide/2023-1/use-the-setvars-script-with-linux-or-macos.html#GUID-D01C791A-E72A-4EA5-A45A-AEF22F1E8506), or [Windows](https://www.intel.com/content/www/us/en/docs/oneapi/programming-guide/2023-1/use-the-setvars-script-with-windows.html#GUID-A76C1E1B-5235-4A16-9AA3-F5BD35F8C7F1).
60+
61+
62+
### Using Visual Studio Code* (Optional)
63+
64+
You can use Visual Studio Code (VS Code) extensions to set your environment, create launch configurations, and browse and download samples.
65+
66+
The basic steps to build and run a sample using VS Code include:
67+
- Download a sample using the extension **Code Sample Browser for Intel® oneAPI Toolkits**.
68+
- Configure the oneAPI environment with the extension **Environment Configurator for Intel® oneAPI Toolkits**.
69+
- Open a Terminal in VS Code (**Terminal>New Terminal**).
70+
- Run the sample in the VS Code terminal using the instructions below.
71+
72+
To learn more about the extensions and how to configure the oneAPI environment, see
73+
[Using Visual Studio Code with Intel® oneAPI Toolkits User Guide](https://www.intel.com/content/www/us/en/docs/oneapi/user-guide-vs-code/current/overview.html).
74+
75+
### On Linux*
76+
Perform the following steps:
77+
1. Build the program using the following `cmake` commands.
78+
```
79+
$ mkdir build
80+
$ cd build
81+
$ cmake ..
82+
$ make
83+
```
84+
85+
2. Run the program.
86+
```
87+
$ make run_all
88+
```
89+
> **Note**: by default, only CPU devices are run. Use ``sycl-ls`` to see available devices on your target system.
90+
91+
Manually envoking the application requires supplying a vector length. 1000 is used in the examples below.
92+
93+
For the basic SYCL implementation:
94+
```
95+
$ ./1_nstreams_sycl 1000
96+
```
97+
98+
For Dynamic Device Selection, usage: ./2_nstreams_policies 1000 <policy>. For example, Fixed Resource Policy (CPU):
99+
```
100+
$ ./2_nstreams_policies 1000 1
101+
```
102+
103+
| Arg | Dynamic Device Selection Policy
104+
|:--- |:---
105+
| 1 | Fixed Resource Policy (CPU)
106+
| 2 | Fixed Resource Policy (GPU)
107+
| 3 | Round Robin Policy
108+
| 4 | Dynamic Load Policy
109+
| 5 | Auto Tune Policy
110+
111+
3. Clean the program. (Optional).
112+
```
113+
make clean
114+
```
115+
116+
If an error occurs, you can get more details by running `make` with the `VERBOSE=1` argument:
117+
```
118+
make VERBOSE=1
119+
```
120+
121+
### Troubleshooting
122+
If you receive an error message, troubleshoot the problem using the Diagnostics Utility for Intel® oneAPI Toolkits, which provides system checks to find missing dependencies and permissions errors. See [Diagnostics Utility for Intel® oneAPI Toolkits User Guide](https://www.intel.com/content/www/us/en/develop/documentation/diagnostic-utility-user-guide/top.html).
123+
124+
125+
### On Windows* Using Visual Studio* Version 2019 or Newer
126+
127+
- Build the program using VS2019 or VS2022
128+
- Right-click on the solution file and open using either VS2019 or VS2022 IDE.
129+
- Right-click on the project in Solution Explorer and select Set as Startup Project.
130+
- Select the correct correct configuration from the drop down list in the top menu (5_GPU_optimized has more arguments to choose)
131+
- Right-click on the project in Solution Explorer and select Rebuild.
132+
- From the top menu, select Debug -> Start without Debugging.
133+
> **Note**: Remember to use Release mode for better performance.
134+
135+
- Build the program using MSBuild
136+
- Open "x64 Native Tools Command Prompt for VS2019" or "x64 Native Tools Command Prompt for VS2022"
137+
- Run the following command: `MSBuild "nstreams_device_selection.sln" /t:Rebuild /p:Configuration="Release"`
138+
139+
### Application Parameters
140+
141+
You can run individual nstream executables and modify parameters from the command line.
142+
143+
`./<executable_name> <vector length> <policy>`
144+
145+
For example:
146+
147+
```
148+
$ ./2_nstreams_policy 1000 2
149+
```
150+
Where:
151+
152+
vector length : The size of the A, B and C vectors.
153+
Policy : Specifies the dynamic device selection policy (only valid for 2_nstreams_policy).
154+
155+
## Example Output
156+
157+
```
158+
Using Static Policy (CPU) to iterate on CPU device with vector length: 10000
159+
11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
160+
11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
161+
...
162+
11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
163+
11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
164+
165+
Rate: larger better (MB/s): 120.042
166+
Avg time: lower better (ns): 1.33287e+06
167+
```
168+
169+
170+
## License
171+
172+
Code samples are licensed under the MIT license. See
173+
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt) for details.
174+
175+
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).
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.4.33110.190
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "1_nstreams_sycl", "nstreams_sycl.vcxproj", "{CF4E39D0-D3FF-45EA-9889-A14D0CEF6F9A}"
7+
EndProject
8+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2_nstreams_policies", "nstreams_policies.vcxproj", "{656254D8-D86E-4F37-9FAF-1BC4244B9EF9}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|x64 = Debug|x64
13+
Release|x64 = Release|x64
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{CF4E39D0-D3FF-45EA-9889-A14D0CEF6F9A}.Debug|x64.ActiveCfg = Debug|x64
17+
{CF4E39D0-D3FF-45EA-9889-A14D0CEF6F9A}.Debug|x64.Build.0 = Debug|x64
18+
{CF4E39D0-D3FF-45EA-9889-A14D0CEF6F9A}.Release|x64.ActiveCfg = Release|x64
19+
{CF4E39D0-D3FF-45EA-9889-A14D0CEF6F9A}.Release|x64.Build.0 = Release|x64
20+
{656254D8-D86E-4F37-9FAF-1BC4244B9EF9}.Debug|x64.ActiveCfg = Debug|x64
21+
{656254D8-D86E-4F37-9FAF-1BC4244B9EF9}.Debug|x64.Build.0 = Debug|x64
22+
{656254D8-D86E-4F37-9FAF-1BC4244B9EF9}.Release|x64.ActiveCfg = Release|x64
23+
{656254D8-D86E-4F37-9FAF-1BC4244B9EF9}.Release|x64.Build.0 = Release|x64
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {AF71E9D3-F7D7-40DF-840B-76CCF923D092}
30+
EndGlobalSection
31+
EndGlobal
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|x64">
5+
<Configuration>Debug</Configuration>
6+
<Platform>x64</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|x64">
9+
<Configuration>Release</Configuration>
10+
<Platform>x64</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<ItemGroup>
14+
<ClCompile Include="src\2_nstreams_policies.cpp" />
15+
</ItemGroup>
16+
<PropertyGroup Label="Globals">
17+
<ProjectGuid>{656254d8-d86e-4f37-9faf-1bc4244b9ef9}</ProjectGuid>
18+
<Keyword>Win32Proj</Keyword>
19+
<RootNamespace>_2_nstreams_policies</RootNamespace>
20+
<ProjectName>2_nstreams_policies</ProjectName>
21+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
22+
</PropertyGroup>
23+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
24+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
25+
<ConfigurationType>Application</ConfigurationType>
26+
<UseDebugLibraries>true</UseDebugLibraries>
27+
<PlatformToolset>Intel(R) oneAPI DPC++ Compiler 2024</PlatformToolset>
28+
<CharacterSet>Unicode</CharacterSet>
29+
</PropertyGroup>
30+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
31+
<ConfigurationType>Application</ConfigurationType>
32+
<UseDebugLibraries>false</UseDebugLibraries>
33+
<PlatformToolset>Intel(R) oneAPI DPC++ Compiler 2024</PlatformToolset>
34+
<WholeProgramOptimization>true</WholeProgramOptimization>
35+
<CharacterSet>Unicode</CharacterSet>
36+
</PropertyGroup>
37+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
38+
<ImportGroup Label="ExtensionSettings">
39+
</ImportGroup>
40+
<ImportGroup Label="Shared">
41+
</ImportGroup>
42+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
43+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
44+
</ImportGroup>
45+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
46+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
47+
</ImportGroup>
48+
<PropertyGroup Label="UserMacros" />
49+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
50+
<LinkIncremental>true</LinkIncremental>
51+
<IntDir>$(Platform)\$(Configuration)\2_nstreams_policies\</IntDir>
52+
</PropertyGroup>
53+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
54+
<LinkIncremental>false</LinkIncremental>
55+
<IntDir>$(Platform)\$(Configuration)\2_nstreams_policies\</IntDir>
56+
</PropertyGroup>
57+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
58+
<ClCompile>
59+
<PrecompiledHeader>Use</PrecompiledHeader>
60+
<WarningLevel>Level3</WarningLevel>
61+
<Optimization>Disabled</Optimization>
62+
<SDLCheck>true</SDLCheck>
63+
<ConformanceMode>true</ConformanceMode>
64+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
65+
<SYCLWarningLevel>DisableAllWarnings</SYCLWarningLevel>
66+
</ClCompile>
67+
<Link>
68+
<SubSystem>Console</SubSystem>
69+
<GenerateDebugInformation>true</GenerateDebugInformation>
70+
</Link>
71+
</ItemDefinitionGroup>
72+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
73+
<ClCompile>
74+
<PrecompiledHeader>Use</PrecompiledHeader>
75+
<WarningLevel>Level3</WarningLevel>
76+
<Optimization>MaxSpeed</Optimization>
77+
<FunctionLevelLinking>true</FunctionLevelLinking>
78+
<IntrinsicFunctions>true</IntrinsicFunctions>
79+
<SDLCheck>true</SDLCheck>
80+
<ConformanceMode>true</ConformanceMode>
81+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
82+
<SYCLWarningLevel>DisableAllWarnings</SYCLWarningLevel>
83+
</ClCompile>
84+
<Link>
85+
<SubSystem>Console</SubSystem>
86+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
87+
<OptimizeReferences>true</OptimizeReferences>
88+
<GenerateDebugInformation>false</GenerateDebugInformation>
89+
</Link>
90+
</ItemDefinitionGroup>
91+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
92+
<ImportGroup Label="ExtensionTargets">
93+
</ImportGroup>
94+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
</ItemGroup>
9+
<ItemGroup>
10+
<ClCompile Include="src\2_nstreams_policies.cpp">
11+
<Filter>Source Files</Filter>
12+
</ClCompile>
13+
</ItemGroup>
14+
</Project>

0 commit comments

Comments
 (0)