Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26758 Discussions

Difference between -threads and -pthread compile option

Theurich__Gerhard
195 Views

I am trying to figure out whether there is a difference between the -threads and the -pthread compiler option to IFORT. If there is a difference, what is it? Does it make sense to provide both options during compilation, or are they incompatible?

Also, if one of those options (or both) are used during compilation of one piece of code, does the same option have to be specified during linking?

Thank you,
-Gerhard

0 Kudos
3 Replies
Steve_Lionel
Black Belt Retired Employee
195 Views

These are two different options, neither of which you need. -threads is obsolete and does nothing useful at this time. In the past it said that you wanted to use the thread-safe version of the language support library, but for four or five years now there is only a thread-safe version.

-pthreads is an alternate spelling of -reentrancy threaded, which tells the language support library to support a threaded application. This is the default.

Neither of these affect parallelism of your application.

Theurich__Gerhard
195 Views

Thank you for the explanation. Good to have it clarified that both options are basically the default now. The code I am working with calls Fortran routines from inside Pthreads that were created by a C layer. It sounds like specifying both -pthread and -threads options when compiling the Fortran portions of the code makes sense - albeit redundant with the current defaults.

-Gerhard

Steve_Lionel
Black Belt Retired Employee
195 Views

My preference is to not specify options you don't need. They can be confusing to others when they try to understand your build environment.

Reply