Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Threading

HAMISH
Beginner
415 Views

I have a calling main routine that call the same procedure (which calls many others) n number of times.
After calling them all it then does some interaction between their variables, and then calls them all again.
While they are running they have no inner dependance. I was attempting to use DO CONCURRENT, but I don't think I can make make all the routines it call PURE.
So is there a way to just call a routine as a new thread (I assume there is)?
How is this done?

Do x=1, TOTAL
CALL TESTSUB(x)
End Do

(All the variables are defined in a allocatable array of type)

0 Kudos
5 Replies
TimP
Honored Contributor III
415 Views
I don't see that DO CONCURRENT relates to the situation you describe. Perhaps you are interested in OpenMP task parallelism or parallel sections.
As you indicated, in order for DO CONCURRENT to work (including with /Qparallel), you would require pure functions, which your description indicates is not the case.
0 Kudos
Wendy_Doerner__Intel
Valued Contributor I
415 Views
I think DO CONCURRENT will start new threads if you use the /Qparalllel switch (and it can safely do so). Have you considered using OpenMP*? You can see the section in the documentation on Using OpenMP for more information.
0 Kudos
HAMISH
Beginner
415 Views

Sorry if I was not clearer, but I was attempting to use DO Concurrent, but reallized it doesn't work. My question now really is just if there is a way to call a thread by hand. Since although the compiler isn't sure it is completely thread safe,I am.

Thanks

0 Kudos
TimP
Honored Contributor III
415 Views
What you asked for looks like Windows threading, but you will need C wrappers to handle it, and I've never tried.
0 Kudos
Steven_L_Intel1
Employee
415 Views
You don't need C wrappers. There are a couple of samples provided that illustrate using Windows API Threads.
0 Kudos
Reply