[lsb-discuss] LSB -- next 4.1
Dallman, John
john.dallman at siemens.com
Wed May 27 06:10:49 PDT 2009
> > Support for libgomp, the OpenMP support library would also be
useful.
> > Will that have to wait until GCC 4.3 becomes the minimum supported?
>
> Hey, you can't have that if I can't have dbus :) :)
>
> Anyway, the fact you brought that question up means you know
> more about it than I do.
Not much more than you, I'm afraid.
> Is this one of those things that's very closely tied to a compiler?
> Does it cause compat issues when we think about other compilers also
> being usable?
It's the support library for GNU OpenMP, and it's needed by any OpenMP
program built with GCC. GCC supports OpenMP from GCC 4.3 onwards. I
don't
know how closely versions of the OpenMP library are tied to versions of
GCC.
Here's a Hello World in C that uses OpenMP, from Wikipedia:
#include <omp.h>
#include <stdio.h>
int main (int argc, char *argv[]) {
int th_id, nthreads;
#pragma omp parallel private(th_id)
{
th_id = omp_get_thread_num();
printf("Hello World from thread %d\n", th_id);
#pragma omp barrier
if ( th_id == 0 ) {
nthreads = omp_get_num_threads();
printf("There are %d threads\n",nthreads);
}
}
return 0;
}
On SLES11, I save that to a file openmp_hello.c and compile
it with "gcc openmp_hello.c -o openmp_hello -lgomp". If you
don't use -lgomp, you get link errors:
openmp_hello.c:(.text+0x10): undefined reference to `omp_get_thread_num'
openmp_hello.c:(.text+0x30): undefined reference to
`omp_get_num_threads'
ldd openmp_hello says:
linux-vdso.so.1 => (0x00007fff553ff000)
libgomp.so.1 => /usr/lib64/libgomp.so.1 (0x00007f174ce4a000)
libc.so.6 => /lib64/libc.so.6 (0x00007f174caf1000)
librt.so.1 => /lib64/librt.so.1 (0x00007f174c8e8000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f174c6cc000)
/lib64/ld-linux-x86-64.so.2 (0x00007f174d053000)
We would like to have to option of using OpenMP in the Parasolid
solid modeller in the future. But we do want to stay LSB-compliant,
because that means we don't have to test on dozens of different
Linuxes.
If you want me to try more experiments, I'm happy to do so.
thanks,
--
John Dallman
Parasolid Porting Engineer
More information about the lsb-discuss
mailing list