Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Intel Fortran + OpenMP doesn't work #5483

Open
PierUgit opened this issue Sep 17, 2023 · 6 comments
Open

[BUG]: Intel Fortran + OpenMP doesn't work #5483

PierUgit opened this issue Sep 17, 2023 · 6 comments

Comments

@PierUgit
Copy link

PierUgit commented Sep 17, 2023

Describe the bug

OpenMP is not working with Intel ifort/ifx compilers (Fortran) starting from version 2021.2.0. The execution always results in the following error:

OMP: Error #179: Function Can't open SHM2 failed:
OMP: System error #30: Read-only file system
forrtl: error (76): Abort trap signal
Image              PC                Routine            Line        Source             
libpthread-2.31.s  00007F027C4DA420  Unknown               Unknown  Unknown
libc-2.31.so       00007F027C31700B  gsignal               Unknown  Unknown
libc-2.31.so       00007F027C2F6859  abort                 Unknown  Unknown
libiomp5.so        00007F027C5C4BEC  Unknown               Unknown  Unknown
libiomp5.so        00007F027C5ABA84  Unknown               Unknown  Unknown
libiomp5.so        00007F027C5C30CE  Unknown               Unknown  Unknown
libiomp5.so        00007F027C5C41B1  Unknown               Unknown  Unknown
libiomp5.so        00007F027C5B4F54  Unknown               Unknown  Unknown
libiomp5.so        00007F027C572BFB  __kmpc_fork_call      Unknown  Unknown
output.s           0000000000405293  Unknown               Unknown  Unknown
output.s           000000000040520D  Unknown               Unknown  Unknown
libc-2.31.so       00007F027C2F8083  __libc_start_main     Unknown  Unknown
output.s           000000000040512E  Unknown               Unknown  Unknown
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
libpthread-2.31.s  00007F027C4DA420  Unknown               Unknown  Unknown
libc-2.31.so       00007F027C2F6941  abort                 Unknown  Unknown
output.s           0000000000404AA4  Unknown               Unknown  Unknown
libpthread-2.31.s  00007F027C4DA420  Unknown               Unknown  Unknown
libc-2.31.so       00007F027C31700B  gsignal               Unknown  Unknown
libc-2.31.so       00007F027C2F6859  abort                 Unknown  Unknown
libiomp5.so        00007F027C5C4BEC  Unknown               Unknown  Unknown
libiomp5.so        00007F027C5ABA84  Unknown               Unknown  Unknown
libiomp5.so        00007F027C5C30CE  Unknown               Unknown  Unknown
libiomp5.so        00007F027C5C41B1  Unknown               Unknown  Unknown
libiomp5.so        00007F027C5B4F54  Unknown               Unknown  Unknown
libiomp5.so        00007F027C572BFB  __kmpc_fork_call      Unknown  Unknown
output.s           0000000000405293  Unknown               Unknown  Unknown
output.s           000000000040520D  Unknown               Unknown  Unknown
libc-2.31.so       00007F027C2F8083  __libc_start_main     Unknown  Unknown
output.s           000000000040512E  Unknown               Unknown  Unknown

Note that the Intel C compilers (icc/icx) have the same issue)

Steps to reproduce

Write any Fortran program with some OpenMP, can be just:

program main
    USE OMP_LIB
    !$OMP PARALLEL
    print*, "Hello World!"
    !$OMP END PARALLEL
end program main

Compile/execute it with ifort or ifx, with the fopenmp option

Expected behavior

The output should print twice the "Hello World!" string

Reproduction link

https://godbolt.org/z/W9x7WTEfM

Screenshots

Not applicable

Operating System

No response

Browser version

Firefox 115.2.1esr (macOS x86)

@PierUgit PierUgit added the bug label Sep 17, 2023
@partouf partouf changed the title [BUG]: [BUG]: Intel Fortran + OpenMP doesn't work Sep 17, 2023
@mattgodbolt
Copy link
Member

Calling any fortran experts to help debug or diagnose...

@partouf
Copy link
Contributor

partouf commented Sep 18, 2023

I suspect that

OMP: Error #179: Function Can't open SHM2 failed:
OMP: System error #30: Read-only file system

Points to the compiler writing to some directory it doesn't have access to.

But can't be sure without playing around with it / stracing / etc

@PierUgit
Copy link
Author

PierUgit commented Sep 18, 2023

Calling any fortran experts to help debug or diagnose...

It's actually not specific to Fortran, but to the Intel compilers when OpenMP is used. I can reproduce the same error messages with a OpenMP C code compiled with icc/icx (I didn't test with C++ and icp/icpx, but it's very likely the same).

@partouf
Copy link
Contributor

partouf commented Sep 18, 2023

You mentioned it might also be happening to c++ which I suddenly recalled testing it. The problem was mentioned here #2246 (comment)

@partouf
Copy link
Contributor

partouf commented Sep 18, 2023

Adding -Wl,-rpath as described in that issue doesn't help though, not in c++, not in fortran.

C++ already has them added, but the linker seems to either ignore or not save the information

When I run the ldd tool it for example says libimf.so cannot be found https://godbolt.org/z/Gj1dqq5nj eventhough -Wl,-rpath,/opt/compiler-explorer/intel-cpp-2023.2.1.8/compiler/latest/linux/compiler/lib/intel64_lin is passed to the compiler (and libimf.so lives there) but then so is libiomp5.so and that one is linked?

I'm confused

Strange things afoot

@PierUgit
Copy link
Author

Looks like it has been fixed with the 2024 version if the Intel compilers

2023: https://godbolt.org/z/W9x7WTEfM
2024: https://godbolt.org/z/dxeheGdez

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants