Commit bb6342a0 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Fixed isOMPEnabled and added missing HAVE_OPENMP guards

parent 1c128e27
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -34,7 +34,17 @@ class Host
 
      static void enableOMP();
 
      static inline bool isOMPEnabled() { return ompEnabled; };
      static inline bool isOMPEnabled()
      {
         // This MUST stay in the header since we are interested in whether the
         // client was compiled with OpenMP support, not the libtnl.so file.
         // Also, keeping it in the header makes it inline-able.
#ifdef HAVE_OPENMP
         return ompEnabled;
#else
         return false;
#endif
      }
 
      static void setMaxThreadsCount( int maxThreadsCount );
 
+14 −1
Original line number Diff line number Diff line
@@ -75,19 +75,24 @@ processEntities(
   else
   {
      //TODO: This does not work with gcc-5.4 and older, should work at gcc 6.x
      /*for( entity.getCoordinates().x() = begin.x();
/*#pragma omp parallel for firstprivate( entity, begin, end ) if( Devices::Host::isOMPEnabled() )
      for( entity.getCoordinates().x() = begin.x();
           entity.getCoordinates().x() <= end.x();
           entity.getCoordinates().x() ++ )
      {
         entity.refresh();
         EntitiesProcessor::processEntity( entity.getMesh(), *userDataPointer, entity );
      }*/ 
#ifdef HAVE_OPENMP
#pragma omp parallel firstprivate( begin, end ) if( Devices::Host::isOMPEnabled() )
#endif
      {
         GridEntity entity( *gridPointer );
         entity.setOrientation( entityOrientation );
         entity.setBasis( entityBasis );
#ifdef HAVE_OPENMP
#pragma omp for 
#endif
         for( IndexType x = begin.x(); x<= end.x(); x ++ )
         {
            entity.getCoordinates().x() = x;
@@ -283,12 +288,16 @@ processEntities(
            entity.refresh();
            EntitiesProcessor::processEntity( entity.getMesh(), *userDataPointer, entity );
         }*/
#ifdef HAVE_OPENMP
#pragma omp parallel firstprivate( begin, end ) if( Devices::Host::isOMPEnabled() )
#endif
      {
         GridEntity entity( *gridPointer );
         entity.setOrientation( entityOrientation );
         entity.setBasis( entityBasis );
#ifdef HAVE_OPENMP
#pragma omp for 
#endif
         for( IndexType y = begin.y(); y <= end.y(); y ++ )
            for( IndexType x = begin.x(); x<= end.x(); x ++ )
            {
@@ -481,12 +490,16 @@ processEntities(
               entity.refresh();
               EntitiesProcessor::processEntity( entity.getMesh(), *userDataPointer, entity );
            }*/
#ifdef HAVE_OPENMP
#pragma omp parallel firstprivate( begin, end ) if( Devices::Host::isOMPEnabled() )
#endif
      {
         GridEntity entity( *gridPointer );
         entity.setOrientation( entityOrientation );
         entity.setBasis( entityBasis );         
#ifdef HAVE_OPENMP
#pragma omp for
#endif
         for( IndexType z = begin.y(); z <= end.y(); z ++ )
            for( IndexType y = begin.y(); y <= end.y(); y ++ )
               for( IndexType x = begin.x(); x<= end.x(); x ++ )