Community
cancel
Showing results for 
Search instead for 
Did you mean: 
hesamzadeh
Beginner
46 Views

I have developed a code in Fortran that has nested parallel dos but

Hi there,

I have developed a code in fortran that uses parallel dos but the running time of serial version and parallel version are the same? any advice!

regards,
Mohammad Reza.

0 Kudos
2 Replies
Aaron_T_Intel
Employee
46 Views

Mohammad,
Thank you for visiting the Parallel Programming forum. I would suggest that you take a moment to post your question to the Fortran forum as well.http://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/
I'll ping Steve, the moderator as well, to have him keep an eye out for your question.

Cheers,
Aaron

Quoting - hesamzadeh

Hi there,

I have developed a code in fortran that uses parallel dos but the running time of serial version and parallel version are the same? any advice!

regards,
Mohammad Reza.


ClayB
Black Belt
46 Views


Mohammad -

I would first ask "Is the printer plugged in?" By that, I mean make sure you are running on a multi-core processor. Then, have you set up the environment to use multiple threads? I'm assuming that you're using OpenMP in your Fortran, so you might want to explicitly set the number of threads by changing the OpenMP environment variable to reflect the number of cores on your platform.

If you've done all of that and are still not seeing any difference, I would ask you to estimate the amount of time your code should be spending in the parallel region. If you've parallelized a part that only accounts for 3% of the execution time, you won't notice any difference. Is your data set big enough to run the code for several seconds? Even if the parallel region runs for 90% of the time, if the data is too small and your code runs for 0.25 second, the overhead of creating and terminating threads may overshadow the speedup from parallel execution.

One other test you might want to try is to take a simpler algorithm, like computing pi through numerical integration. (I'velisted aserial version below for you to play with.) Add the proper parallel-do things and try different numbers of threads and different numbers of intervals to see if you can get any timing differences.

Hope this helps.

--clay

C---- pi.f ---
program compute_pi
implicit none

integer :: N, i
real(8) :: n_1, x, s, pi, f, a

! integration function
f(a) = 4.d0 / ( 1.d0 + a*a )

print *
print*, 'Input # of intervals'
read*, N
print*, N

! calculate interval size
n_1 = 1.0d0 / N
s = 0.0d0

do i = 1, N
x = n_1 * ( i - 0.5d0 )
s = s + f(x)
enddo
pi = n_1 * s

print*, 'computed pi = ', pi
end program compute_pi
Reply