- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am not sure that this is the right place to post the following. If not, please direct me to the right place.
I have a problem migrating from ifort to ifx, related to building code with and without OpenMP.
IFORT works fine, but IFX does not.
There is no need to look at the source code, I believe (there is a USE omp_lib statement in the MAIN__).
System info: Windows 11 Pro 22H2 (22621.2861)
ifx /logo
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2023.2.0 Build 20230627
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
According to ifx /help:
/Qopenmp-stubs
enables the user to compile OpenMP programs in sequential mode. The
OpenMP directives are ignored and a stub OpenMP library is linked
(sequential)
ifort /logo
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.10.0 Build 20230609_000000
With OpenMP:
1. ifx /nologo /O3 /nodebug /nocheck /heap-arrays /Qdiag-error-limit:4 /Qopenmp /Qopt-report /warn:nodeclarations "source files" /link /INCREMENTAL:NO /NOLOGO /OPT:NOREF /out:psa2.exe
Code runs well.
Without OpenMP, using the stub library:
2. ifx /nologo /O3 /nodebug /nocheck /heap-arrays /Qdiag-error-limit:4 /warn:nodeclarations /Qopenmp-stubs "source files" /link /INCREMENTAL:NO /NOLOGO /OPT:NOREF /out:psa2noomp.exe
psa2.obj : error LNK2019: unresolved external symbol omp_get_num_procs referenced in function MAIN__
psa2.obj : error LNK2019: unresolved external symbol omp_get_max_threads referenced in function MAIN__
psa2noomp.exe : fatal error LNK1120: 2 unresolved externals
NMAKE : fatal error U1077: 'ifx /nologo /O3 /nodebug /nocheck /heap-arrays /Qdiag-error-limit:4 /warn:nodeclarations /Qopenmp-stubs "source files" /link /INCREMENTAL:NO /NOLOGO /OPT:NOREF /out:psa2noomp.exe' : return code '0x460'
Stop.
Clearly, this one fails to link.
Without OpenMP, using the stub library:
3. ifort /nologo /O3 /nodebug /nocheck /heap-arrays /Qdiag-error-limit:4 /warn:nodeclarations /Qopenmp-stubs "source files" /link /INCREMENTAL:NO /NOLOGO /OPT:NOREF /out:psa2noomp.exe
This one works, code runs well.
Any suggestions?
Best regards,
Hans De Raedt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bug filed: CMPLRLLVM-54924.
Today my matmul fails to link with /Qopenmp-stubs. Wonder what I saw yesterday. Sigh...
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I compiled and ran a simple matmul that uses OpenMP directives. Using ifx it compiled and ran okay for me with /Qopenmp and again with /Qopenmp-stubs in a oneAPI command window on Windows.
Can you please upload an example that fails?
I used Intel(R) 64, Version 2024.0.0 Build 20231017. It was released about a month ago, around Thanksgiving.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the quick response. A minimal example is attached. The problem seems to be in the link step. Using IFORT there is no problem linking with the OpenMP stub but with IFX there seems to be one.
ifx /nologo /O3 /nodebug /nocheck /heap-arrays /Qdiag-error-limit:4 /Qopenmp /Qopt-report ifxifort.f90 /link /INCREMENTAL:NO /NOLOGO /OPT:NOREF /out:ifxomp.exe
ifort /nologo /O3 /nodebug /nocheck /heap-arrays /Qdiag-error-limit:4 /Qopenmp-stubs /Qdiag-disable:10448 ifxifort.f90 /link /INCREMENTAL:NO /NOLOGO /OPT:NOREF /out:ifortnoomp.exe
ifx /nologo /O3 /nodebug /nocheck /heap-arrays /Qdiag-error-limit:4 /Qopenmp-stubs ifxifort.f90 /link /INCREMENTAL:NO /NOLOGO /OPT:NOREF /out:ifxnoomp.exe
ifxifort.obj : error LNK2019: unresolved external symbol omp_get_num_procs referenced in function MAIN__
ifxifort.obj : error LNK2019: unresolved external symbol omp_get_max_threads referenced in function MAIN__
ifxnoomp.exe : fatal error LNK1120: 2 unresolved externals
NMAKE : fatal error U1077: 'ifx /nologo /O3 /nodebug /nocheck /heap-arrays /Qdiag-error-limit:4 /Qopenmp-stubs ifxifort.f90 /link /INCREMENTAL:NO /NOLOGO /OPT:NOREF /out:ifxnoomp.exe' : return code '0x460'
Stop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ifx /nologo /O3 /nodebug /nocheck /heap-arrays /Qdiag-error-limit:4 /Qopenmp /Qopt-report ifxifort.f90 /link /INCREMENTAL:NO /NOLOGO /OPT:NOREF /out:ifxomp.exe
Volume in drive C is OS
Volume Serial Number is 3257-09CB
Directory of C:\Users\cadfi\OneDrive\Desktop\ifxtest
27/12/2023 11:09 <DIR> .
27/12/2023 11:07 <DIR> ..
27/12/2023 11:06 258 ifxifort.f90
27/12/2023 11:09 2,629 ifxifort.obj
27/12/2023 11:09 11,842 ifxifort.opt.yaml
27/12/2023 11:09 318 ifxifort.optrpt
27/12/2023 11:09 7,393,280 ifxifort.pdb
27/12/2023 11:09 1,080,832 ifxomp.exe
6 File(s) 8,489,159 bytes
2 Dir(s) 68,060,684,288 bytes free
I opened a x64 command window, downloaded your file, pasted your build command and it built ok. I think your install or omp version is broken.
ifxomp
omp_get_num_procs() = 12: the number of processors that are available to the device
omp_get_max_threads() = 12: the number of threads used to form a new team
Checking mu ENV I see:
I_MPI_ONEAPI_ROOT=C:\Program Files (x86)\Intel\oneAPI\mpi\2021.10.0
I_MPI_ROOT=C:\Program Files (x86)\Intel\oneAPI\mpi\latest\env\\..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is not clear to me if you also tried:
ifx /nologo /O3 /nodebug /nocheck /heap-arrays /Qdiag-error-limit:4 /Qopenmp-stubs ifxifort.f90 /link /INCREMENTAL:NO /NOLOGO /OPT:NOREF /out:ifxnoomp.exe
My env says (yesterday I downloaded and installed version 2024.0.2):
I_MPI_ONEAPI_ROOT=C:\Program Files (x86)\Intel\oneAPI\mpi\2021.10.0
I_MPI_ROOT=C:\Program Files (x86)\Intel\oneAPI\2024.0
LIB=C:\Program Files (x86)\Intel\oneAPI\2024.0\lib;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64
LIBPATH=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22621.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.22621.0;C:\Windows\Microsoft.NET\Framework64\v4.0.30319
LIBRARY_PATH=C:\Program Files (x86)\Intel\oneAPI\2024.0\lib;
... >ifx
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.2 Build 20231213
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK yes the "stubs" generates the link error I had missed that option. That said I don't understand what the option means, is not a 'stub' library the one that has the references for dynamic linking via dlls? My understanding is that there is no static linking for openmp in ifort so if that is the case the option is redundant?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
According to ifx /help (or ifort /help) :
/Qopenmp-stubs
enables the user to compile OpenMP programs in sequential mode. The OpenMP directives are ignored and a stub OpenMP library is linked (sequential)
The option is very useful to test the code in sequential mode (without having to change anything to the source files).
Linking with the stub OpenMP library is expected to replace all OpenMP runtime procedures by "dummies" that give some default output.
If we replace ifx by ifort:
ifort /nologo /O3 /nodebug /nocheck /heap-arrays /Qdiag-error-limit:4 /warn:nodeclarations /Qopenmp-stubs "source files" /link /INCREMENTAL:NO /NOLOGO /OPT:NOREF /out:psa2noomp.exe
the build is ok and the code runs fine.
Just try the command above and run psa2noomp.exe to see the output.
My wild guess is that "ifx /Qopenmp-stubs" does not pass the name/path of the openmp-stubs library to the linker whereas "ifort /Qopenmp-stubs" does.
The libs are in C:\Program Files (x86)\Intel\oneAPI\2024.0\lib
libiomp5md.lib
libiompstubs5md.lib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK I get that. I think you are correct becuase adding !DIR$OBJCOMMENT LIB:"libiompstubs5md.lib" to the source fixes it as a workaround.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reproducer. I duplicated the link error with /Qopenmp-stubs. I first thought that all those compiler options may be causing the failure, but no. I'll keep investigating.
Q:\06093771>ifx /Qopenmp-stubs ifxifort.f90
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.38.33130.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:ifxifort.exe
-subsystem:console
ifxifort.obj
ifxifort.obj : error LNK2019: unresolved external symbol omp_get_num_procs referenced in function MAIN__
ifxifort.obj : error LNK2019: unresolved external symbol omp_get_max_threads referenced in function MAIN__
ifxifort.exe : fatal error LNK1120: 2 unresolved externals
Q:\06093771>ifx /Qopenmp ifxifort.f90
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.38.33130.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:ifxifort.exe
-subsystem:console
-defaultlib:libiomp5md.lib
-nodefaultlib:vcomp.lib
-nodefaultlib:vcompd.lib
ifxifort.obj
Q:\06093771>ifxifort.exe
omp_get_num_procs() = 8: the number of processors that are available to the device
omp_get_max_threads() = 8: the number of threads used to form a new team
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bug filed: CMPLRLLVM-54924.
Today my matmul fails to link with /Qopenmp-stubs. Wonder what I saw yesterday. Sigh...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is no need to sigh..., it was boxing day, a day of joy in the old Commonwealth Countries, where excess eggnog is removed by old grandmother's who like the taste of brandy, people stand in the wind on the beach in Norfolk and freeze to death, whilst bonding as a family, I await the oneapi to reinstall so I have some spare minutes, the difference between -infinity and +infinity is explained, of course we cannot count to infinity as there are not enough atoms in the universe, the Norseman suggests that I not get ahead of Intel and there is a web link for PRC people that leads nowhere that I can see would interest them on the Intel site,
So stay relaxed and just enjoy the cool weather. I can now return to programming.
Happy New Year.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
With the ifx compiler version 2024.2.0 linking with /Qopenmp-stubs works on Windows.
Look for this release in mid-2024.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page