subroutines in fortran 95
subroutines in fortran 95
(OP)
hi, I have a subroutine in my f95 program. this subroutine is called 100 times (by 100 call statements). I understands that each call statements are executed one after the other. is there any way I can call and execute all the 100 call statements in one go.
thanks
thanks






RE: subroutines in fortran 95
Dik
RE: subroutines in fortran 95
And, unless your compiler is designed for parallel processing, it's unlikely that your program can be modified at all.
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: subroutines in fortran 95
http://julianh72.blogspot.com
RE: subroutines in fortran 95
RE: subroutines in fortran 95
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: subroutines in fortran 95
RE: subroutines in fortran 95
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: subroutines in fortran 95
1 dependent on data which varies for each call,
or
2 does the lower level subroutine basically return the same value each time it is called independent of where it is called from?
If 2, call it once at the start and remember the data it returns!
Otherwise, it needs to be called every time as its results are dependent on each call.
RE: subroutines in fortran 95
Mike Halloran
Pembroke Pines, FL, USA
RE: subroutines in fortran 95
@MikeHalloran, I understand that the restriction is compiler preprocessor capability. I am using gfortran which came with fortrantools (http://www.fortran.com/ ). I don't know about the compiler capability - but if it is capable, is there any guideline on how to use this potential. i am not an expert with fortran, any guideline is appreciated.
RE: subroutines in fortran 95
However, macros are a powerful construct available in many languages, which allow you to do many interesting things. In this instance, you would define the subroutine as a sequence of instructions in the macro definition, and replace every instance of a call to that subroutine with an invocation of the macro, which is expanded by the preprocessor into the defined sequence of instructions, all compiled as inline code, with no call or return instructions needed because the runtime binary just runs through the sequence from top to bottom with no delay.
It's a common technique for speeding up program execution.
... which I'm not sure is your problem,
because you haven't told us what you are trying to do,
you haven't told us what you tried that didn't work,
and you haven't included even a single line of code.
Mike Halloran
Pembroke Pines, FL, USA
RE: subroutines in fortran 95
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: subroutines in fortran 95
Don't expect linear speedup though, as there are fixed and per-thread overheads. And your computation will be throttled by the slowest thread if you're using the normal/simplest method of sharing (i.e. divide a DO loop and give each thread a fixed section of it to work through). Of course you can do fine-grained & custom thread control when you've found bottle-necks, but it rapidly leads to diminishing returns.
A data point that I can offer for a typical FORTRAN compute engine is up to 1.8x speedup for 2 cores. ~3x-4x for 6 or more cores. It's all down to the proportion of sharable code and inherent sequencing requirements.
And... OpenMP implementations I've used will cause all N threads to start and be 100% CPU intensive even when not doing any useful work. This can be confusing for newcomers.
Steve