Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

are include statements in subroutines safe for mutithreading?

$
0
0

HI 

This may the the first of many questions about running or rewriting an application with

ThreadModel Free  ( the application works fine in ThreadModel Apartment)

I upgraded to visual fortran compiler XE 15.04.221 , but still using IA-32 build. 

 

I have read that COMMON blocks are a problem for multithreading because they can

lead to racing , is that correct??

So when now passing arrays between subroutines on the subroutine argument list

instead of in common blocks, does the use of include statements in subroutines

to dimension arrays on the subroutine argument list, or to dimension arrays

local to the subroutine cause racing, or is it threadsafe??  

Example

apple is an include with two parameter statements 

INTEGER, PARAMETER ::NPCOUNT =405

INTEGER,PARAMETER :: KREAL = 355

 

So then are these ok to do, the first subroutine dimensions an array on the calling list with the include parameter value,

the second subroutine dimensions a local array in the subroutine with the include parameter value....

SUBROUTINE Fort01(MAIN1)

INCLUDE 'apple'

DIMENSION MAIN1(NPCOUNT)

RETURN

END

 

and

SUBROUTINE Fort02(MAIN1,IMAIN1)

INCLUDE 'apple'

DIMENSION MAIN1(IMAIN1)

DIMENSION LOCAL1(KREAL)

RETURN

END 

Thanks

BIll


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>