- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'am looking for some examples of use of TLS index in Fortran without OpenMP.
Is that possible?
Best regards,
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I assume TLS here means Thread Local Storage, but otherwise I don't know what you're asking.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>I'am looking for some examples of use of TLS index in Fortran without OpenMP.
You will have to be more specific.
Your query implies that your Fortran code is run in a multi-threaded environment.
However, while you state "in Fortran without OpenMP", you do not state how/where the additional threads are created/managed.
And, where and how the private variables are declared.
Should you have a Fortran library that is called from a multi-threaded main program (e.g. C++ using __declspec(thread) ...),
then have the calling thread pass the argument(s) by value or reference (to its TLS storage).
Thread private management is not guaranteed to be the same across different languages. You will have to be creative, and do not rely "it worked in one environment".
If you have a collection of TLS variables declared in C/C++, and you want individual access in your called Fortran procedures, then I suggest you encapsulate those variables within a struct (that is marked for TLS), then pass the reference to the struct to your Fortran procedure(s). The Fortran code can use BIND(C) on its declaration of the type.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would start with someone like this who publishes code about this sort of stuff, indirectly in C++.
Sometimes as Jim indirectly notes, you are the first one down the valley (of death or Fortran failure). Good luck here, before this Forum it was a lonely path, filled with orcs and trogs.
Fortran is a great language but it is not the other languages, it is for speed and number crunching, it is like writing in Old English, the vocabulary is not modern English, so there is no word for gun in Old English, they call it a firestick.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page