gfortran64_mp and threading

Discussion created by lytles on Jun 13, 2008
Latest reply on Aug 5, 2008 by lytles
seeing crashes and deadlocks when calling gfortran_mp from multiple threads

i'm trying to use acml in a threaded environment.

  • gfortran64  single-thread  --> success
  • gfortran64     2 threads    --> success
  • gfortran64_mp  single-thread   --> success
  • gfortran64_mp  2 threads    --> failure (crashes, deadlocks)

i need to be able to call acml from many threads, and i'd like the lower latency of the _mp version. but it appears from my testing above that the openmp version is not thread safe. can anyone verify this ? the wrappers that i'm using are pretty simple and look thread-safe, but it's possible that the problem is mine.

with mkl (the intel equiv to acml) i can call the openmp version from multiple threads without any problem. the wrappers are very similar.

the release notes say:

(o) Routines that were not safe for use by multi-threaded programs in
    some earlier releases of ACML have now been made thread safe.
    If you use ACML in a multi-threaded environment you are recommended
    not to use versions of ACML earlier than 2.1.0. (Note that this
    does not apply to the PGI-compiled SMP versions of ACML which have
    always been safe for use in OpenMP programs.)

so i've been counting on being able to call from multiple threads. fwiw, i'm calling from java using jni, and using the java threads