Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

Question about compiled program by ifort

xqg1084
Beginner
618 Views
Recenly I have an old source codes programmedby Fortran77.
I tried to compiled them under an 64-bits machine with unix operating system. and I tried to compile them by different compilers (one is intel fortran , the other is gcc4.1.2)
I used command like : 'gfortran -O3 -m32 -double *.f' ,when I used gcc 4.1.2 compiler
I used command like:'ifort -O3 -parallel -real_size 64 -mp -ipo -axT -fast *.f', when I used intel fortran compiler.

Then of course, the intel fortran compiled program use 2min20 sec to finish calculation ( 1 input), while gcc compiled program need 4min 13 sec to finish calculation (1 input).

But sine the CPU that I used is an 8 core CPU. So I used 'OPENMP' to let these compiled program run for 8 inputs at the same time. So I made a simple program just to use OPENMP to give an 8 threads calculation. But I found that:
When I wanted to use OPENMP to run the program with 8 inputs at the same time. the ifort compiled program would need 7min51sec, while gfortran compiled program need 5min6 sec.

So these results suprised me very much, who can help me to find the possible reason and what should I do? Maybe the compilling options that I chose were not right!

belows are the OPENMP codes:

use omp_lib

implicit none

character(len=99) cmdtxt,str

character*1 xqgid

integer mpid

call omp_set_num_threads(8)

*$OMP PARALLEL DEFAULT(PRIVATE)

mpid=omp_get_thread_num()

write(xqgid,'(i1)') mpid

cmdtxt='Program'//xqgid

CALL SYSTEM(cmdtxt)

*$OMP END PARALLEL

cmdtxt='cat result-?.txt>> results.txt'

CALL SYSTEM(cmdtxt)

0 Kudos
2 Replies
xqg1084
Beginner
618 Views
Is there anybody that can help me about this question?
0 Kudos
jimdempseyatthecove
Honored Contributor III
618 Views
Generally you should not use a parallel region to spawn programs. Rather you take the execuitable statements within the program you spawn and place them into a subroutine within the application then call the subroutine from within your parallel region.

If you need to spawn multiple programs, I suggest you do thisfrom a command shell.

!$omp parallel sections
call Program1Subroutine()
!$omp section
call Program2Subroutine()
!$omp section
...
!$omp section
call ProgramNSubroutine()
!$omp end parallel sections

Jim Dempsey
0 Kudos
Reply