|
| View previous topic :: View next topic |
| Author |
Message |
Ansa
Joined: 23 Sep 2005 Posts: 2
|
Posted: Fri Sep 23, 2005 12:42 pm Post subject: Process eating CPU |
|
|
Hi.
I don't know if it's normal, I wrote a little program to test OpenMp in
a Linux machine (RH 7.1 2.96-98, Intel Xeon 2.8GHz, two CPUs).
program testeOpenMP
implicit none
integer,dimension(1000,2) :: board
integer :: i,j,k
integer::omp_get_thread_num
call omp_set_dynamic(.FALSE.)
call omp_set_num_threads(2)
!$OMP PARALLEL DO PRIVATE(j)
do i=1,1000
j = omp_get_thread_num()+ 1
board(i,j)=i+j
enddo
read(*,*) k
END
Then I made de executable.
pgf90 -O2 -mp -o testeOpenMP testeOpenMP.f90
Well, when I use top command (program is waiting the keyboard
input (read(*,*))), its shows me 3 processes, and one eating CPU without doing anything useful, at least for me. In a IRIX machine this
don't occur.
CPU0 states: 0.1% user, 0.3% system, 0.0% nice, 99.1% idle
CPU1 states: 100.0% user, 0.0% system, 0.0% nice, 0.0% idle
Mem: 2061776K av, 1979060K used, 82716K free, 0K shrd, 129864K
buff
Swap: 8193104K av, 1381520K used, 6811584K free 1445708K
cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
14608 s099 16 0 692 692 496 R 99.9 0.0 49:41 testeOpenMP
14606 s099 9 0 692 692 496 S 0.0 0.0 0:00 testeOpenMP
14607 s099 9 0 692 692 496 R 0.0 0.0 0:00 testeOpenMP
Is it normal? Am I doing anything wrong?
Thanks, bye.
Anselmo |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 5001 Location: The Portland Group Inc.
|
Posted: Fri Sep 23, 2005 2:58 pm Post subject: |
|
|
Hi Anselmo,
This is normal behavior. Our OpenMP runtime only creates each thread once and then attached and detaches to the threads as needed. When not in use, the threads are in a 'sched_yield' state, meaning that while they may be using CPU time, if another process needs that CPU, the thread will yield.
- Mat |
|
| Back to top |
|
 |
Ansa
Joined: 23 Sep 2005 Posts: 2
|
Posted: Wed Sep 28, 2005 6:58 am Post subject: Process eating CPU |
|
|
Hi Mat.
First of all I would like to thank you for your attention. I read in another forum (Programming and Compiling-OpenMP high system usage) a similar problem and, in the last message, you suggested to set the number of threads to one after de parallel region. I did this and the top command shows me now only two threads sleeeping.
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CMD
27248 s099 9 0 736 732 528 S 0.0 0.0 0:10 testeOpenMP
27249 s099 8 0 736 732 528 S 0.0 0.0 0:00 testeOpenMP
As my application will have few parallel regions, I think that thil will solve my concern.
Thank you again.
Bye
Anselmo |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|