Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28945 Discussions

Compiling Fortran application for AMD machines

CoryG
Novice
2,677 Views

I am working on distributing an application to customers using computers with AMD processors. We've used the Intel Fortran compiler till now and would like to keep using it rather than setting up a second AMD-based build process.

 

I have two questions then:

 

1) Are there going to be any issues compiling using the Intel compiler if the application is going to be run on non-Intel machines? If it will run, are there any potential hiccups I should watch out for?

 

2) Our application uses OpenMP, and part of this requires that our customers have the latest OpenMP runtime library. Up till now, we've just had them download the Intel Runtime Distributables, and that's been working great. However, it seems that the AMD machines don't like the Intel OpenMP library (libiomp5.so on Linux). Can we compile with the Intel compiler and then have the application use the AMD library on the customer's computer? Does anyone know how to get the AMD equivalent of the Intel Runtime Distributables? Or would this cause a problem requiring us to use a different compiler?

 

Thanks

 

Cory

0 Kudos
9 Replies
Steve_Lionel
Honored Contributor III
2,665 Views

1) As long as you don't use the -x (/Qx) option, no problem.

2) This is news to me, and probably to Intel as well. What problem are you seeing?

0 Kudos
CoryG
Novice
2,646 Views

I am still waiting to hear back from the customers as to exactly what error they are seeing when trying to install the runtime libraries. I will update you as soon as I hear. So we should be able to compile on Intel and run on any type of machine with the runtime libraries from Intel?

Just for curiosity's sake, what is the -x option and why would it make a difference?

0 Kudos
Barbara_P_Intel
Employee
2,620 Views

1) There are notes like this in many places in the Intel Fortran DGR (Developer Guide and Reference).

NOTE
Using this option enables vectorization at default optimization levels for both Intel®
microprocessors and non-Intel microprocessors. Vectorization may call library routines that
can result in additional performance gain on Intel microprocessors than on non-Intel
microprocessors.

2) Also a surprise to me that there's a problem. As Steve wrote, what is the error?

Intel certainly won't support use of AMD's OpenMP library if problems arise. I sincerely doubt that the mix has been tested by Intel or AMD.

CoryG
Novice
2,598 Views

1) Gotcha. Thanks!

2) Still waiting to hear back on that one. So we should be able to download the Intel OpenMP library on an AMD machine and it will work?

0 Kudos
Umar__Sait
Novice
2,560 Views

No problem using OneAPI fortran on AMD machines. I use ifort since it is faster for complex arithmetic. Actually, the Intel generated executables with ifort run 30% faster than those compiled with latest AMD compilers//libraries. ifx runs about the same time, again die to llvm based compilers not omptimizin complex arithmetic as well. Here are my compilation options:

 

MKLROOT := /usr/ifc/mkl/2024.0

NLIBS = -L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -I${MKLROOT}/lib/modules

CFLAGS= -free -warn all -nogen-interfaces -diag-disable=10448 -Ofast -march=SSE4.2,CORE-AVX2 -qopenmp -I${MKLROOT}/incl
ude

 

Check the locations as I sometimes move things around. You may change -march options. Note that for some reason -Ofast is better than -fast on AMDs.

0 Kudos
CoryG
Novice
2,543 Views

That all sounds good. I guess the issue that needs to be addressed is getting the OpenMP library installed. Here's the error from our end user (they are using Debian 12):

 

  • CPU: AMD Ryzen Threadripper PRO 5955WX s (32) @ 4.000GHz
  • Kernel release: 5.10.0-28-amd64
  • Installing libiomp5 on an AMD processor should not work, but I attempted it anyhow:

 

$ wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null

--2024-03-12 11:50:43--  https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB

Resolving apt.repos.intel.com (apt.repos.intel.com)... 104.77.42.40, 2a02:26f0:3000:298::a87, 2a02:26f0:3000:290::a87

Connecting to apt.repos.intel.com (apt.repos.intel.com)|104.77.42.40|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 4738 (4.6K) [application/vnd.exstream-package]

Saving to: ‘STDOUT’

 

-                                    100%[===================================================================>]   4.63K  --.-KB/s    in 0s

 

2024-03-12 11:50:43 (448 MB/s) - written to stdout [4738/4738]

$ echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list

deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main

 

$ sudo apt update

Err:3 https://apt.repos.intel.com/oneapi all InRelease

  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY BAC6F0C353D04109

Reading package lists... Done

W: GPG error: https://apt.repos.intel.com/oneapi all InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY BAC6F0C353D04109

E: The repository 'https://apt.repos.intel.com/oneapi all InRelease' is not signed.

N: Updating from such a repository can't be done securely, and is therefore disabled by default.

N: See apt-secure(8) manpage for repository creation and user configuration details.

0 Kudos
CoryG
Novice
2,532 Views

Looks like they were able to get libiomp5 installed by installing intel-mkl. Thanks for all the input!

0 Kudos
Steve_Lionel
Honored Contributor III
2,508 Views

In addition to the note Barbara quoted, the -x option adds a run-time check to the main program to see what the processor type is, and if it is not an Intel processor or one that doesn't support the instruction set specified in the -x option, it displays an error message and stops execution.  The exception is -xHost, which optimizes for the processor you compiled on, and works for non-Intel processors as well. You don't want to use -xHost for code you are distributing to others.

The -arch option is similar to -x in that it lets you specify a minimum instruction set, but adds no check, so if the processor doesn't support an instruction used, the program may fail.

Barbara_P_Intel
Employee
2,444 Views

@CoryG, that's good that installing MKL got libiomp5 installed. That's not ideal, of course.

There is an Intel Forum for Installation issues, if you want to follow up on that. Here's a link.

 

0 Kudos
Reply