Has anyone gotten OpenMP to work on 5.5-{release,stable}/amd64?

'man gcc' and /usr/local/info/gcc.info both describe gcc support for
OpenMP (the -fopenmp compiler flag), but I'm getting fatal errors
(either missing compiler spec file or missing "omp.h" header file)
trying to compile even the simplest "hello, world" OpenMP programs
with gcc (either base /usr/bin/gcc or ports /usr/local/bin/gcc).

'locate omp.h' fails to find the header file anywhere, and
'man clang' doesn't mention OpenMP support at all.

I want to develop OpenMP programs on OpenBSD.  Do I need to build my
own gcc to do so?


Script started on Tue Jul  1 10:21:34 2014
% uname -a
OpenBSD copper.astro.indiana.edu 5.5 GENERIC.MP#0 amd64
% cat hello.c
#include <stdio.h>

int main(void)
{
  #pragma omp parallel
    printf("Hello, world.\n");
  return 0;
}
% cat mt-hello.c
#include <stdio.h>
#include "omp.h"

int main(void)
{
#pragma omp parallel
  {
int id = omp_get_thread_num();
printf("hello(%d)\n",  id);
printf("world(%d)\n",  id);
  }
return 0;
}
%
%
% /usr/bin/gcc --version
gcc (GCC) 4.2.1 20070719
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% /usr/bin/gcc -fopenmp -o hello hello.c
gcc: libgomp.spec: No such file or directory
% /usr/bin/gcc -fopenmp -o mt-hello mt-hello.c
mt-hello.c:2:17: error: omp.h: No such file or directory
%
%
% /usr/local/bin/gcc --version
gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% /usr/local/bin/gcc -fopenmp -o hello hello.c
gcc: error: libgomp.spec: No such file or directory
% /usr/local/bin/gcc -fopenmp -o mt-hello mt-hello.c
mt-hello.c:2:17: fatal error: omp.h: No such file or directory
 #include "omp.h"
                 ^
compilation terminated.
%
%
% /usr/local/bin/clang --version
clang version 3.3 (tags/RELEASE_33/final)
Target: amd64-unknown-openbsd5.5
Thread model: posix
% /usr/local/bin/clang -fopenmp -o hello hello.c
clang-3.3: warning: argument unused during compilation: '-fopenmp'
% ./hello
Hello, world.
% /usr/local/bin/clang -fopenmp -o mt-hello mt-hello.c
clang-3.3: warning: argument unused during compilation: '-fopenmp'
mt-hello.c:2:10: fatal error: 'omp.h' file not found
#include "omp.h"
         ^
1 error generated.
% exit
Script done on Tue Jul  1 10:23:46 2014

ciao,

-- 
-- "Jonathan Thornburg [remove -animal to reply]" 
<jth...@astro.indiana-zebra.edu>
   Dept of Astronomy & IUCSS, Indiana University, Bloomington, Indiana, USA
   currently on the west coast of Canada
   "There was of course no way of knowing whether you were being watched
    at any given moment.  How often, or on what system, the Thought Police
    plugged in on any individual wire was guesswork.  It was even conceivable
    that they watched everybody all the time."  -- George Orwell, "1984"

Reply via email to