- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i am learning openmp programming now. my problem is with compilation the code.i use noncomercial version of ifort and icc
if i use ifort to compile the code i get a error message.
compile command:ifort -openmp -openmp_reprot2 -o file file.f90
*********************************************************************
this is the error message that i get:
fortcom: Severe: /tmp/ifort3FPGKi.f90, line 1: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
# 2 "2.f90"
^
compilation aborted for 1.f90 (code 3)
*********************************************************************
but with icc everything works
i am attaching the f90 program herewith:
PROGRAM HELLO
INTEGER:: NTHREADS, TID, OMP_GET_NUM_THREADS,&
& OMP_GET_THREAD_NUM
! Fork a team of threads giving them their own copies of variables
!$OMP PARALLEL PRIVATE(NTHREADS, TID) num_threads(np1)
! Obtain and print thread id
TID = OMP_GET_THREAD_NUM()
PRINT *, 'Hello World from thread = ', TID
! Only master thread does this
IF (TID .EQ. 0) THEN
NTHREADS = OMP_GET_NUM_THREADS()
N=OMP_GET_NUM_PROCS()
PRINT *, 'Number of threads = ', NTHREADS
PRINT *, 'N of Procs:',N
END IF
! All threads join master thread and disband
!$OMP END PARALLEL
END
if i dont use the -openmp_report2 in time of compilation the program get compiled.
but the print result for the OMP_GET_NUM_PROCS() is not right.
here is the output without -openmp_report2:
Hello World from thread = 0
Number of threads = 2
N of Procs: -2147483648
Hello World from thread = 1
i dont understand the print result of N.
but there is no problem with icc compiler.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's an even simpler program to repro the problem...on my Linux machine with Ifort 8.0.039 I get the same '-2147483648' error.
PROGRAM omp_test
N = omp_get_num_procs()
WRITE (*,*) "omp_get_num_procfs = ", N
END
Note, this 'C' program works fine...
#include
#include
int main(void) {
int num_procs;
num_procs = omp_get_num_procs();
printf("num procs = %d
", num_procs);
return 0;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for your comments.
i am using ifort version 8.0, which is available free for noncommercial purpose. do you mean that this openmp problem is due to any bug in it.
other versions are not available free.
is there anyway out.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
IF (TID .EQ. 0) THEN
NTHREADS = OMP_GET_NUM_THREADS()
PRINT *, 'Number of threads = ', NTHREADS,isum
END IF
!$OMP END PARALLEL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
jose@nuc2.fis.ucm.es wrote:
IF (TID .EQ. 0) THEN
NTHREADS = OMP_GET_NUM_THREADS()
PRINT *, 'Number of threads = ', NTHREADS,isum
END IF
Jose -
I'm surprised that Blaise Barney would write code this way. However, since this was written back in 1999, it is more understandable. Of course, a better way to write the above portion of the code would be
!$omp master NTHREADS = OMP_GET_NUM_THREADS() PRINT *, 'Number of threads =', NTHREADS, isum !$omp end master
The assignment of threads to which processors on your system is something that the operating system is responsible for. I'm surprised that such a recent version of Red Hat Linux would be giving you such bad distribution.
The problem with using the -openmp_report 2 flag is something that is wrong with the compiler. This should be reported to Intel Premier Support (http://premier.intel.com).
--clay
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page