I have a main program, written in C, that utilizes a threadpool of 12 threads (using pthreads)to perform parallel processing of some science data. Our group has a legacy Fortran subroutine that we need to call from each of thread to do the actual processing on a subset of the data. What are some basic guidelines for converting this Fortran subroutine so that it is thread safe?
I'm getting run-time errors in the Fortran code (forrtl severe 29). The subroutine reads/writes to several thread-specific files and allocates/deallocates memory structures. I'm fluent in C/C++ but a novice in Fortran. It seems as though the Fortran subroutine is not creating thread-specific local memory or io units?
I'm usingifortv11.1 to compile the Fortran code and gcc v4.1.2 to compile and link the program in Linux.