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
Principiante
303 Vistas

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 Solución
Steven_L_Intel1
Empleados
303 Vistas

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

Ver la solución en mensaje original publicado

2 Respuestas
Steven_L_Intel1
Empleados
304 Vistas

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

abenson
Principiante
303 Vistas

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!

Responder