- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am compiling fortran applications with Ifort 8.0 and openmp in the hope to obtain executables that runs independent threads in every one of my two cpu's. I'm using intel fortran 8.0 for IA32 on a redhat 9.0 smp kernel. I have no problems compiling MPI codes that run on the two cpu's, but when using openmp, I can force the program to create any number of threads with the OMP_NUM_THREADS environment variable, but all the thread created go and run in the cpu 0. ssh I'm using ifort 8.0, kernel 2.40.20-8smp
and the code is as simple as:
C FILE: omp_hello.f
C DESCRIPTION:
C In this simple example, the master thread forks a parallel region.
C All threads in the team obtain their unique thread number and print it.
C The master thread only prints the total number of threads. Two OpenMP
C library routines are used to obtain the number of threads and each
C thread's number.
C SOURCE: Blaise Barney 5/99
C LAST REVISED:
C******************************************************************************
PROGRAM HELLO
real a(100000)
INTEGER NTHREADS, TID, OMP_GET_NUM_THREADS,
+ OMP_GET_THREAD_NUM
isum=0
C Fork a team of threads giving them their own copies of variables
!$OMP PARALLEL PRIVATE(NTHREADS, TID)
C DESCRIPTION:
C In this simple example, the master thread forks a parallel region.
C All threads in the team obtain their unique thread number and print it.
C The master thread only prints the total number of threads. Two OpenMP
C library routines are used to obtain the number of threads and each
C thread's number.
C SOURCE: Blaise Barney 5/99
C LAST REVISED:
C******************************************************************************
PROGRAM HELLO
real a(100000)
INTEGER NTHREADS, TID, OMP_GET_NUM_THREADS,
+ OMP_GET_THREAD_NUM
isum=0
C Fork a team of threads giving them their own copies of variables
!$OMP PARALLEL PRIVATE(NTHREADS, TID)
C Obtain thread number
TID = OMP_GET_THREAD_NUM()
do 100 j=1,1000
do 100 i=1,100000
a(i)=sin(i*1.)
isum=isum+1
100 continue
PRINT *, 'Hello World from thread = ', TID
C Only master thread does this
IF (TID .EQ. 0) THEN
NTHREADS = OMP_GET_NUM_THREADS()
PRINT *, 'Number of threads = ', NTHREADS,isum
END IF
IF (TID .EQ. 0) THEN
NTHREADS = OMP_GET_NUM_THREADS()
PRINT *, 'Number of threads = ', NTHREADS,isum
END IF
C All threads join master thread and disband
!$OMP END PARALLEL
!$OMP END PARALLEL
END
It reports the right number of threads, but they run all in one cpu.
Also, option -openmp_report 2 gives an internalcompiler error.
Thanks for the help
Jose
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What compile switches are you using? What is the complete compiler version? (8.0.???)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sblionel wrote:
What compile switches are you using? What is the complete compiler version? (8.0.???)
ifort version is 8.0.055
compiler switches I've tried are -openmp -openmp_report2
(that trigers the internal compiler error) and -openmp, at different levels of optimization.
Thread problem is solved, though! it was my fault in reading top and ps results. Sorry!!. Indeed the threads are running in the two processors.
Thanks
Jose
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