Commit 5356affc authored by Jan Schäfer's avatar Jan Schäfer
Browse files

Merge branch 'euler' of geraldine.fjfi.cvut.cz:/local/projects/tnl/tnl into euler

Conflicts:
	examples/advection/tnl-run-advection
	examples/inviscid-flow/1d/tnl-run-euler-1d
parents 4ec0060c 818e73a1
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
Oberhuber Tomas <tomas.oberhuber@fjfi.cvut.cz>
Zabka Vitezslav <zabkavit@fjfi.cvut.cz>
Vladimir Klement
Tomáš Sobotík
Ondřej Székely
Jiří Kafka
Zabka Vitezslav <zabkav@gmail.com>
Vladimir Klement <wlada@post.cz>
Tomáš Sobotík <sobotik.tomas@gmail.com>
Ondřej Székely <ondra.szekely@gmail.com>
Libor Bakajsa
Jakub Klinkovský
Jakub Klinkovský <klinkjak@fjfi.cvut.cz>
Vacata Jan
Heller Martin
Novotny Matej

CMakeLists.txt

100755 → 100644
+49 −32
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
# Vladimir Klement
# Jakub Klinkovsky

cmake_minimum_required( VERSION 3.4 )
cmake_minimum_required( VERSION 3.5.1 )

project( tnl )

@@ -21,31 +21,28 @@ set( tnlVersion "0.1" )
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

include( OptimizeForArchitecture )
include( UseCodeCoverage )

####
# Settings for debug/release version
#
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
    set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Debug/src/TNL )
    set( PROJECT_TESTS_PATH ${PROJECT_SOURCE_DIR}/Debug/src/Tests )
    set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Debug/src )
    set( PROJECT_TOOLS_PATH ${PROJECT_SOURCE_DIR}/Debug/bin )
    set( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/lib )
    set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/bin )
    set( debugExt -dbg )
else()
    set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Release/src/TNL )
    set( PROJECT_TESTS_PATH ${PROJECT_SOURCE_DIR}/Release/src/Tests )
    set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Release/src )
    set( PROJECT_TOOLS_PATH ${PROJECT_SOURCE_DIR}/Release/bin )
    set( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/lib )
    set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/bin )
endif()

# set Debug/Release options
set( CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unused-local-typedefs -Wno-unused-variable" )
set( CMAKE_CXX_FLAGS "-std=c++11 -pthread -Wall -Wno-unused-local-typedefs -Wno-unused-variable" )
set( CMAKE_CXX_FLAGS_DEBUG "-g" )
set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG" )
#set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG -ftree-vectorizer-verbose=1 -ftree-vectorize -fopt-info-vec-missed -funroll-loops" )
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
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" )
@@ -54,7 +51,19 @@ set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_RELEASE "" )
get_filename_component( CXX_COMPILER_NAME ${CMAKE_CXX_COMPILER} NAME )
if( CXX_COMPILER_NAME MATCHES "icpc" )
   message( "Intel compiler detected..."    )
   set( CMAKE_CXX_FLAGS "${CXXFLAGS} -DHAVE_ICPC ")
   set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_ICPC -wd2568 -wd2571 -wd2570")
   #####
   #  Ckeck for MIC 
   #
   if( WITH_MIC STREQUAL "yes" )
       message( "Compile MIC support..."    )
       set( MIC_CXX_FLAGS "-DHAVE_MIC")
       # build all tests with MIC support
       set( CXX_TESTS_FLAGS ${CXX_TESTS_FLAGS} -DHAVE_MIC )
       set( WITH_CUDA "no")
   else()
       set( MIC_CXX_FLAGS "")
   endif( )	
endif()

#####
@@ -67,12 +76,19 @@ if( WITH_CUDA STREQUAL "yes" )
        set(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE OFF)
        set(BUILD_SHARED_LIBS ON)
        set(CUDA_SEPARABLE_COMPILATION ON)        
        # Use the CUDA_HOST_COMPILER environment variable if the user specified it.
        if( NOT $ENV{CUDA_HOST_COMPILER} STREQUAL "" )
            message( "-- Setting CUDA_HOST_COMPILER to '$ENV{CUDA_HOST_COMPILER}'" )
            set( CUDA_HOST_COMPILER $ENV{CUDA_HOST_COMPILER} )
        else()
            message( "-- Setting CUDA_HOST_COMPILER to '${CMAKE_CXX_COMPILER}'" )
            set( CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} )
        endif()
        set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ;-DHAVE_CUDA)
        # disable false compiler warnings
        #   reference for the -Xcudafe flag: http://stackoverflow.com/questions/14831051/how-to-disable-compiler-warnings-with-nvcc/17095910#17095910
        #   list of possible tokens: http://www.ssl.berkeley.edu/~jimm/grizzly_docs/SSL/opt/intel/cc/9.0/lib/locale/en_US/mcpcom.msg
        set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -Wno-deprecated-gpu-targets --expt-relaxed-constexpr -Xcudafe "\"--diag_suppress=code_is_unreachable --diag_suppress=implicit_return_from_non_void_function\"")
        #AddCompilerFlag( "-DHAVE_NOT_CXX11" ) # -U_GLIBCXX_ATOMIC_BUILTINS -U_GLIBCXX_USE_INT128 " )
        set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -Wno-deprecated-gpu-targets --expt-relaxed-constexpr --expt-extended-lambda -Xcudafe "\"--diag_suppress=code_is_unreachable --diag_suppress=implicit_return_from_non_void_function\"")
        set( ALL_CUDA_ARCHS -gencode arch=compute_20,code=sm_20
                            -gencode arch=compute_30,code=sm_30
                            -gencode arch=compute_32,code=sm_32 
@@ -91,7 +107,7 @@ if( WITH_CUDA STREQUAL "yes" )
                set( CUDA_ARCH_SOURCE ${PROJECT_SOURCE_DIR}/src/Tools/tnl-cuda-arch.cu)
                message( "Compiling tnl-cuda-arch ..." )
                file( MAKE_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} )
                execute_process( COMMAND nvcc ${CUDA_ARCH_SOURCE} -o ${CUDA_ARCH_EXECUTABLE}
                execute_process( COMMAND nvcc --compiler-bindir ${CUDA_HOST_COMPILER} ${CUDA_ARCH_SOURCE} -o ${CUDA_ARCH_EXECUTABLE}
                                 RESULT_VARIABLE CUDA_ARCH_RESULT
                                 OUTPUT_VARIABLE CUDA_ARCH_OUTPUT
                                 ERROR_VARIABLE CUDA_ARCH_OUTPUT )
@@ -115,9 +131,6 @@ if( WITH_CUDA STREQUAL "yes" )
        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 )
        # TODO: workaround for a bug in cmake 3.5.0 (fixed in 3.5.1)
        set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; -ccbin "${CMAKE_CXX_COMPILER}" )
        set( CUDA_HOST_COMPILER "" )

        ####
        # Check for cuBLAS
@@ -171,6 +184,7 @@ if( WITH_CUDA STREQUAL "yes" )
    endif( CUDA_FOUND )
endif( WITH_CUDA STREQUAL "yes" )


####
# Check for OpenMP
#
@@ -233,7 +247,7 @@ if( ${SYS_TIME_INCLUDE_DIR} STREQUAL "SYS_TIME_INCLUDE_DIR-NOTFOUND" )
    message(  "Missing header file sys/time.h" )
    set( HAVE_SYS_TIME_H "//#define HAVE_SYS_TIME_H 1" )
else()
    include_directories( ${SYS_TIME_INCLUDE_DIR}/tnl-${tnlVersion} )
    #include_directories( ${SYS_TIME_INCLUDE_DIR} )
    set( HAVE_SYS_TIME_H "#define HAVE_SYS_TIME_H 1" )
endif()

@@ -245,7 +259,7 @@ if( ${SYS_RESOURCE_INCLUDE_DIR} STREQUAL "SYS_RESOURCE_INCLUDE_DIR-NOTFOUND" )
    message( "Missing header file sys/time.h" )
    set( HAVE_SYS_RESOURCE_H "//#define HAVE_SYS_RESOURCE_H 1" )
else()
    include_directories( ${SYS_RESOURCE_INCLUDE_DIR}/tnl-${tnlVersion} )
    #include_directories( ${SYS_RESOURCE_INCLUDE_DIR} )
    set( HAVE_SYS_RESOURCE_H "#define HAVE_SYS_RESOURCE_H 1" )
endif()

@@ -257,15 +271,20 @@ if( ${SYS_IOCTL_INCLUDE_DIR} STREQUAL "SYS_IOCTL_INCLUDE_DIR-NOTFOUND" )
    message( "Missing header file sys/time.h" )
    set( HAVE_SYS_IOCTL_H "//#define HAVE_SYS_IOCTL_H 1" )
else()
    include_directories( ${SYS_IOCTL_INCLUDE_DIR}/tnl-${tnlVersion} )
    #include_directories( ${SYS_IOCTL_INCLUDE_DIR} )
    set( HAVE_SYS_IOCTL_H "#define HAVE_SYS_IOCTL_H 1" )
endif()

if( WITH_TESTS STREQUAL "yes" )
   find_package( GTest )
   if( GTEST_FOUND )
      set( CXX_TESTS_FLAGS "-DHAVE_GTEST" )
   endif( GTEST_FOUND )
   enable_testing()

   # build gtest libs
   include( BuildGtest )

   if( WITH_COVERAGE STREQUAL "yes" AND CMAKE_BUILD_TYPE STREQUAL "Debug" )
      # enable code coverage reports
      include( UseCodeCoverage )
   endif()
endif( WITH_TESTS STREQUAL "yes" )

find_package( PythonInterp 3 )
@@ -326,9 +345,6 @@ if( OPTIMIZED_VECTOR_HOST_OPERATIONS STREQUAL "yes" )
   AddCompilerFlag( "-DOPTIMIZED_VECTOR_HOST_OPERATIONS " )
endif()

set( CXX_TEST_FLAGS "-fprofile-arcs -ftest-coverage" )
set( LD_TEST_FLAGS "-lgcov -coverage" )

set( configDirectory \"${CMAKE_INSTALL_PREFIX}/share/tnl-${tnlVersion}/\")
set( sourceDirectory \"${PROJECT_SOURCE_DIR}/\" )
set( testsDirectory \"${PROJECT_TESTS_PATH}/\" )
@@ -336,13 +352,11 @@ CONFIGURE_FILE( "tnlConfig.h.in" "${PROJECT_BUILD_PATH}/TNL/tnlConfig.h" )
INSTALL( FILES ${PROJECT_BUILD_PATH}/TNL/tnlConfig.h DESTINATION include/tnl-${tnlVersion}/TNL )
if( PYTHONINTERP_FOUND )
    CONFIGURE_FILE( "Config.py.in" "${PROJECT_BUILD_PATH}/TNL/Config.py" )
    INSTALL( FILES ${PROJECT_BUILD_PATH}/TNL/Config.py DESTINATION lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/TNL )
    CONFIGURE_FILE( "python-version.in" "${PROJECT_TOOLS_PATH}/../python-version" )
    INSTALL( FILES ${PROJECT_BUILD_PATH}/TNL/Config.py DESTINATION lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/TNL )
endif( PYTHONINTERP_FOUND )

#Nastavime cesty k hlavickovym souborum a knihovnam
INCLUDE_DIRECTORIES( src )
INCLUDE_DIRECTORIES( tests )
INCLUDE_DIRECTORIES( ${PROJECT_BUILD_PATH} )
LINK_DIRECTORIES( ${LIBRARY_OUTPUT_PATH} )

@@ -350,7 +364,10 @@ LINK_DIRECTORIES( ${LIBRARY_OUTPUT_PATH} )
add_subdirectory( src )
add_subdirectory( share )
add_subdirectory( tests )

if( WITH_EXAMPLES STREQUAL "yes" )
   add_subdirectory( examples )
endif()

set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Template Numerical Library")
set(CPACK_PACKAGE_VENDOR "MMG")
+1 −1
Original line number Diff line number Diff line
MIT License

Copyright (c) 2004-2016 Tomáš Oberhuber et al.
Copyright (c) 2004-2017 Tomáš Oberhuber et al.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+0 −1
Original line number Diff line number Diff line
/usr/local/share/automake-1.11/INSTALL
 No newline at end of file
+80 −0
Original line number Diff line number Diff line
Installation
============

    Requirements:

    To install TNL, you need:

    cmake 3.4 or later (https://cmake.org/download/)
    GNU g++ 4.8 or later (https://gcc.gnu.org/)
    CUDA 8.0 or later (https://developer.nvidia.com/cuda-downloads)

    For image processing problems, you may optionally install:
    DCMTK (http://dicom.offis.de/dcmtk.php.en)
    libpng (http://www.libpng.org/pub/png/libpng.html)
    libjpeg (http://libjpeg.sourceforge.net/)

    The latest release of TNL can be downloaded as:

    wget tnl-project.org/data/src/tnl-0.1.tar.bz2

    Unpack it as:

    tar xvf tnl-0.1.tar.bz2
    cd tnl-0.1

    Executing command

    ./install

    will install TNL to a folder ${HOME}/.local . You may change it by

    ./install --prefix=<TNL prefix>

    During the installation, TNL fetches latest version of Gtest and install it only 
    locally to sub-folders Debug and Release. At the end of the installation, the
    script is checking if the prefix folder is visible to your bash and your linker.
    If not, it informs you how to change your ${HOME}/.bashrc file to fix it.

How to write a simple solver
============================

To implement your own solver:

    Create and go to your working directory

    mkdir MyProblem
    cd Myproblem

    Execute a command tnl-quickstart

    tnl-quickstart

    Answer the questions as, for example, follows

    TNL Quickstart -- solver generator
    ----------------------------------
    Problem name:My Problem
    Problem class base name (base name acceptable in C++ code):MyProblem
    Operator name:Laplace

    Write your numerical scheme by editing a file

    Laplace_impl.h

    on lines:
        34, 141 and 265 for 1D, 2D and 3D problem respectively with explicit time discretization
        101, 211 and 332 for 1D, 2D and 3D problem respectively with (semi-)implicit time discretization
    Compile the program by executing

    make

    for CPU version only or 
   
    make WITH_CUDA=yes

    for a solver running on both CPU and GPU. Run it on your favourite HW architecture by executing

    ./MyProblem

    and following the printed help.
Loading