OpenMP

Andrea Venturoli ml at netfence.it
Thu Jul 30 07:13:00 UTC 2009


Hello.

I'm trying to use OpenMP in C++ on FreeBSD 6.3p10/i386 and I'm totally
stuck.

First off, base system's gcc (3.4.6) does not include OpenMP support, so
I'm using gcc 4.2.5 from ports (I also tried 4.3.4, but that does not
make much difference).

I've added the flag -fopenmp to the command line: this enables parsing
of #pragma omp directives, but results in undefined references at
compilation time. So I also added -lgomp (although Google suggests it
should be automatically picked up).

Now the program compiles and links fine, but at runtime, as soon as the
"#pragma"ed function is called, I get again undefined references (to
GOMP_parallel_start, GOMP_parallel_end, omp_get_num_threads and
omp_get_thread_num).

I tried removing the #pragmas (so OpenMP is not used, altough enabled
and linked in), and so I get "Bad system call (core dumped)" at runtime.
gdb tells me this happens in ksem_init and Google again helps by telling
me I need to put "options P1003_1B_SEMAPHORES" (from NOTES) in my kernel
config, or kldload sem.

The problem is, all these messages are very old:
_ "kldload sem" results in "No such file or directory";
_ a sysvsem.ko exists in /boot/kernel, but "kldload sysvsem" results in
"File exists" (I have in fact "options SYSVSEM" in my kernel config);
_ my system's NOTES bears no mention of P1003_1B_SEMAPHORES;
_ man sem still reports "FreeBSD 6.2" at the bottom.

So I was wondering if these suggestions are still valid, or if something
changed before 6.3 was released; on the other hand, is 6.3 too old and
would upgrading to some newer version solve this matter?

Any other hint or info is appreciated.

  bye & Thanks
	av.



More information about the freebsd-questions mailing list