Discussion:
Running OpenMP program
Kishore Kumar Pusukuri
2011-02-03 07:17:29 UTC
Permalink
Hi,
I have been compiling and running OpenMP parallel programs successfully so far on my OpenSolaris.2009.10 machine. However I am unable to run one program with more than one thread(lwp). Please see details of the program below. Please let me know if there is anything wrong with the compilation or running this particular program. I am using the following command line arguments to run the program and I am using g++-4.2.3 to compile the program with "-fopenmp" option and also linked libmtsk.so.1. There are no compilation warnings/errors.

$env OMP_NUM_THREADS=8 <myprogram>

$ ldd <myprogram>
libmtsk.so.1 => /lib/libmtsk.so.1
libstdc++.so.6 => /usr/lib/libstdc++.so.6
libm.so.2 => /lib/libm.so.2
libgomp.so.1 => /usr/lib/libgomp.so.1
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1
libpthread.so.1 => /lib/libpthread.so.1
libc.so.1 => /lib/libc.so.1
libthread.so.1 => /lib/libthread.so.1
libdl.so.1 => /lib/libdl.so.1
--
This message posted from opensolaris.org
Darryl Gove
2011-02-03 07:33:29 UTC
Permalink
Hi,

It sounds like either a problem with your source code or a problem with
the compiler. You are using the correct flag and a sufficiently recent
version of g++. So it should work.

I'd suggest writing a really simple OpenMP program and checking that it
runs in parallel. I'd also suggest using Solaris Studio ( the flags -O
-xopenmp -xloopinfo -xvpara will give you a bunch of diagnostics) on the
simple test to check whether there's an issue with the source, and
confirm that it is working as expected.

Regards,

Darryl.
Post by Kishore Kumar Pusukuri
Hi,
I have been compiling and running OpenMP parallel programs successfully so far on my OpenSolaris.2009.10 machine. However I am unable to run one program with more than one thread(lwp). Please see details of the program below. Please let me know if there is anything wrong with the compilation or running this particular program. I am using the following command line arguments to run the program and I am using g++-4.2.3 to compile the program with "-fopenmp" option and also linked libmtsk.so.1. There are no compilation warnings/errors.
$env OMP_NUM_THREADS=8<myprogram>
$ ldd<myprogram>
libmtsk.so.1 => /lib/libmtsk.so.1
libstdc++.so.6 => /usr/lib/libstdc++.so.6
libm.so.2 => /lib/libm.so.2
libgomp.so.1 => /usr/lib/libgomp.so.1
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1
libpthread.so.1 => /lib/libpthread.so.1
libc.so.1 => /lib/libc.so.1
libthread.so.1 => /lib/libthread.so.1
libdl.so.1 => /lib/libdl.so.1
--
Darryl Gove
Compiler Performance Engineering
Blog : http://blogs.sun.com/d/
Books: http://my.safaribooksonline.com/9780321711441
http://my.safaribooksonline.com/9780768681390
http://my.safaribooksonline.com/0595352510
Bob Friesenhahn
2011-02-03 16:07:08 UTC
Permalink
Hi, I have been compiling and running OpenMP parallel programs
successfully so far on my OpenSolaris.2009.10 machine. However I am
unable to run one program with more than one thread(lwp). Please see
details of the program below. Please let me know if there is
anything wrong with the compilation or running this particular
program. I am using the following command line arguments to run the
program and I am using g++-4.2.3 to compile the program with
"-fopenmp" option and also linked libmtsk.so.1. There are no
compilation warnings/errors.
You don't want to link against libmtsk.so.1. That is the library used
by Sun's OpenMP implementation. You want to link against libgomp,
which is the GCC OpenMP implementation. Mixing these two in the same
program is probably a very bad idea since they define many similar
symbols. When you use GCC to link a program with the "-fopenmp"
option, it will automatically link against libgomp.

Bob
$env OMP_NUM_THREADS=8 <myprogram>
$ ldd <myprogram>
libmtsk.so.1 => /lib/libmtsk.so.1
libstdc++.so.6 => /usr/lib/libstdc++.so.6
libm.so.2 => /lib/libm.so.2
libgomp.so.1 => /usr/lib/libgomp.so.1
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1
libpthread.so.1 => /lib/libpthread.so.1
libc.so.1 => /lib/libc.so.1
libthread.so.1 => /lib/libthread.so.1
libdl.so.1 => /lib/libdl.so.1
--
Bob Friesenhahn
bfriesen-***@public.gmane.org, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Darryl Gove
2011-02-03 17:44:08 UTC
Permalink
Hi, I have been compiling and running OpenMP parallel programs
successfully so far on my OpenSolaris.2009.10 machine. However I am
unable to run one program with more than one thread(lwp). Please see
details of the program below. Please let me know if there is anything
wrong with the compilation or running this particular program. I am
using the following command line arguments to run the program and I am
using g++-4.2.3 to compile the program with "-fopenmp" option and also
linked libmtsk.so.1. There are no compilation warnings/errors.
You don't want to link against libmtsk.so.1. That is the library used by
Sun's OpenMP implementation. You want to link against libgomp, which is
the GCC OpenMP implementation. Mixing these two in the same program is
probably a very bad idea since they define many similar symbols. When
you use GCC to link a program with the "-fopenmp" option, it will
automatically link against libgomp.
Good catch - I'm so used to seeing libmtsk there! Yeah, you're probably
resolving the omp_*() functions from libmtsk not libgomp, which means
you'd get the wrong answer.

use lari on the app:
lari <myprogram>
to see if this is the case.

Darryl.
Bob
$env OMP_NUM_THREADS=8 <myprogram>
$ ldd <myprogram>
libmtsk.so.1 => /lib/libmtsk.so.1
libstdc++.so.6 => /usr/lib/libstdc++.so.6
libm.so.2 => /lib/libm.so.2
libgomp.so.1 => /usr/lib/libgomp.so.1
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1
libpthread.so.1 => /lib/libpthread.so.1
libc.so.1 => /lib/libc.so.1
libthread.so.1 => /lib/libthread.so.1
libdl.so.1 => /lib/libdl.so.1
--
Darryl Gove
Compiler Performance Engineering
Blog : http://blogs.sun.com/d/
Books: http://my.safaribooksonline.com/9780321711441
http://my.safaribooksonline.com/9780768681390
http://my.safaribooksonline.com/0595352510
Continue reading on narkive:
Loading...