DragonFly BSD
DragonFly users List (threaded) for 2012-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

libgomp support in gcc4.7 seems to be missing include and spec file

From: Edward Berger <edwberger@xxxxxxxxx>
Date: Wed, 24 Oct 2012 15:06:34 -0400

Updated a machine to current head world and kernel to try openmp.
Using "omp_hello" example below (from
http://users.abo.fi/mats/PP2012/examples/OpenMP/ ) fails.
First the include file omp.h isn't found, commenting out that source
line then gcc complains about libgomp.spec isn't found.

  OpenMP example program Hello World.
  The master thread forks a parallel region.
  All threads in the team obtain their thread number and print it.
  Only the master thread prints the total number of threads.
  Compile with: gcc -O3 -fopenmp omp_hello.c -o omp_hello

#include <omp.h>
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[]) {

  int nthreads, tid;

  /* Fork a team of threads giving them their own copies of variables */
#pragma omp parallel private(nthreads, tid)
    /* Get thread number */
    tid = omp_get_thread_num();
    printf("Hello World from thread = %d\n", tid);

    /* Only master thread does this */
    if (tid == 0) {
      nthreads = omp_get_num_threads();
      printf("Number of threads = %d\n", nthreads);
  }  /* All threads join master thread and disband */

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]