Commit 33510158 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Fixed a bug in OpenMP grid traverser.

parent 9c7dab00
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ fi


PYTHON_TEST="`python src/Tools/python-path-test.py 2> /dev/null`"
echo "xxxxx ${PYTHON_TEST} xxxxx\n"
#echo "xxxxx ${PYTHON_TEST} xxxxx\n"
if test PYTHON_TEST != "xOK";
then
    source ${BUILD_PREFIX}/python-version    
+2 −2
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@ class GridTraverser< Meshes::Grid< 1, Real, Devices::Host, Index > >
      static void
      processEntities(
         const GridPointer& gridPointer,
         const CoordinatesType& begin,
         const CoordinatesType& end,
         const CoordinatesType begin,
         const CoordinatesType end,
         const CoordinatesType& entityOrientation,
         const CoordinatesType& entityBasis,
         UserData& userData );
+65 −40
Original line number Diff line number Diff line
@@ -27,19 +27,18 @@ void
GridTraverser< Meshes::Grid< 1, Real, Devices::Host, Index > >::
processEntities(
   const GridPointer& gridPointer,
   const CoordinatesType& begin,
   const CoordinatesType& end,
   const CoordinatesType begin,
   const CoordinatesType end,
   const CoordinatesType& entityOrientation,
   const CoordinatesType& entityBasis,
   UserData& userData )
{   

   
   if( processOnlyBoundaryEntities )
   {
      GridEntity entity( *gridPointer );
      entity.setOrientation( entityOrientation );
      entity.setBasis( entityBasis );
   if( processOnlyBoundaryEntities )
   {

      entity.getCoordinates() = begin;
      entity.refresh();
      EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
@@ -49,14 +48,29 @@ processEntities(
   }
   else
   {
      for( entity.getCoordinates().x() = begin.x();
      //TODO: This does not work with gcc-5.4 and older, should work at gcc 6.x
      /*for( entity.getCoordinates().x() = begin.x();
           entity.getCoordinates().x() <= end.x();
           entity.getCoordinates().x() ++ )
      {
         entity.refresh();
         EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
      }*/ 
#pragma omp parallel firstprivate( begin, end ) if( Devices::Host::isOMPEnabled() )
      {
         GridEntity entity( *gridPointer );
         entity.setOrientation( entityOrientation );
         entity.setBasis( entityBasis );
#pragma omp for 
         for( IndexType x = begin.x(); x<= end.x(); x ++ )
         {
            entity.getCoordinates().x() = x;
            entity.refresh();
            EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
         }      
      }
      
   }
}

/****
@@ -220,13 +234,13 @@ processEntities(
   const CoordinatesType& entityOrientation,
   const CoordinatesType& entityBasis,
   UserData& userData )
{
   if( processOnlyBoundaryEntities )
   {
      GridEntity entity( *gridPointer );
      entity.setOrientation( entityOrientation );
      entity.setBasis( entityBasis );
      
   if( processOnlyBoundaryEntities )
   {
      if( YOrthogonalBoundary )
         for( entity.getCoordinates().x() = begin.x();
              entity.getCoordinates().x() <= end.x();
@@ -254,7 +268,7 @@ processEntities(
   }
   else
   {
      //TODO: This does not work with gcc-5.4 and older
      //TODO: This does not work with gcc-5.4 and older, should work at gcc 6.x
/*#pragma omp parallel for firstprivate( entity, begin, end ) if( Devices::Host::isOMPEnabled() )
      for( entity.getCoordinates().y() = begin.y();
           entity.getCoordinates().y() <= end.y();
@@ -266,7 +280,12 @@ processEntities(
            entity.refresh();
            EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
         }*/
#pragma omp parallel for firstprivate( entity, begin, end ) if( Devices::Host::isOMPEnabled() )
#pragma omp parallel firstprivate( begin, end ) if( Devices::Host::isOMPEnabled() )
      {
         GridEntity entity( *gridPointer );
         entity.setOrientation( entityOrientation );
         entity.setBasis( entityBasis );
#pragma omp for 
         for( IndexType y = begin.y(); y <= end.y(); y ++ )
            for( IndexType x = begin.x(); x<= end.x(); x ++ )
            {
@@ -277,6 +296,7 @@ processEntities(
            }      
      }
   }
}

/****
 * 2D traverser, CUDA
@@ -405,13 +425,13 @@ processEntities(
   const CoordinatesType& entityOrientation,
   const CoordinatesType& entityBasis,
   UserData& userData )
{
   if( processOnlyBoundaryEntities )
   {
      GridEntity entity( *gridPointer );
      entity.setOrientation( entityOrientation );
      entity.setBasis( entityBasis );
      
   if( processOnlyBoundaryEntities )
   {
      if( ZOrthogonalBoundary )
         for( entity.getCoordinates().y() = begin.y();
              entity.getCoordinates().y() <= end.y();
@@ -460,7 +480,7 @@ processEntities(
   }
   else
   {
      // TODO: this does not work with gcc-5.4 and older
      // TODO: this does not work with gcc-5.4 and older, should work at gcc 6.x
/*#pragma omp parallel for firstprivate( entity, begin, end ) if( Devices::Host::isOMPEnabled() )      
      for( entity.getCoordinates().z() = begin.z();
           entity.getCoordinates().z() <= end.z();
@@ -475,7 +495,12 @@ processEntities(
               entity.refresh();
               EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
            }*/
#pragma omp parallel for firstprivate( entity, begin, end ) if( Devices::Host::isOMPEnabled() )
#pragma omp parallel firstprivate( begin, end ) if( Devices::Host::isOMPEnabled() )
      {
         GridEntity entity( *gridPointer );
         entity.setOrientation( entityOrientation );
         entity.setBasis( entityBasis );         
#pragma omp for
         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 ++ )
@@ -486,7 +511,7 @@ processEntities(
                  entity.refresh();
                  EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
            }
      
      }      
   }
}

+3 −3

File changed.

Contains only whitespace changes.