- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear All,
I am trying to compare the time needed for writing a file between "-serial" version and "-openmp" with onethread doing the IO operation.
The result showed that;
Serial: 10.2 s
OpenMP: 19.2s
I'd like to know to some guidance to improve this.
Thanks in advance;
Chris
--Code
program Console1
!$ use omp_lib
implicit none
integer,parameter::nx=100,ny=100,nz=100
integer i,j,k
real start_time,finish_time
real A(nx,ny,nz)
A=1.0
start_time=secnds(0.0)
!$omp parallel
!$omp master
open(101,file='test1')
do k=1,nz
do j=1,ny
do i=1,nx
write(101,*) A(i,j,k)
end do
end do
end do
close(101)
!$omp end master
!$omp end parallel
finish_time=secnds(start_time)
print*,'time =', finish_time
end program Console1
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't see the motivation for writing single datum formatted fields to a file, or for putting it in a parallel section.
When parallel sections are used for practical purposes, of course, it is at least as interesting to know the elapsed time as the total CPU time of all threads. I suppose it is possible that a parallel region, presumably with a critical region in the I/O run-time library, will take longer than a serial region, in case that is what you are trying to find out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll go ahead and move this thread to the "Threading on Intel Parallel Architectures" forum, which would be a more natural fit. You might get more guidance there.
Regards,
~Gergana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear All,
I am trying to compare the time needed for writing a file between "-serial" version and "-openmp" with onethread doing the IO operation.
The result showed that;
Serial: 10.2 s
OpenMP: 19.2s
I'd like to know to some guidance to improve this.
Thanks in advance;
Chris
--Code
program Console1
!$ use omp_lib
implicit none
integer,parameter::nx=100,ny=100,nz=100
integer i,j,k
real start_time,finish_time
real A(nx,ny,nz)
A=1.0
start_time=secnds(0.0)
!$omp parallel
!$omp master
open(101,file='test1')
do k=1,nz
do j=1,ny
do i=1,nx
write(101,*) A(i,j,k)
end do
end do
end do
close(101)
!$omp end master
!$omp end parallel
finish_time=secnds(start_time)
print*,'time =', finish_time
end program Console1
The parallel version of the library function for "write" must take into consideration the possibility of multiple threads performing a write to the same unit at the same time. Therefor the mt version of the runtime library for write function must contain a critical section (hopefully on per unit). This will slow down the writes. Try reducing the number of calls to write
do k=1,nz
do j=1,ny
write(101,'(F10.3,/)') (A(i,j,k), i=1,nx)
end do
end do
You may have to experiment with the / and $ edit descriptors to get what you want.
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page