Simcenter Amesim How can I use the Intel oneAPI DPC++/C++ Compiler in Simcenter Amesim?

2024-05-14T14:01:15.000-0400
Simcenter Amesim Automation Connect Simcenter System Simulation Client for Git Simcenter Amesim Teamcenter Share

Summary

This article describes the steps needed to set up the correct environment in Simcenter Amesim to be able to use the Intel oneAPI DPC++/C++ Compiler together with Microsoft Visual C++ 2019 compiler on Windows.


Details

Error message

Have you ever encountered the information in the "Compilation" tab of the Preferences window that the "Selected compiler could not be detected" when trying to set the Intel C++ (64-bit) compiler as active compiler?

Error message when selecting the Intel C++ compiler

Then this article can help to resolve your issue.

Prerequisites

Two important prerequisites need to be fulfilled, before the Intel oneAPI DPC++/C++ Compiler can be set up in Simcenter Amesim 2404 (and former versions) for Windows:

1.) Microsoft Visual C++ 2019 compiler

In this article, an installation of Microsoft Visual Studio 2019 Professional is used to provide the needed Visual C++ 2019 compiler. Please contact your IT department to install the according Microsoft Visual C++ 2019 compiler.

2.) Intel oneAPI DPC++/C++ compiler

Here, version 2024.1 of the Intel oneAPI Base Toolkit for Windows (64 bit) was installed to have the according Intel C++ compiler available. This compiler was downloaded from the following URL (no guarantee that this link will be up to date for future releases):

Intel oneAPI Base Toolkit for Windows (64 bit)

Set up in Simcenter Amesim

Having installed both compilers, you need to execute the following steps to allow Simcenter Amesim using the Intel oneAPI DPC++/ C++ 2024.1 compiler:

i. Please copy the file "iclvars_template.bat" into the Simcenter Amesim installation folder and rename it into "iclvars64.bat".

You can find the "iclvars_template.bat" file in the subfolder 'misc' of the Simcenter Amesim installation folder. Here, we have not installed Simcenter Amesim 2404 in the default location (Windows: "C:\Program Files\Simcenter\2404\"), but on drive "D:" with a similar naming ("D:\Simcenter\2404\"); however, the substructure is the same. Please copy this file from the 'misc' subfolder into the Simcenter Amesim installation folder and rename it into "iclvars64.bat":

Creating iclvars64.bat file

 

ii. Please adapt the file "iclvars64.bat" to call the correct Intel C++ compiler.

You need to open the file "iclvars64.bat" with a text editor to adapt and save its content as follows:

Adapting content of iclvars64.bat file

First you can change the comment (comments start in this file always with the command 'REM') in line 24 to explicitly mention which Intel oneAPI compiler version you are referring to, but this is optional. Then, it is very important to  insert the commands in lines 25 and 26.

In line 25, starting with the command 'set', an environment variable 'VS2019INSTALLDIR' is defined pointing to the installation folder of your Microsoft Visual Studio 2019 Professional installation. In this example, the path is "C:\apps\MVS16", but probably you need to adapt this entry with respect to your destination folder. The definition of this environment variable is important, since the Intel oneAPI C++ compiler needs some dynamic libraries to compile the source code on Windows.

In line 26, starting with the command 'call', the according "setvars.bat" file is called with the options "intel64" and "vs2019" to actually initialize the compilation with the Intel oneAPI C++ compiler for the given environment, which is located in the Intel oneAPI installation folder, e.g.:

Location of setvars.bat file

An exemplary file "iclvars64.bat.txt" is provided in the attachment, which you can copy into your Simcenter Amesim installation folder and start with by removing the .txt extension.

 

iii. Please adapt the file "win64_intel.make" after saving a copy of the original file.

In this last step, you need to adapt the "win64_intel.make" file, which is located in the subfolder "lib\win64_intel" in the Simcenter Amesim installation folder:

Location of the win64_intel.make file

As shown, it is advised that you first make a copy of the original file and save it e.g. with the .txt extension just in case any issues occur to retrieve the original file. After opening the "win64_intel.make" file with a text editor, you need to provide and save the following changes:

Adapting the win64_intel.make file

In the first line, you need to change the argument of the "CC" option from "icl" to "icx".

In the second line, you need to delete the arguments "-Qprec" and "-G7" of the "CFLAGS" option.

Attached you can find an exemplary file "win64_intel.make.txt", which you can copy into the according subfolder "lib\win64_intel" of your Simcenter Amesim installation and use it by removing the .txt extension after creating a copy of your original make file.

 

Following the above instructions, you can select and use the Intel C++ (64 bit) compiler as the active compiler set in the "Compilation" tab of the Preferences window accessible via "Tools -> Preferences" in the Simcenter Amesim GUI:

Selecting the Intel C++ compiler as active compiler in Simcenter Amesim

 

If you need to set up the Microsoft Visual C++ 2019 compiler in Simcenter Amesim, please have a look into the article "How can I use the Microsoft Visual C++ 2019 compiler in Simcenter Amesim?". 

 

KB Article ID# KB000132277_EN_US

Contents

SummaryDetails

Associated Components

Amesim Automation Connect