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

Is there an easy way to make my Fortran program parallel?

losemind
Beginner
652 Views
Hi Folks,

Here is a numerical integration program:

http://people.scs.fsu.edu/~burkardt/f_src/quadpack/quadpack.f90

In evaluating the integrand functions, it is good to do two function evaluations at the same time simultaneously.

I just found that I have two CPUs Pentium Xeon 2.4GHz, supporing only up to SSE2.

Although the CPUs are slow, but if I can utilize them to do parallel computing of the numerical integration. It would be great!

But I am not a Fortran expert, nor am I a CS engineer...

Could anybody give some easy-to-follow advice on how to make that code parallel on two CPUs?

Thanks a lot!
0 Kudos
2 Replies
Steven_L_Intel1
Employee
652 Views
The compiler can't parallelize this for you (I looked to see what /Qparallel would do and all the loops it found were disqualified for parallelization, usually due to apparent loop dependencies.

To take advantage of the two processors, you'd have to rewrite the code, perhaps to use OpenMP. Given what you've said about your experience, I would not advise that route.

Do use the options /QxN /O3 /Qip

This is not a complete program, though - it is a collection of subroutines. You still need to write a program to call the routines.
0 Kudos
jimdempseyatthecove
Honored Contributor III
652 Views

Losemind,

Although you are not a Fortran expert nor a CS engineer you do know enough to integrate the mentioned code into your application andcompile it. Therefore you are quite capable of "baby steps".

Take your working code, run some test data through it and time the run. Use sufficient sized of test data to produce significant run times (several seconds to few minutes). Save some of the results to be used as verification data.

---------- change ----------
subroutine qagp
...
call qk21 ( f, a1, b1, area1, error1, resa, defab1 )
call qk21 ( f, a2, b2, area2, error2, resa, defab2 )
---------- to ---------
subroutine qagp
use omp_lib
...
!$OMP PARALLEL SECTIONS
!$OMP SECTON
call qk21 ( f, a1, b1, area1, error1, resa, defab1 )
!$OMP SECTON
call qk21 ( f, a2, b2, area2, error2, resa, defab2 )
!$OMP END PARALLEL SECTIONS

Then re-run the same test. Compare the run time and results data.
This was the simplest section of the code to introduce parallel coding.
Take small steps (small changes to the code), keep plenty of backups of working versions, test and verify all changes.

Jim Dempsey

0 Kudos
Reply