Go to the documentation of this file.
33#ifndef __DEF_OPENMP_H__
34#define __DEF_OPENMP_H__
37#define STRINGIFY(x) STR(x)
38#define CONCATENATE(x, y) x y
39#define CONCATPARENTH(x, y) x ( y )
45#define TPI_PRAGMA_CLAUSE(directive, clause) _Pragma( STRINGIFY( CONCATENATE( directive, clause ) ) )
46#define TPI_PRAGMA(directive) _Pragma( STRINGIFY( directive ) )
47#define TPI_PRAGMA_PARENTH(directive, var) _Pragma( STRINGIFY( CONCATPARENTH( directive, var ) ) )
51#define TPI_PRAGMA_CLAUSE(directive, clause)
52#define TPI_PRAGMA(directive)
53#define TPI_PRAGMA_PARENTH(directive, var)
58#define TPI_FOR_CLAUSE(clause) TPI_PRAGMA_CLAUSE( TPI_DIR_FOR, clause )
59#define TPI_FOR TPI_PRAGMA( TPI_DIR_FOR )
60#define TPI_PARA_CLAUSE(clause) TPI_PRAGMA_CLAUSE( TPI_DIR_PARA, clause )
62#define TPI_PARA_CLAUSE_SHARED(priv, clause) TPI_PRAGMA_CLAUSE( TPI_DIR_PARA, \
63 TPI_CLAUSE_DEFAULT( shared ) \
64 TPI_CLAUSE_PRIVATE( (priv) ) clause )
66#define TPI_PARA_SHARED TPI_PRAGMA_CLAUSE( TPI_DIR_PARA, \
67 TPI_CLAUSE_DEFAULT( shared ) )
69#define TPI_PARA_SHARED_PRIVATE(priv) TPI_PRAGMA_CLAUSE( TPI_DIR_PARA, \
70 TPI_CLAUSE_DEFAULT( shared ) \
71 TPI_CLAUSE_PRIVATE( ( priv ) ) )
73#define TPI_PARA_CLAUSE_NONE(share, priv, clause) TPI_PRAGMA_CLAUSE( TPI_DIR_PARA, \
74 TPI_CLAUSE_DEFAULT( (none) ) \
75 TPI_CLAUSE_SHARED( (share) ) \
76 TPI_CLAUSE_PRIVATE( (priv) ) clause )
78#define TPI_PARA TPI_PRAGMA( TPI_DIR_PARA )
79#define TPI_CRITICAL(var) TPI_PRAGMA_PARENTH( TPI_DIR_CRITICAL, var)
80#define TPI_MASTER TPI_PRAGMA( TPI_DIR_MASTER )
81#define TPI_WAIT TPI_PRAGMA( TPI_DIR_WAIT )
82#define TPI_ORDERED TPI_PRAGMA( TPI_DIR_ORDERED )
83#define TPI_SINGLE TPI_PRAGMA( TPI_DIR_SINGLE )
84#define TPI_CLAUSE_SINGLE(clause) TPI_PRAGMA_CLAUSE( TPI_DIR_SINGLE, clause )
85#define TPI_TASK TPI_PRAGMA( TPI_DIR_TASK )
86#define TPI_TASK_SHARED TPI_PRAGMA_CLAUSE( TPI_DIR_TASK, \
87 TPI_CLAUSE_DEFAULT(shared) )
88#define TPI_CLAUSE_TASK(clause) TPI_PRAGMA_CLAUSE( TPI_DIR_TASK, clause )
89#define TPI_TASKWAIT TPI_PRAGMA( TPI_DIR_TASKWAIT )
93#define TPI_DIR_PARA omp parallel
94#define TPI_DIR_FOR omp for
95#define TPI_DIR_CRITICAL omp critical
96#define TPI_DIR_MASTER omp master
97#define TPI_DIR_WAIT omp barrier
98#define TPI_DIR_ORDERED omp ordered
99#define TPI_DIR_TASK omp task
100#define TPI_DIR_SINGLE omp single
101#define TPI_DIR_TASKWAIT omp taskwait
105#define TPI_CLAUSE_PRIVATE(var) CONCATENATE( private, var )
106#define TPI_CLAUSE_FSTPRIVATE(var) CONCATENATE( firstprivate, var )
107#define TPI_CLAUSE_LSTPRIVATE(var) CONCATENATE( lastprivate, var )
108#define TPI_CLAUSE_CPYPRIVATE(var) CONCATENATE( copyprivate, var )
109#define TPI_CLAUSE_NOWAIT nowait
110#define TPI_CLAUSE_SHARED(var) CONCATENATE( shared, var )
111#define TPI_CLAUSE_DEFAULT(var) CONCATPARENTH( default, var )
115#define TPI_CLAUSE_REDUCE(op, var) CONCATENATE( reduction, CONCATENATE( CONCATENATE( op, : ), var ) )
116#define TPI_CLAUSE_ORDERED ordered
117#define TPI_CLAUSE_IF(var) CONCATENATE( if, var )
118#define TPI_CLAUSE_NUMTHREADS(var) CONCATENATE( num_threads, var )
119#define TPI_CLAUSE_SCHEDULE(type) CONCATENATE( schedule, type )
120#define TPI_CLAUSE_SCHEDULE_CHUNK(type, chunk) CONCATENATE( schedule, CONCATPARENTH( type, chunk ) )
121#define TPI_CLAUSE_COPYIN(var) CONCATENATE( copyin, var )
122#define TPI_CLAUSE_FINAL(var) CONCATENATE( final, var )
123#define TPI_CLAUSE_UNTIED untied
124#define TPI_CLAUSE_MERGEABLE mergeable
125#define TPI_CLAUSE_DEPEND(type, var) CONCATENATE( depend, CONCATENATE( CONCATENATE( type, : ), var ) )
126#define TPI_CLAUSE_PRIORITY(var) CONCATENATE( priority, var )
130#define TPI_SHARED_DATA(name, members) struct TPI_Shared_Data { \
134#define TPI_PRIVATE_DATA(name, members) struct TPI_Private_Data { \
138#define TPI_FSTPRIVATE_DATA(name, members) struct TPI_FirstPrivate_Data { \
142#define TPI_LSTPRIVATE_DATA(name, members) struct TPI_LastPrivate_Data { \
146#define TPI_COPYIN_DATA(name, members) struct TPI_CopyIn_Data { \