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

Fixes after merge

parent d13fd73f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ endif()

# set Debug/Release options
set( CMAKE_CXX_FLAGS "-std=c++11 -pthread -Wall -Wno-unused-local-typedefs -Wno-unused-variable" )
set( CMAKE_CXX_FLAGS_DEBUG "-g -rdynamic -ftemplate-backtrace-limit=0" )
set( CMAKE_CXX_FLAGS_DEBUG "-g" )
set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -DNDEBUG" )
#set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -DNDEBUG -ftree-vectorizer-verbose=1 -ftree-vectorize -fopt-info-vec-missed -funroll-loops" )
# pass -rdynamic only in Debug mode
@@ -229,7 +229,7 @@ if( ${WITH_CUDA} )
                endif()
            endif()
        endif()
        set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; ${CUDA_ARCH} -D_FORCE_INLINES -lineinfo )
        set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; ${CUDA_ARCH} -D_FORCE_INLINES )
        # TODO: this is necessary only due to a bug in cmake
        set( CUDA_ADD_LIBRARY_OPTIONS -shared )
    endif()
+0 −55
Original line number Diff line number Diff line
/***************************************************************************
                          DistributedGrid_1D.h  -  description
                             -------------------
    begin                : January 09, 2018
    copyright            : (C) 2018 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/* See Copyright Notice in tnl/Copyright */

#pragma once

#include <TNL/Meshes/Grid.h>
#include <TNL/Logger.h>
#include <TNL/Meshes/DistributedMeshes/DistributedGrid_Base.h>

namespace TNL {
namespace Meshes { 
namespace DistributedMeshes {

template< typename RealType, typename Device, typename Index >     
class DistributedMesh< Grid< 1, RealType, Device, Index > > : public DistributedGrid_Base<1, RealType, Device, Index >
{

    public:
 /*     using typename DistributedGrid_Base<1, RealType, Device, Index >::IndexType;
      using typename DistributedGrid_Base<1, RealType, Device, Index >::GridType;
      using typename DistributedGrid_Base<1, RealType, Device, Index >::PointType;
      using typename DistributedGrid_Base<1, RealType, Device, Index >::CoordinatesType;*/

      typedef typename DistributedGrid_Base<1, RealType, Device, Index >::CoordinatesType CoordinatesType;
      typedef typename DistributedGrid_Base<1, RealType, Device, Index >::IndexType IndexType;
      typedef typename DistributedGrid_Base<1, RealType, Device, Index >::GridType GridType;
      typedef typename DistributedGrid_Base<1, RealType, Device, Index >::PointType PointType;
      typedef typename DistributedGrid_Base<1, RealType, Device, Index >::SubdomainOverlapsType SubdomainOverlapsType;

      bool setup( const Config::ParameterContainer& parameters,
                  const String& prefix );
      
      void setupGrid( GridType& grid );
       
      String printProcessCoords() const;

      String printProcessDistr() const;    
            
      void writeProlog( Logger& logger ) const; 
      
};

      } //namespace DistributedMeshes
   } // namespace Meshes
} // namespace TNL

#include <TNL/Meshes/DistributedMeshes/DistributedGrid_1D.hpp>
+0 −70
Original line number Diff line number Diff line
/***************************************************************************
                          DistributedGrid_1D.hpp  -  description
                             -------------------
    begin                : January 09, 2018
    copyright            : (C) 2018 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/* See Copyright Notice in tnl/Copyright */

#pragma once

#include <cstdlib>

namespace TNL {
   namespace Meshes {
      namespace DistributedMeshes {

template< typename RealType, typename Device, typename Index >     
bool
DistributedMesh< Grid< 1, RealType, Device, Index > >::
setup( const Config::ParameterContainer& parameters,
       const String& prefix )
{
   this->domainDecomposition.x() = parameters.getParameter< int >( "grid-domain-decomposition-x" );
   return true;
}      

template< typename RealType, typename Device, typename Index >     
void
DistributedMesh< Grid< 1, RealType, Device, Index > >::
setupGrid( GridType& grid)
{
   TNL_ASSERT_TRUE(this->isSet,"DistributedGrid is not set, but used by SetupGrid");
   grid.setOrigin(this->localOrigin);
   grid.setDimensions(this->localGridSize);
   //compute local proportions by sideefect
   grid.setSpaceSteps(this->spaceSteps);
   grid.setDistMesh(this);
};

template< typename RealType, typename Device, typename Index >     
String
DistributedMesh< Grid< 1, RealType, Device, Index > >::
printProcessCoords() const
{
   return convertToString(this->rank);
};

template< typename RealType, typename Device, typename Index >     
String
DistributedMesh< Grid< 1, RealType, Device, Index > >::
printProcessDistr() const
{
   return convertToString(this->nproc);
};       

template< typename RealType, typename Device, typename Index >
void
DistributedMesh< Grid< 1, RealType, Device, Index > >::
writeProlog( Logger& logger ) const
{
   this->globalGrid.writeProlog( logger );
   logger.writeParameter( "Domain decomposition:", this->getDomainDecomposition() );
}

      } //namespace DistributedMeshes
   } // namespace Meshes
} // namespace TNL
+0 −53
Original line number Diff line number Diff line
/***************************************************************************
                          DistributedGrid_2D.h  -  description
                             -------------------
    begin                : January 09, 2018
    copyright            : (C) 2018 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/* See Copyright Notice in tnl/Copyright */

#pragma once

#include <TNL/Meshes/Grid.h>
#include <TNL/Meshes/DistributedMeshes/DistributedGrid_Base.h>

namespace TNL {
namespace Meshes { 
namespace DistributedMeshes {


template< typename RealType, typename Device, typename Index >
class DistributedMesh< Grid< 2, RealType, Device, Index > >: public DistributedGrid_Base<2, RealType, Device, Index >
{
   public:

/*    using typename DistributedGrid_Base<2, RealType, Device, Index >::IndexType;
      using typename DistributedGrid_Base<2, RealType, Device, Index >::GridType;
      using typename DistributedGrid_Base<2, RealType, Device, Index >::PointType;
      using typename DistributedGrid_Base<2, RealType, Device, Index >::CoordinatesType;*/
      typedef typename DistributedGrid_Base<2, RealType, Device, Index >::CoordinatesType CoordinatesType;
      typedef typename DistributedGrid_Base<2, RealType, Device, Index >::IndexType IndexType;
      typedef typename DistributedGrid_Base<2, RealType, Device, Index >::GridType GridType;
      typedef typename DistributedGrid_Base<2, RealType, Device, Index >::PointType PointType;
      typedef typename DistributedGrid_Base<2, RealType, Device, Index >::SubdomainOverlapsType SubdomainOverlapsType;

      bool setup( const Config::ParameterContainer& parameters,
                  const String& prefix );
            
      void setupGrid( GridType& grid );
       
      String printProcessCoords() const;

      String printProcessDistr() const;
             
      void writeProlog( Logger& logger ) const;

};

} // namespace DistributedMeshes
} // namespace Meshes
} // namespace TNL

#include <TNL/Meshes/DistributedMeshes/DistributedGrid_2D.hpp>
+0 −73
Original line number Diff line number Diff line
/***************************************************************************
                          DistributedGrid_2D.hpp  -  description
                             -------------------
    begin                : January 09, 2018
    copyright            : (C) 2018 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/* See Copyright Notice in tnl/Copyright */

#include <cstdlib>

#include <TNL/Meshes/DistributedMeshes/DistributedGrid_Base.h>
#include <TNL/Communicators/MpiCommunicator.h>

#pragma once

namespace TNL {
   namespace Meshes { 
      namespace DistributedMeshes {

template< typename Real, typename Device, typename Index >
bool
DistributedMesh< Grid< 2, Real, Device, Index > >::
setup( const Config::ParameterContainer& parameters,
       const String& prefix )
{
   this->domainDecomposition.x() = parameters.getParameter< int >( "grid-domain-decomposition-x" );
   this->domainDecomposition.y() = parameters.getParameter< int >( "grid-domain-decomposition-y" );
   return true;
}      

template< typename Real, typename Device, typename Index >
void
DistributedMesh< Grid< 2, Real, Device, Index > >::
setupGrid( GridType& grid )
{
   TNL_ASSERT_TRUE(this->isSet,"DistributedGrid is not set, but used by SetupGrid");
   grid.setOrigin( this->localOrigin );
   grid.setDimensions( this->localGridSize );
   //compute local proporions by sideefect
   grid.setSpaceSteps( this->spaceSteps );
   grid.setDistMesh(this);
};

template< typename Real, typename Device, typename Index >
String
DistributedMesh< Grid< 2, Real, Device, Index > >::
printProcessCoords() const
{
   return convertToString(this->subdomainCoordinates[0])+String("-")+convertToString(this->subdomainCoordinates[1]);
};

template< typename Real, typename Device, typename Index >
String
DistributedMesh< Grid< 2, Real, Device, Index > >::
printProcessDistr() const
{
   return convertToString(this->domainDecomposition[0])+String("-")+convertToString(this->domainDecomposition[1]);
};  


template< typename Real, typename Device, typename Index >
void
DistributedMesh< Grid< 2, Real, Device, Index > >::
writeProlog( Logger& logger ) const
{
   logger.writeParameter( "Domain decomposition:", this->getDomainDecomposition() );
};
        
      } //namespace DistributedMeshes
   } // namespace Meshes
} // namespace TNL
Loading