Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Thread Local Storage??

georgeg
Beginner
671 Views

Hi, I sure could use some Thread Local Storage!

I have a few buffers that right now are being passed as parameters down down down level after level. It would be nice to have them as globals instead. But thread-safe globals. Is there any easy way to do this in IVF 9.1 ??

Thanks!

0 Kudos
2 Replies
TimP
Honored Contributor III
671 Views
The OpenMP facilitiesof ifort facilitate the use of (thread-safe) TLS for"global" data. (COMMON blocks in pre-f90 code require threadprivate declarations).You have to recognize the contradictions between thread safety and global storage, at least to the extent of complying with OpenMP rules.
0 Kudos
jimdempseyatthecove
Honored Contributor III
671 Views

George,

I have had good luck using the following for some time now.

type

TypeThreadContext

SEQUENCE

type

(TypeObject), pointer :: pObject

type

(TypeTether), pointer :: pTether

type

(TypeFSInput), pointer :: pFSInput

end

type TypeThreadContext

type

(TypeThreadContext) :: ThreadContext

COMMON

/CONTEXT/ ThreadContext

!$OMP THREADPRIVATE(/CONTEXT/)

Jim Dempsey

0 Kudos
Reply