Learn how to take advantage of Intel® System Studio(ISS) IDE with Intel® Math Kernel Library (MKL) to bring convenience to developers. The IDE can help developers raise their efficiencies. Those who are familiar with developing on Eclipse can easily get started with this IDE.
Please make sure ISS is installed with MKL. ISS can be downloaded from /content/www/us/en/develop/tools/system-studio.html.
Figure 1.1 below illustrates the contents of the ISS package. There are three components that will be used in this article:
- eclipse: This folder contains executable files and run-time level libraries of the IDE.
- iss_ide_eclipse_launcher.sh: This bash file sets required environment variables then runs IDE.
- compilers_and_libraries: MKL is installed into <ISS_ROOT>/compilers_and_libraries/linux/mkl by default. Please check this folder to verify whether MKL is installed or not. The default is 'ISS_ROOT = /opt/intel/system_studio_2019'
Figure 1.1 Contents of Intel® System Studio 2019
Program with MKL in ISS IDE
Create a new project using the wizard
You can follow the following steps to create a new project in ISS IDE.
- Launch ISS IDE. Running of ISS IDE requires pre-setting a number of environment variables. It can be simplified with the iss_ide_eclipse_launcher.sh which is located in the ISS root folder. The bash script will set all the necessary environment variables and then launch the IDE.
$ cd <ISS_ROOT>
- Open wizard to create a new C++ project. ISS IDE provides a wizard to create a new C/C++ project. Clicking File->New->Project triggers the wizard.
- Name the project and select toolchain. In this article, an empty project is to be created with a name MKL_Test. Intel System Studio toolchain is selected.
- Confirm new project is created. A project tree named MKL_Test appears in the left column.
Create Intel(R) Math Kernel Library sample code in the project
After creating a new project named MKL_Test, we can add MKL sample code into the project.
- A source folder can be created in the project tree.
- Create a MKL_Test.cpp using wizard.
Compile and link
In this section, how to use ISS IDE to build the program which uses MKL will be introduced.
- If we run Build Project, there will be compiler errors since we hadn’t set its include path.
- The following figure illustrates the default includes setting. MKL-related header file directory is missing. The includes setting locates under Project Property->C/C++ General->Paths and Symbols->Includes Tab. GNU C takes charge of settings for C compilers, while GNU C++ takes charge of settings for C++ compilers.
- Add MKL header file directory into the includs setting. By default, header files locate at /opt/intel/system_studio_2018/
- Please confirm that the desired include directory has been added to the includes setting.
- Build the project at this time will end up with link error, since library-related settings are needed to be configured.
- Library-related settings are under Project Property->C/C++ Build->Settings->Tool Settings Tab->Linker->Libraries. The following figure illustrates the default settings. Search directory for libraries and target libraries are missing.
- With all these settings configured, there would be nothing preventing a successful compilation. We can confirm from the console window that the compiler used is icpc which is Intel’s C++ compiler.
Switch compiler and linker between Intel and GNU
It is not necessarily to use Intel compiler in ISS IDE. GNU compiler also works well. In this section, how to switch compilers between Intel and GNU will be introduced.
- Settings of toolchain locate under Project Property->C/C++ Build->Tool Chain Editor.
- Clicking the Current toolchain will prompt out a compiler list, from which Linux GCC can be chosen. Please confirm that the desired GNU toolchain Linux GCC is active in Current toolchain.
- As toolchain has been changed, we need to check the link setting of the new linker and add missing options.
- There should be no errors in the compilation. We can confirm from the console window that the compiler used is g++ at this time.
Setup proper runtime-level path
To make sure the built binary can find exactly the same library binaries who are linked to, it is required to setup runtime-level path properly.
- Check Project Properties->C/C++ Build->Settings->Linker->Miscellaneous->Other options. By default, this area should be blank.
- Click Add button to add library path. Please be sure to add -R before the path.
- Please confirm that the library path had been added successfully.
Run sample code
No matter which compiler is used to build the MKL sample binary, running it is straightforward by clicking the Run button.