Skip to content

Commit ce96e51

Browse files
authored
Update intrinsics readme.md file (oneapi-src#1081)
Restructured to match new template. Corrected links. Updated branding. Corrected some formatting.
1 parent 75b6896 commit ce96e51

File tree

1 file changed

+75
-61
lines changed
  • DirectProgramming/C++/CompilerInfrastructure/Intrinsics

1 file changed

+75
-61
lines changed
Lines changed: 75 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,105 @@
11
# `Intrinsics` Sample
22

3-
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.
44

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
129

1310

1411
## Purpose
1512

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.
1714

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
1926

2027
## Key Implementation Details
2128

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:
2330
- Computing a dot product of two vectors
2431
- 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.
2632

33+
The implementations include multiple functions to accomplish these tasks, each one using a different set of intrinsics available to the Intel® processor family.
2734

28-
## License
35+
## Set Environment Variables
2936

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.
3238

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
3440

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).
3549

36-
### Using Visual Studio Code* (Optional)
50+
### Use Visual Studio Code* (VS Code) (Optional)
3751

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.
4054

4155
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.
4660

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).
4963

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*
5165

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+
```
5374

54-
> **Note**: If you have not already done so, set up your CLI
55-
> environment by sourcing the `setvars` script located in
56-
> the root of your oneAPI installation.
57-
>
58-
> Linux Sudo: . /opt/intel/oneapi/setvars.sh
59-
>
60-
> Linux User: . ~/intel/oneapi/setvars.sh
61-
>
62-
> Windows: C:\Program Files(x86)\Intel\oneAPI\setvars.bat
63-
>
64-
>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
6576

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
7182

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:
7390
```
74-
make run (or "make debug_run" to run the debug version)
91+
make run
7592
```
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)
7898
```
7999
make clean
80100
```
81101

82-
If an error occurs, troubleshoot the problem using the Diagnostics Utility for Intel® oneAPI Toolkits.
83-
[Learn more](https://software.intel.com/content/www/us/en/develop/documentation/diagnostic-utility-user-guide/top.html)
84-
85-
### Application Parameters
86-
87-
These intrinsics samples have relatively few modifiable parameters. However, specific options are available to the user:
88-
89-
1. intrin_dot_sample: Line 35 defines the size of the vectors used in the dot product computation.
90-
91-
2. intrin_double_sample: Lines 244-247 define the values of the two complex numbers used in the computation.
92-
93-
3. intrin_ftz_sample: This sample has no modifiable parameters.
94-
95-
### Example of Output
102+
### Example Output
96103
```
97104
Dot Product computed by C: 4324.000000
98105
Dot Product computed by C + SIMD: 4324.000000
@@ -108,3 +115,10 @@ Complex Product(Intel(R) SSE2): 23.00+ -2.00i
108115
FTZ is set.
109116
DAZ is set.
110117
```
118+
119+
## License
120+
121+
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

Comments
 (0)