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

OpenMP and file access

abenson
Beginner
320 Views

I have an OpenMP code in which each thread reads some data from a file (a Fortran unformatted file), processes it and then repeats those steps until no more data remains in the file to be processed. The file I/O is inside an OpenMP critical region. It doesn't matter which data are processed by which thread. I'm finding that my code crashes intermittently with what looks like corrupted data being read in. Is there some reason why I can't have multiple OpenMP threads reading from the same Fortran file? Do I need to somehow syncrhonize the file over all threads after each read?

Any help greatly appreciated!!

0 Kudos
1 Solution
Steven_L_Intel1
Employee
320 Views

Make sure you build your Fortran sources with -threads specified. (-threads is the default on Intel 64 architecture.)

View solution in original post

0 Kudos
2 Replies
Steven_L_Intel1
Employee
321 Views

Make sure you build your Fortran sources with -threads specified. (-threads is the default on Intel 64 architecture.)

0 Kudos
abenson
Beginner
320 Views

Make sure you build your Fortran sources with -threads specified. (-threads is the default on Intel 64 architecture.)

Thanks - that seems to have fixed it!

0 Kudos
Reply