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
The intrinsic samples are designed to show how to utilize the intrinsics supported by the Intel® C++ Compiler in various applications. The src folder contains three .cpp source files, each demonstrating different intrinsics' functionality, including vector operations, complex numbers computations, and FTZ/DAZ flags.
3
+
This `Intrinsics` sample demonstrates how to use intrinsics supported by the Intel® C++ Compiler.
4
4
5
-
| Optimized for | Description
6
-
|:--- |:---
7
-
| OS | MacOS* Catalina* or newer
8
-
| Hardware | Skylake with GEN9 or newer
9
-
| Software | Intel® oneAPI C++ Compiler Classic
10
-
| What you will learn | How to utilize intrinsics supported by the Intel® oneAPI C++ Compiler Classic
11
-
| Time to complete | 15 minutes
5
+
| Area | Description
6
+
|:--- |:---
7
+
| What you will learn | How to use intrinsics supported by the Intel® C++ Compiler
8
+
| Time to complete | 15 minutes
12
9
13
10
14
11
## Purpose
15
12
16
-
Intrinsics are assembly-coded functions that allow you to use C++ function calls and variables in place of assembly instructions. Intrinsics are expanded inline, eliminating function call overhead. While providing the same benefits as using inline assembly, intrinsics improve code readability, assist instruction scheduling, and help when debugging. They provide access to instructions that cannot be generated using the C and C++ languages' standard constructs and allow code to leverage performance-enhancing features unique to specific processors.
13
+
Intrinsics are assembly-coded functions that allow you to use C++ function calls and variables in place of assembly instructions. Intrinsics expand inline, eliminating function call overhead. While providing the same benefits as using inline assembly, intrinsics improve code readability, assist instruction scheduling, and help when debugging. They provide access to instructions that cannot be generated using C and C++ language standard constructs and allow code to use performance-enhancing features unique to specific processors.
17
14
18
-
Further information on intrinsics can be found [here](https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/intrinsics.html#intrinsics_GUID-D70F9A9A-BAE1-4242-963E-C3A12DE296A1):
15
+
The `src` folder contains three .cpp source files, each demonstrating different functionality, including vector operations, complex numbers computations, and FTZ/DAZ flags.
16
+
17
+
You can find detailed information in the *Intrinsics* section of the [Intel® C++ Compiler Classic Developer Guide and Reference](https://www.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/).
18
+
19
+
## Prerequisites
20
+
21
+
| Optimized for | Description
22
+
|:--- |:---
23
+
| OS | macOS* Catalina* or newer
24
+
| Hardware | Skylake with GEN9 or newer
25
+
| Software | Intel® C++ Compiler
19
26
20
27
## Key Implementation Details
21
28
22
-
This sample makes use of intrinsic functions to perform common mathematical operations, including:
29
+
This sample uses intrinsic functions to perform common mathematical operations, including:
23
30
- Computing a dot product of two vectors
24
31
- Computing the product of two complex numbers
25
-
The implementations include multiple functions to accomplish these tasks, each one leveraging a different set of intrinsics available to Intel® processors.
26
32
33
+
The implementations include multiple functions to accomplish these tasks, each one using a different set of intrinsics available to the Intel® processor family.
27
34
28
-
## License
35
+
## Set Environment Variables
29
36
30
-
Code samples are licensed under the MIT license. See
31
-
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt) for details.
37
+
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 that your compiler, libraries, and tools are ready for development.
32
38
33
-
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)
39
+
## Build the `Intrinsics` Program
34
40
41
+
> **Note**: If you have not already done so, set up your CLI
42
+
> environment by sourcing the `setvars` script in the root of your oneAPI installation.
43
+
>
44
+
> - For system wide installations: `. /opt/intel/oneapi/setvars.sh`
45
+
> - For private installations: ` . ~/intel/oneapi/setvars.sh`
46
+
> - For non-POSIX shells, like csh, use the following command: `bash -c 'source <install-dir>/setvars.sh ; exec csh'`
47
+
>
48
+
> For more information on configuring environment variables, see [Use the setvars Script with 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).
35
49
36
-
### Using Visual Studio Code* (Optional)
50
+
### Use Visual Studio Code* (VS Code) (Optional)
37
51
38
-
You can use Visual Studio Code (VS Code) extensions to set your environment, create launch configurations,
39
-
and browse and download samples.
52
+
You can use Visual Studio Code* (VS Code) extensions to set your environment,
53
+
create launch configurations, and browse and download samples.
40
54
41
55
The basic steps to build and run a sample using VS Code include:
42
-
- Download a sample using the extension **Code Sample Browser for Intel oneAPI Toolkits**.
43
-
- Configure the oneAPI environment with the extension **Environment Configurator for Intel oneAPI Toolkits**.
44
-
- Open a Terminal in VS Code (**Terminal>New Terminal**).
45
-
- Run the sample in the VS Code terminal using the instructions below.
56
+
1. Configure the oneAPI environment with the extension **Environment Configurator for Intel® oneAPI Toolkits**.
57
+
2. Download a sample using the extension **Code Sample Browser for Intel® oneAPI Toolkits**.
58
+
3. Open a terminal in VS Code (**Terminal > New Terminal**).
59
+
4. Run the sample in the VS Code terminal using the instructions below.
46
60
47
-
To learn more about the extensions and how to configure the oneAPI environment, see
48
-
[Using Visual Studio Code with Intel® oneAPI Toolkits](https://www.intel.com/content/www/us/en/develop/documentation/using-vs-code-with-intel-oneapi/top.html).
61
+
To learn more about the extensions and how to configure the oneAPI environment, see the
62
+
[Using Visual Studio Code with Intel® oneAPI Toolkits User Guide](https://www.intel.com/content/www/us/en/develop/documentation/using-vs-code-with-intel-oneapi/top.html).
49
63
50
-
After learning how to use the extensions for Intel oneAPI Toolkits, return to this readme for instructions on how to build and run a sample.
64
+
### On macOS*
51
65
52
-
## Building the `Intrinsics` Program
66
+
1. Build the program.
67
+
```
68
+
make
69
+
```
70
+
Alternatively, build the debug version, which compiles with the `-g` option.
71
+
```
72
+
make debug
73
+
```
53
74
54
-
> **Note**: If you have not already done so, set up your CLI
55
-
> environment by sourcing the `setvars` script located in
>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).
75
+
#### Troubleshooting
65
76
66
-
Perform the following steps:
67
-
1. Build the program using the following `make` commands.
68
-
```
69
-
$ make (or "make debug" to compile with the -g flag)
70
-
```
77
+
If you receive an error message, troubleshoot the problem using the **Diagnostics Utility for Intel® oneAPI Toolkits**. The diagnostic utility provides configuration and system checks to help find missing dependencies, permissions errors, and other issues. See the [Diagnostics Utility for Intel® oneAPI Toolkits User Guide](https://www.intel.com/content/www/us/en/develop/documentation/diagnostic-utility-user-guide/top.html) for more information on using the utility.
78
+
79
+
## Run the `Intrinsics` Program
80
+
81
+
### Configurable Parameters
71
82
72
-
2. Run the program:
83
+
The sample source files contain some configurable parameters.
84
+
85
+
- `intrin_dot_sample`: Modify line 35 to change the size of the vectors used in the dot product computation.
86
+
- `intrin_double_sample`: Modify lines 244-247 to define the values of the two complex numbers used in the computation.
87
+
- `intrin_ftz_sample`: This sample has no configurable parameters.
88
+
89
+
1. Run the program:
73
90
```
74
-
make run (or "make debug_run" to run the debug version)
91
+
make run
75
92
```
76
-
77
-
3. Clean the program using:
93
+
Alternatively, run the debug version.
94
+
```
95
+
make debug_run
96
+
```
97
+
2. Clean the program. (Optional)
78
98
```
79
99
make clean
80
100
```
81
101
82
-
If an error occurs, troubleshoot the problem using the Diagnostics Utility for Intel® oneAPI Toolkits.
Code samples are licensed under the MIT license. See
122
+
[License.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/License.txt) for details.
123
+
124
+
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).
0 commit comments