Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
1 View

Difference between -threads and -pthread compile option

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
Highlighted
Black Belt
1 View

These are two different

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.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
1 View

Thank you for the explanation

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

0 Kudos
Highlighted
Black Belt
1 View

My preference is to not

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.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos