Commits

Michael Lange committed 43566f5 Draft

Moving OpenMP macros above includes that use them.

  • Participants
  • Parent commits abe3b93

Comments (0)

Files changed (2)

include/petscerror.h

 #define PetscThreadLocalDestroy(name)
 #endif
 
-#if defined(PETSC_HAVE_OPENMP)
-#include <omp.h>
-#define PetscGetNumThreads() omp_get_num_threads()
-#define PetscGetMaxThreads() omp_get_max_threads()
-#define PetscGetThreadNum() omp_get_thread_num()
-#define PetscPragmatize(x) _Pragma(#x)
-#define PetscPragmaOMP(x) PetscPragmatize(omp x)
-#define PetscPragmaOMPObject(obj, x) PetscPragmaOMP(x shared(obj) num_threads(((PetscObject)obj)->nthreads))
-#else
-#define PetscGetNumThreads() 1
-#define PetscGetMaxThreads() 1
-#define PetscGetThreadNum() 0
-#define PetscPragmaOMP(x)
-#define PetscPragmaOMPObject(obj, x)
-#endif
 
 /*MC
    PetscFunctionBegin - First executable line of each PETSc function

include/petscsys.h

 PETSC_EXTERN PetscErrorCode MPIULong_Send(void*,PetscInt,MPI_Datatype,PetscMPIInt,PetscMPIInt,MPI_Comm);
 PETSC_EXTERN PetscErrorCode MPIULong_Recv(void*,PetscInt,MPI_Datatype,PetscMPIInt,PetscMPIInt,MPI_Comm);
 
+/*
+   Define OpenMP pragmas before including other headers
+*/
+#if defined(PETSC_HAVE_OPENMP)
+#include <omp.h>
+#define PetscGetNumThreads() omp_get_num_threads()
+#define PetscGetMaxThreads() omp_get_max_threads()
+#define PetscGetThreadNum() omp_get_thread_num()
+#define PetscPragmatize(x) _Pragma(#x)
+#define PetscPragmaOMP(x) PetscPragmatize(omp x)
+#define PetscPragmaOMPObject(obj, x) PetscPragmaOMP(x shared(obj) num_threads(((PetscObject)obj)->nthreads))
+#else
+#define PetscGetNumThreads() 1
+#define PetscGetMaxThreads() 1
+#define PetscGetThreadNum() 0
+#define PetscPragmaOMP(x)
+#define PetscPragmaOMPObject(obj, x)
+#endif
+
 /*S
      PetscObject - any PETSc object, PetscViewer, Mat, Vec, KSP etc