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

Merge branch 'develop' into euler

parents 9b72926e 5a238231
Loading
Loading
Loading
Loading
+44 −61
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ option(WITH_MIC "Build with MIC support" OFF)
option(WITH_CUDA "Build with CUDA support" ON)
set(WITH_CUDA_ARCH "auto" CACHE STRING "Build for these CUDA architectures")
option(WITH_OPENMP "Build with OpenMP support" ON)
option(WITH_GMP "Build with GMP support" OFF)
option(WITH_TESTS "Build tests" ON)
option(WITH_COVERAGE "Enable code coverage reports from unit tests" OFF)
option(WITH_EXAMPLES "Compile the 'examples' directory" ON)
@@ -68,6 +69,12 @@ set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -DNDEBUG" )
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" )
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_RELEASE "" )
set( CMAKE_EXE_LINKER_FLAGS "" )
set( CMAKE_EXE_LINKER_FLAGS_DEBUG "-rdynamic" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "" )
set( CMAKE_SHARED_LINKER_FLAGS "" )
set( CMAKE_SHARED_LINKER_FLAGS_DEBUG "-rdynamic" )
set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "" )

get_filename_component( CXX_COMPILER_NAME ${CMAKE_CXX_COMPILER} NAME )
if( CXX_COMPILER_NAME MATCHES "icpc" )
@@ -121,7 +128,7 @@ endif()
#####
# Check for CUDA
#
if( WITH_CUDA STREQUAL "yes" )
if( ${WITH_CUDA} )
    find_package( CUDA )
    if( CUDA_FOUND )
        set( BUILD_CUDA TRUE)
@@ -192,41 +199,8 @@ if( WITH_CUDA STREQUAL "yes" )
        set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; ${CUDA_ARCH} -D_FORCE_INLINES -lineinfo )
        # TODO: this is necessary only due to a bug in cmake
        set( CUDA_ADD_LIBRARY_OPTIONS -shared )

        ####
        # Check for CUSP
        #
        find_path( CUSP_INCLUDE_DIR cusp/hyb_matrix.h  
                   DOC "CUSP headers." )
        if( ${CUSP_INCLUDE_DIR} STREQUAL "CUSP_INCLUDE_DIR-NOTFOUND" )
            message( "CUSP not found." )
            set( HAVE_CUSP "//#define HAVE_CUSP 1" )
        else()      
            message( "CUSP found. -- ${CUSP_INCLUDE_DIR}" )
            set( HAVE_CUSP "#define HAVE_CUSP 1" )
            cuda_include_directories( ${CUSP_INCLUDE_DIR} )
    endif()
        
        ####
        # Check for CUSPARSE
        #
        if( NOT WITH_CUSPARSE STREQUAL "no" )
           find_path( CUSPARSE_INCLUDE_DIR cusparse.h
                      /usr/local/cuda/include                   
                      ${CUDA_INCLUDE_DIRS}  
                      DOC "CUSPARSE headers." )
           if( ${CUSPARSE_INCLUDE_DIR} STREQUAL "CUSPARSE_INCLUDE_DIR-NOTFOUND" )
               message( "CUSPARSE not found." )
               set( HAVE_CUSPARSE "//#define HAVE_CUSPARSE 1" )
           else()      
               message( "CUSPARSE found. -- ${CUSPARSE_INCLUDE_DIR}" )
               set( HAVE_CUSPARSE "#define HAVE_CUSPARSE 1" )
               cuda_include_directories( ${CUSPARSE_INCLUDE_DIR} )
               set( CUSPARSE_LIBRARY "${CUDA_cusparse_LIBRARY}" )
endif()
        endif( NOT WITH_CUSPARSE STREQUAL "no" )        
    endif( CUDA_FOUND )
endif( WITH_CUDA STREQUAL "yes" )


####
@@ -271,6 +245,7 @@ endif()
####
# Test for GMP 
#
if( ${WITH_GMP} )
   if (GMP_INCLUDES AND GMP_LIBRARIES)
      set(GMP_FIND_QUIETLY TRUE)
   endif (GMP_INCLUDES AND GMP_LIBRARIES)
@@ -296,6 +271,7 @@ else()
      set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GMP_LIBRARIES}" )
      mark_as_advanced(GMP_INCLUDES GMP_LIBRARIES)
   endif()
endif()

####
# Check for some system header
@@ -457,6 +433,7 @@ message( " WITH_MIC=${WITH_MIC}" )
message( "   WITH_CUDA=${WITH_CUDA}" )
message( "   WITH_CUDA_ARCH=${WITH_CUDA_ARCH}" )
message( "   WITH_OPENMP=${WITH_OPENMP}" )
message( "   WITH_GMP=${WITH_GMP}" )
message( "   WITH_TESTS=${WITH_TESTS}" )
message( "   WITH_COVERAGE=${WITH_COVERAGE}" )
message( "   WITH_EXAMPLES=${WITH_EXAMPLES}" )
@@ -469,5 +446,11 @@ message( " CMAKE_CXX_FLAGS_RELEASE = ${CMAKE_CXX_FLAGS_RELEASE}" )
message( "   CMAKE_SHARED_LIBRARY_LINK_C_FLAGS = ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}" )
message( "   CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG = ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG}" )
message( "   CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_RELEASE = ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_RELEASE}" )
message( "   CMAKE_EXE_LINKER_FLAGS = ${CMAKE_EXE_LINKER_FLAGS}" )
message( "   CMAKE_EXE_LINKER_FLAGS_DEBUG = ${CMAKE_EXE_LINKER_FLAGS_DEBUG}" )
message( "   CMAKE_EXE_LINKER_FLAGS_RELEASE = ${CMAKE_EXE_LINKER_FLAGS_RELEASE}" )
message( "   CMAKE_SHARED_LINKER_FLAGS = ${CMAKE_SHARED_LINKER_FLAGS}" )
message( "   CMAKE_SHARED_LINKER_FLAGS_DEBUG = ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" )
message( "   CMAKE_SHARED_LINKER_FLAGS_RELEASE = ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" )
message( "   CUDA_NVCC_FLAGS = ${CUDA_NVCC_FLAGS}" )
message( "   GMP_LIBRARIES = ${GMP_LIBRARIES}" )
+11 −0
Original line number Diff line number Diff line
@@ -18,9 +18,11 @@ WITH_MPI="yes"
WITH_CUDA="yes"
WITH_CUDA_ARCH="auto"
WITH_OPENMP="yes"
WITH_GMP="no"
WITH_TESTS="yes"
WITH_COVERAGE="no"
WITH_EXAMPLES="yes"
WITH_TOOLS="yes"

WITH_TEMPLATE_INSTANTIATION="no"
INSTANTIATE_LONG_INT="no"
@@ -50,9 +52,12 @@ do
        --with-cuda=*                    ) WITH_CUDA="${option#*=}" ;;
        --with-cuda-arch=*               ) WITH_CUDA_ARCH="${option#*=}";;
        --with-openmp=*                  ) WITH_OPENMP="${option#*=}" ;;
        --with-gmp=*                     ) WITH_GMP="${option#*=}" ;;
        --with-tests=*                   ) WITH_TESTS="${option#*=}" ;;
        --with-coverage=*                ) WITH_COVERAGE="${option#*=}" ;;
        --with-examples=*                ) WITH_EXAMPLES="${option#*=}" ;;
        --with-tools=*                   ) WITH_TOOLS="${option#*=}" ;;
        --with-python=*                  ) WITH_PYTHON="${option#*=}" ;;
        --with-templates-instantiation=* ) WITH_TEMPLATE_INSTANTIATION="${option#*=}" ;;
        --instantiate-long-int=*         ) INSTANTIATE_LONG_INT="${option#*=}" ;;
        --instantiate-int=*              ) INSTANTIATE_INT="${option#*=}" ;;
@@ -85,9 +90,12 @@ then
    echo "   --with-cuda=yes/no                    Enables CUDA. 'yes' by default (CUDA Toolkit is required)."
    echo "   --with-cuda-arch=all/auto/30/35/...   Chooses CUDA architecture. 'auto' by default."
    echo "   --with-openmp=yes/no                  Enables OpenMP. 'yes' by default."
    echo "   --with-gmp=yes/no                     Enables the wrapper for GNU Multiple Precision Arithmetic Library. 'no' by default."
    echo "   --with-tests=yes/no                   Enables unit tests. 'yes' by default."
    echo "   --with-coverage=yes/no                Enables code coverage reports for unit tests. 'no' by default (lcov is required)."
    echo "   --with-examples=yes/no                Compile the 'examples' directory. 'yes' by default."
    echo "   --with-tools=yes/no                   Compile the 'tools' directory. 'yes' by default."
    echo "   --with-python=yes/no                  Compile with the python bindings. 'yes' by default."
    echo "   --with-templates-instantiation=yes/no Precompiles some TNL templates during the build. 'no' by default."
    echo "   --cmake=CMAKE                         Path to cmake. 'cmake' by default."
    echo "   --verbose                             It enables verbose build."
@@ -129,9 +137,12 @@ ${CMAKE} ${ROOT_DIR} \
         -DWITH_CUDA=${WITH_CUDA} \
         -DWITH_CUDA_ARCH=${WITH_CUDA_ARCH} \
         -DWITH_OPENMP=${WITH_OPENMP} \
         -DWITH_GMP=${WITH_GMP} \
         -DWITH_TESTS=${WITH_TESTS} \
         -DWITH_COVERAGE=${WITH_COVERAGE} \
         -DWITH_EXAMPLES=${WITH_EXAMPLES} \
         -DWITH_TOOLS=${WITH_TOOLS} \
         -DWITH_PYTHON=${WITH_PYTHON} \
         -DDCMTK_DIR=${DCMTK_DIR} \
         -DWITH_TEMPLATE_INSTANTIATION=${WITH_TEMPLATE_INSTANTIATION} \
         -DINSTANTIATE_FLOAT=${INSTANTIATE_FLOAT} \
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ add_subdirectory( inviscid-flow-sw )
add_subdirectory( inviscid-flow-vl )
#add_subdirectory( mean-curvature-flow )
add_subdirectory( flow )
#add_subdirectory( flow-sw )
add_subdirectory( flow-sw )
add_subdirectory( flow-vl )

#add_subdirectory( mean-curvature-flow )
+4 −3
Original line number Diff line number Diff line
@@ -56,7 +56,8 @@ template< typename Real,
          typename Index,
          typename MeshType,
          typename ConfigTag,
          typename SolverStarter >
          typename SolverStarter,
          typename Communicator >
class navierStokesSetter
{
   public:
@@ -82,14 +83,14 @@ class navierStokesSetter
          if( boundaryConditionsType == "cavity" )
             {
                typedef BoundaryConditionsCavity< MeshType, Constant, Real, Index > BoundaryConditions;
                typedef navierStokesProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
                typedef navierStokesProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator, Communicator > Problem;
                SolverStarter solverStarter;
                return solverStarter.template run< Problem >( parameters );
             }
           if( boundaryConditionsType == "boiler" )
             {
                typedef BoundaryConditionsBoiler< MeshType, Constant, Real, Index > BoundaryConditions;
                typedef navierStokesProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
                typedef navierStokesProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator, Communicator > Problem;
                SolverStarter solverStarter;
                return solverStarter.template run< Problem >( parameters );
             }       
+17 −30
Original line number Diff line number Diff line
@@ -22,9 +22,11 @@ namespace TNL {
template< typename Mesh,
          typename BoundaryCondition,
          typename RightHandSide,
          typename InviscidOperators >
          typename InviscidOperators,
          typename Communicator >
class navierStokesProblem:
   public PDEProblem< Mesh,
                      Communicator,
                      typename InviscidOperators::RealType,
                      typename Mesh::DeviceType,
                      typename InviscidOperators::IndexType >
@@ -34,15 +36,12 @@ class navierStokesProblem:
      typedef typename InviscidOperators::RealType RealType;
      typedef typename Mesh::DeviceType DeviceType;
      typedef typename InviscidOperators::IndexType IndexType;
      typedef PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;
      typedef PDEProblem< Mesh, Communicator, RealType, DeviceType, IndexType > BaseType;
      
      using typename BaseType::MeshType;
      using typename BaseType::MeshPointer;
      using typename BaseType::DofVectorType;
      using typename BaseType::DofVectorPointer;
      using typename BaseType::MeshDependentDataType;
      using typename BaseType::MeshDependentDataPointer;

      static const int Dimensions = Mesh::getMeshDimension();      

      typedef Functions::MeshFunction< Mesh > MeshFunctionType;
@@ -54,6 +53,7 @@ class navierStokesProblem:
      typedef SharedPointer< InviscidOperators > InviscidOperatorsPointer;
      typedef SharedPointer< BoundaryCondition > BoundaryConditionPointer;
      typedef SharedPointer< RightHandSide, DeviceType > RightHandSidePointer;
      using CommunicatorType = Communicator;
      
      static String getTypeStatic();

@@ -62,51 +62,38 @@ class navierStokesProblem:
      void writeProlog( Logger& logger,
                        const Config::ParameterContainer& parameters ) const;

      bool setup( const MeshPointer& meshPointer,
                  const Config::ParameterContainer& parameters,
      bool setup( const Config::ParameterContainer& parameters,
                  const String& prefix = "" );

      bool setInitialCondition( const Config::ParameterContainer& parameters,
                                const MeshPointer& mesh,
                                DofVectorPointer& dofs,
                                MeshDependentDataPointer& meshDependentData );
                                DofVectorPointer& dofs );

      template< typename Matrix >
      bool setupLinearSystem( const MeshPointer& mesh,
                              Matrix& matrix );
      bool setupLinearSystem( Matrix& matrix );

      bool makeSnapshot( const RealType& time,
                         const IndexType& step,
                         const MeshPointer& mesh,
                         DofVectorPointer& dofs,
                         MeshDependentDataPointer& meshDependentData );
                         DofVectorPointer& dofs );

      IndexType getDofs( const MeshPointer& mesh ) const;
      IndexType getDofs() const;

      void bindDofs( const MeshPointer& mesh,
                     DofVectorPointer& dofs );
      void bindDofs( DofVectorPointer& dofs );

      void getExplicitUpdate( const RealType& time,
                              const RealType& tau,
                           const MeshPointer& mesh,
                              DofVectorPointer& _u,
                           DofVectorPointer& _fu,
                           MeshDependentDataPointer& meshDependentData );
                              DofVectorPointer& _fu );

      template< typename Matrix >
      void assemblyLinearSystem( const RealType& time,
                                 const RealType& tau,
                                 const MeshPointer& mesh,
                                 DofVectorPointer& dofs,
                                 Matrix& matrix,
                                 DofVectorPointer& rightHandSide,
                                 MeshDependentDataPointer& meshDependentData );
                                 DofVectorPointer& rightHandSide );

      bool postIterate( const RealType& time,
                        const RealType& tau,
                        const MeshPointer& mesh,
                        DofVectorPointer& dofs,
                        MeshDependentDataPointer& meshDependentData );
                        DofVectorPointer& dofs );

   protected:

Loading