Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] CDT DOM handling of #pragma?

As part of the PTP (Parallel Tools Platform,  http://eclipse.org/ptp )
support for MPI in C/C++, we use the CDT DOM to find the MPI functions and
constants ("MPI Artifacts").
We are considering  a similar thing for OpenMP.
However OpenMP is a mixture of compiler directives (#pragma) and functions.
It appears that the #pragmas do not appear in the CDT DOM.
Is there any chance that could change in the future?
I would need the remainder of the #pragma line saved in the AST/DOM as
well.

Example OpenMP program (courtesy of
http://www.llnl.gov/computing/tutorials/openMP/)

#include <omp.h>

main ()  {
int nthreads, tid;
/* Fork a team of threads giving them their own copies of variables */
#pragma omp parallel private(tid)
  {
  /* Obtain and print thread id */
  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 terminate */
}

The OpenMP directives seem to all start with "#pragma omp"  - so, a text
search
would probably suffice, but be less flexible for other uses.

...Beth

Beth Tibbitts  (859) 243-4981  (TL 545-4981)
High Productivity Tools
IBM T.J.Watson Research Center
Mailing Address:  IBM Corp., 455 Park Place, Lexington, KY 40511



Back to the top