- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am learning openMP, wrote a very simple program and tested it on WindowsXP on a 3.06 GHz P4 HT and it works fine, get about 24% speed improvement and 100% CPU utilization instead of the normal 50%.
The same code when i compile on linux using the latest intel fortran compiler it fails to run with a segmentation fault
the linux system is:
p4 1.8GHz (NO HT)
1GB RAM
FC2 (kernel 2.6.7-1.494.2.2)
lates Ifort version, 8.odd
What am i doing wrong??
this is the messages as i compile
[alan@mmg-vig paral]$ /home/alan/bench/paral/compileVig.txt
bench.f90(27) : (col. 6) remark: OpenMP DEFINED SECTION WAS PARALLELIZED.
[alan@mmg-vig paral]$ /home/alan/bench/paral/a.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 00C548B7 Unknown Unknown Unknown
a.out 0045A325 Unknown Unknown Unknown
bench.f90(27) : (col. 6) remark: OpenMP DEFINED SECTION WAS PARALLELIZED.
[alan@mmg-vig paral]$ /home/alan/bench/paral/a.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
a.out 00C548B7 Unknown Unknown Unknown
a.out 0045A325 Unknown Unknown Unknown
the compile script is simply
ifort -fpp -assume cc_omp -openmp -openmp_report -threads bench.f90
the source code is
Code:
!==============================================================================
!Simple benchmarking program
!By Alan (24th.August.2004)
!==============================================================================
program bench
!..............................................................................
!declarations
implicit none
integer :: i,k,j,i1,k1
real*8 :: y,t1,t2,dt,y1
integer, dimension(8) :: d_t ,d_t2
character (len = 12), dimension (3):: real_clock ,real_clock2
!..............................................................................
!open output file
open(unit=1, file="out.txt", status="unknown")
!call intial time
call date_and_time (real_clock (1), real_clock (2),real_clock (3), d_t)
!benchmark
!paralel code
!$OMP PARALLEL SECTIONS
!$OMP SECTION
call f(y)
!$OMP SECTION
call s(y1)
!$OMP END PARALLEL SECTIONS
!call time after computation
call date_and_time (real_clock2 (1), real_clock2 (2),real_clock2 (3), d_t2)
!compute time difference(simple conversion to seconds,
!this will fail at certain rare occasions)
t1=(d_t(5)*60*60)+(d_t(6)*60)+(d_t(7))+(d_t(8)/1000.0)
t2=(d_t2(5)*60*60)+(d_t2(6)*60)+(d_t2(7))+(d_t2(8)/1000.0)
dt=t2-t1
!..............................................................................
!write outputs
!to console(comment these out if you are recompiling this code
!to run on a headless system)
write(*,*)y,y1,'garbage ignore'
write(*,*)
write(*,*)'============================='
write(*,*)"Initial time :"
write(*,10)d_t(5),d_t(6),d_t(7),d_t(8)
write(*,*)'..............................'
write(*,*)"final time :"
write(*,10)d_t2(5),d_t2(6),d_t2(7),d_t2(8)
write(*,*)'-----------------------------'
write(*,*)"Time difference :"
write(*,*)dt,'seconds'
write(*,*)'============================='
!to file
write(1,*)y,y1,'garbage ignore
'
write(1,*)
write(1,*)'============================='
write(1,*)"Initial time :"
write(1,10)d_t(5),d_t(6),d_t(7),d_t(8)
write(1,*)'..............................'
write(1,*)"Final time :"
write(1,10)d_t2(5),d_t2(6),d_t2(7),d_t2(8)
write(1,*)'-----------------------------'
write(1,*)"Time difference :"
write(1,*)dt,'seconds'
write(1,*)'============================='
10 format(i3,'hr',i3,'min',i3,'s',i4,'ms')
!close file
close(1)
!keep console open(comment this on unix/linux/bsd systems as it
!is not necessary)
pause
!..............................................................................
end program bench
!first subroutine
subroutine f(y)
integer :: i,k
real*8, intent(out):: y
!inital value
x=10000
y=10
do k=1, 500
do i=1, 1000000
y=y+(y**0.5)*x
end do
end do
end subroutine f
!second subroutine
subroutine s(y1)
integer :: i1,k1
real*8, intent(out):: y1
!inital value
x=20000
y1=20
do k1=1, 500
do i1=1, 1000000
y1=y1+(y1**0.5)*x
end do
end do
end subroutine sPlease help:smileyhappy:
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How much is your stack size?
Use "ulimit -s" to show your stack size. If you never change stack size, it will be not enough for a bigger OpenMP program, and the situation causes segmentation fault.
There is a more complete instructions in the compiler release note. Because the system is FC2, I think the problem is the stack size, not the library issue.
Shi-ming Chen
Use "ulimit -s" to show your stack size. If you never change stack size, it will be not enough for a bigger OpenMP program, and the situation causes segmentation fault.
There is a more complete instructions in the compiler release note. Because the system is FC2, I think the problem is the stack size, not the library issue.
Shi-ming Chen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi thanks for the reply, thought no one would reply!
running the comand you state shows 10240
Would that be in bytes?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is system default. You can try a bigger value, like "ulimit -s 20480" or even 102400.
Note: some shells can change stacksize only one times in a session. I usually use 102400.
Shi-ming Chen
Note: some shells can change stacksize only one times in a session. I usually use 102400.
Shi-ming Chen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would that be in bytes?
The ulimit shows that is in kbytes.
Shi-ming Chen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
send_to_alan wrote:Would that be in bytes?
The ulimit shows that is in kbytes.
Shi-ming Chen
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page