Hey, what's going on?

[SOLVED] gfortran/openmp problem on Mandriva 2010

Posted by Syeilendra Pramuditya on August 9, 2010

Test file:

C******************************************************************************
C FILE: omp_hello.f
C DESCRIPTION:
C   OpenMP Example - Hello World - Fortran Version
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 AUTHOR: Blaise Barney (LLNL)  5/99
C LAST REVISED:
C******************************************************************************

PROGRAM HELLO

INTEGER NTHREADS, TID, OMP_GET_NUM_THREADS,
+        OMP_GET_THREAD_NUM

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()
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
END IF

C     All threads join master thread and disband
!$OMP END PARALLEL

END

System information:

[user74@pavilion]$ uname -a
Linux pavilion 2.6.31.5-server-1mnb #1 SMP Fri Oct 23 03:13:55 EDT 2009 i686 Intel(R) Core(TM) i7 CPU 870  @ 2.93GHz GNU/Linux

[user74@pavilion]$ gfortran -v
Using built-in specs.
Target: i586-manbo-linux-gnu
Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --with-slibdir=/lib --with-bugurl=https://qa.mandriva.com/ --mandir=/usr/share/man --infodir=/usr/share/info --enable-checking=release --enable-languages=c,c++,ada,fortran,objc,obj-c++,java --build=i586-manbo-linux-gnu --host=i586-manbo-linux-gnu --with-cpu=generic --with-system-zlib --enable-threads=posix --enable-shared --enable-objc-gc --enable-long-long --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-gtk-cairo --disable-libjava-multilib --enable-ssp --disable-libssp --disable-werror --with-ppl --with-cloog --with-python-dir=/lib/python2.6/site-packages
Thread model: posix
gcc version 4.4.1 (GCC)

[user74@pavilion]$ rpm -qa | grep -i libgomp
libgomp1-4.4.1-4mnb2

The problem:

[user74@pavilion]$ gfortran -fopenmp omp_hello.f
gfortran: libgomp.spec: No such file or directory

Solution:

Download libgomp-devel-4.4.1-4mnb2.i586.rpm

Install the rpm:

[user74@pavilion]$ rpm -ivh "libgomp-devel-4.4.1-4mnb2.i586.rpm"

[user74@pavilion]$ rpm -qa | grep -i libgomp
libgomp-devel-4.4.1-4mnb2
libgomp1-4.4.1-4mnb2

Test:

[user74@pavilion]$ gfortran -fopenmp omp_hello.f
[user74@pavilion]$ ./a.out
Hello World from thread =            1
Hello World from thread =            0
Number of threads =            8
Hello World from thread =            2
Hello World from thread =            7
Hello World from thread =            4
Hello World from thread =            5
Hello World from thread =            3
Hello World from thread =            6

[PROBLEM SOLVED]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: