Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.
27555 Discussions

Multithread deadlock in OPEN and INQUIRE

mahlumg
Beginner
232 Views

We are working on adding some multithreading to a segment of our product which involves managing several files in the background. While working on this we found that occasionally, the program would end up deadlocked with one thread sitting in OPEN and another in INQUIRE.

 

I attached a small sample program that replicates our problem. Two threads are created on the C++ side and for simplicity, each thread will then loop though a list of file names. In the loops are the calls to a Fortran wrapper subroutine around the OPEN and INQUIRE calls, one loop for each. Without any modifications, this program seems to lock up immediately as OPEN and INQUIRE try to run on the first file listed. However, to test if it is only locking when using the same file, lines are added to delay the execution of  either or both threads. When doing this one can see that a deadlock can occur regardless of what file OPEN or INQUIRE are using so long as they are attempting to execute at the same time.

0 Kudos
5 Replies
Barbara_P_Intel
Moderator
188 Views

I'll take a look. What compiler versions are you using? What version of VS?

Thank you.

 

mahlumg
Beginner
163 Views

I am currently using Intel Fortran XE 2019 Update 5 (2019.5.281) on VS 2017 (15.9.17)

Barbara_P_Intel
Moderator
157 Views

Please update to the current compiler release. It's part of oneAPI 2022.2. I know that there are bug fixes regarding I/O since PSXE 2019.

If you are a registered user with Intel Registration Center (IRC), you should have received an email in the last 24 hours announcing its availability.

Otherwise, you can download it from here. The Fortran compiler is part of the oneAPI HPC Toolkit.

I suggest updating to VS2019, too.

 

 

mahlumg
Beginner
128 Views

I'm trying to install the latest VS and oneAPI, but I ran into an issue. However, in the meantime, I downloaded the latest Fortran runtimes, and the program worked using those (20.0.1.0) instead of what I had prior (19.0.1.0)

Barbara_P_Intel
Moderator
122 Views

Great that you have your application running okay!

Please don't use the LATEST version of VS 2022, version 17.2. You will NOT be able to use Fortran projects. See this article or the pinned topic on this forum for details.

 

 

Reply