Intel® oneAPI HPC Toolkit
An internet connection is required to download the samples for oneAPI toolkits. If you are using an offline system, download the samples from a system that is internet connected and transfer the sample files to your offline system. The samples can be downloaded from here:Intel® oneAPI HPC Toolkit Code Samples
To compile and run a sample:
- Configure your development environment using the steps described in Configure Your System.
- Download the sample using the oneAPI CLI Samples Browser.
- Compile and run the sample with Make*
Download Samples using the oneAPI CLI Samples Browser
Use the oneAPI CLI Samples Browser to browse the collection of online oneAPI samples. As you browse the oneAPI samples, you can copy them to your local disk as buildable sample projects. Most oneAPI sample projects are built using Make or CMake, so the build instructions are included as part of the sample in a README file. The oneAPI CLI utility is a single-file, stand-alone executable that has no dependencies on dynamic runtime libraries. You can find the samples browser in the <install-dir>/dev-utilities/latest/bin folder on your development host system.
- Open a terminal window.
- Navigate to the install directory.
- If you have not done so already, source setvars.sh.
- Run the application (it should be in your PATH):
oneapi-cliThe oneAPI CLI menu appears:
- Move the arrow key down to select Create a project , then press Enter.
- Select the language for your sample. For your first project, select cpp, then press Enter. The toolkit samples list appears. Scroll down to see the full list of samples. Select one of these samples for your first project:
Toolkit Sample Name Intel® oneAPI Base Toolkit Vector Add Intel® oneAPI HPC Toolkit Matrix Multiplication Intel® oneAPI IoT Toolkit IoT Hello World Intel® oneAPI DL Framework Developer Toolkit CCL Getting Started
- After you select a sample, press Enter.
- Enter an absolute or a relative directory path to create your project. Provide a directory and project name. The Project Name is the name of the sample you chose in the previous step.
- Press Tab to select Create, then press Enter:
The directory path is printed to the command line.
Now that you have the samples downloaded, compile and run the sample with CMake*
Compile and Run a Sample Using Make*
NoteThe Matrix Multiplier sample does not require CMake*, but manny of the other samples do require CMake. If you have not installed CMake, follow the directions Configure Your System.
Build the matrix_mul Program using Make:
cd matrix_mul && make allRun the Program
make runClean the Program
Create a Project Based on a oneAPI Sample using CMake
To run a different sample using CMake, where <sample_name> is the name of the sample you want to run:
- If necessary, re-run the command-line utility and select a CMake project that contains a CMakeLists.txt file.
cd <sample_name> &&
- Navigate to the build directory.
mkdir build && cd build &&
- Build the program. Run CMake in the build directory to create the makefile. Use the newly created makefile to build the executable.
cmake ../. && make VERBOSE=1
- Run the program.
- Clean the program.