Loading CMakeLists.txt +8 −7 Original line number Diff line number Diff line Loading @@ -61,7 +61,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" ) set( CMAKE_CXX_FLAGS_DEBUG "-g -rdynamic -ftemplate-backtrace-limit=0" ) 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 Loading Loading @@ -164,7 +164,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 --compiler-bindir ${CUDA_HOST_COMPILER} ${CUDA_ARCH_SOURCE} -o ${CUDA_ARCH_EXECUTABLE} execute_process( COMMAND nvcc --compiler-bindir ${CUDA_HOST_COMPILER} --std=c++11 ${CUDA_ARCH_SOURCE} -o ${CUDA_ARCH_EXECUTABLE} RESULT_VARIABLE CUDA_ARCH_RESULT OUTPUT_VARIABLE CUDA_ARCH_OUTPUT ERROR_VARIABLE CUDA_ARCH_OUTPUT ) Loading @@ -189,7 +189,7 @@ if( WITH_CUDA STREQUAL "yes" ) endif() endif() endif() set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; ${CUDA_ARCH} -D_FORCE_INLINES ) 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 ) Loading Loading @@ -415,11 +415,12 @@ LINK_DIRECTORIES( ${LIBRARY_OUTPUT_PATH} ) #Pokracujeme dalsimi podadresari add_subdirectory( src ) add_subdirectory( share ) if( WITH_TESTS STREQUAL "yes" ) add_subdirectory( tests ) if( ${WITH_EXAMPLES} ) endif( WITH_TESTS STREQUAL "yes" ) if( WITH_EXAMPLES STREQUAL "yes" ) add_subdirectory( examples ) endif() endif( WITH_EXAMPLES STREQUAL "yes" ) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Template Numerical Library") set(CPACK_PACKAGE_VENDOR "MMG") Loading build +24 −6 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ VERBOSE="" OFFLINE_BUILD="no" WITH_CLANG="no" WITH_MPI="yes" WITH_CUDA="yes" WITH_CUDA_ARCH="auto" WITH_OPENMP="yes" Loading Loading @@ -44,6 +45,7 @@ do --offline-build ) OFFLINE_BUILD="yes" ;; --help ) HELP="yes" ;; --with-clang=* ) WITH_CLANG="${option#*=}" ;; --with-mpi=* ) WITH_MPI="${option#*=}" ;; --with-mic=* ) WITH_MIC="${option#*=}" ;; --with-cuda=* ) WITH_CUDA="${option#*=}" ;; --with-cuda-arch=* ) WITH_CUDA_ARCH="${option#*=}";; Loading Loading @@ -78,12 +80,13 @@ then echo " --build-jobs=NUM Number of processes to be used for the build. It is set to the number of available CPU cores by default." echo " --prefix=PATH Prefix for the installation directory. ${HOME}/local by default." echo " --install=yes/no Enables the installation of TNL files." echo " --with-mic=yes/no Enable MIC (Intel Xeon Phi). 'no' by default (Intel Compiler required)." echo " --with-cuda=yes/no Enable CUDA. 'yes' by default (CUDA Toolkit is required)." echo " --with-cuda-arch=all/auto/30/35/... Choose CUDA architecture. 'auto' by default." echo " --with-openmp=yes/no Enable OpenMP. 'yes' by default." echo " --with-tests=yes/no Enable unit tests. 'yes' by default." echo " --with-coverage=yes/no Enable code coverage reports for unit tests. 'no' by default (lcov is required)." echo " --with-mpi=yes/no Enables MPI. 'no' by default (Intel Compiler required)." echo " --with-mic=yes/no Enables MIC (Intel Xeon Phi). 'no' by default (Intel Compiler required)." 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-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-templates-instantiation=yes/no Precompiles some TNL templates during the build. 'no' by default." echo " --cmake=CMAKE Path to cmake. 'cmake' by default." Loading @@ -100,6 +103,21 @@ then export CC=clang fi if test ${WITH_MPI} = "yes"; then if ! [ -x "$(command -v mpic++)" ]; then echo "Warning:mpic++ is not installed on this system. MPI support is turned off." else export CXX=mpic++ export CUDA_HOST_COMPILER=mpic++ fi if ! [ -x "$(command -v mpicc)" ]; then echo "Warning: mpicc is not installed on this system." else export CC=mpicc fi fi echo "Configuring ${BUILD} $TARGET ..." Loading examples/heat-equation/HeatEquationBuildConfigTag.h +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ template<> struct ConfigTagReal< HeatEquationBuildConfigTag, long double > { enu * Turn off support for short int and long int indexing. */ template<> struct ConfigTagIndex< HeatEquationBuildConfigTag, short int >{ enum { enabled = false }; }; template<> struct ConfigTagIndex< HeatEquationBuildConfigTag, long int >{ enum { enabled = false }; }; template<> struct ConfigTagIndex< HeatEquationBuildConfigTag, long int >{ enum { enabled = true }; }; /**** * Please, chose your preferred time discretization here. Loading examples/heat-equation/tnl-heat-equation-eoc.h +6 −6 Original line number Diff line number Diff line Loading @@ -8,8 +8,9 @@ /* See Copyright Notice in tnl/Copyright */ #ifndef TNL_HEAT_EQUATION_EOC_H_ #define TNL_HEAT_EQUATION_EOC_H_ #pragma once #define MPIIO #include <TNL/Solvers/Solver.h> #include <TNL/Solvers/FastBuildConfigTag.h> Loading Loading @@ -44,7 +45,8 @@ template< typename Real, typename Index, typename MeshType, typename MeshConfig, typename SolverStarter > typename SolverStarter, typename CommunicatorType > class heatEquationSetter { public: Loading @@ -64,7 +66,7 @@ class heatEquationSetter typedef HeatEquationEocRhs< ExactOperator, TestFunction > RightHandSide; typedef Containers::StaticVector < MeshType::getMeshDimension(), Real > Point; typedef Operators::DirichletBoundaryConditions< MeshType, TestFunction, Dimension, Real, Index > BoundaryConditions; typedef HeatEquationEocProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver; typedef HeatEquationEocProblem< MeshType, BoundaryConditions, RightHandSide, CommunicatorType, ApproximateOperator > Solver; SolverStarter solverStarter; return solverStarter.template run< Solver >( parameters ); }; Loading @@ -77,5 +79,3 @@ int main( int argc, char* argv[] ) return EXIT_FAILURE; return EXIT_SUCCESS; } #endif /* TNL_HEAT_EQUATION_EOC_H_ */ examples/heat-equation/tnl-heat-equation.h +12 −9 Original line number Diff line number Diff line Loading @@ -8,8 +8,9 @@ /* See Copyright Notice in tnl/Copyright */ #ifndef TNL_HEAT_EQUATION_H_ #define TNL_HEAT_EQUATION_H_ #pragma once #define MPIIO #include <TNL/Solvers/Solver.h> #include <TNL/Solvers/FastBuildConfigTag.h> Loading Loading @@ -48,6 +49,9 @@ class heatEquationConfig config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." ); config.addEntry< double >( "right-hand-side-constant", "This sets a constant value for the right-hand side.", 0.0 ); config.addEntry< String >( "initial-condition", "File with the initial condition.", "initial.tnl"); config.addEntry< String >( "distributed-grid-io-type", "Choose Distributed Grid IO Type", "LocalCopy"); config.addEntryEnum< String >( "LocalCopy" ); config.addEntryEnum< String >( "MpiIO" ); }; }; Loading @@ -56,7 +60,8 @@ template< typename Real, typename Index, typename MeshType, typename MeshConfig, typename SolverStarter > typename SolverStarter, typename CommunicatorType > class heatEquationSetter { public: Loading @@ -78,12 +83,12 @@ class heatEquationSetter if( boundaryConditionsType == "dirichlet" ) { typedef Operators::DirichletBoundaryConditions< MeshType, Constant > BoundaryConditions; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide,CommunicatorType, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); } typedef Operators::NeumannBoundaryConditions< MeshType, Constant, Real, Index > BoundaryConditions; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, CommunicatorType, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); } Loading @@ -91,12 +96,12 @@ class heatEquationSetter if( boundaryConditionsType == "dirichlet" ) { typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction > BoundaryConditions; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide,CommunicatorType, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); } typedef Operators::NeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide,CommunicatorType, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); }; Loading @@ -108,5 +113,3 @@ int main( int argc, char* argv[] ) return EXIT_FAILURE; return EXIT_SUCCESS; } #endif /* TNL_HEAT_EQUATION_H_ */ Loading
CMakeLists.txt +8 −7 Original line number Diff line number Diff line Loading @@ -61,7 +61,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" ) set( CMAKE_CXX_FLAGS_DEBUG "-g -rdynamic -ftemplate-backtrace-limit=0" ) 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 Loading Loading @@ -164,7 +164,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 --compiler-bindir ${CUDA_HOST_COMPILER} ${CUDA_ARCH_SOURCE} -o ${CUDA_ARCH_EXECUTABLE} execute_process( COMMAND nvcc --compiler-bindir ${CUDA_HOST_COMPILER} --std=c++11 ${CUDA_ARCH_SOURCE} -o ${CUDA_ARCH_EXECUTABLE} RESULT_VARIABLE CUDA_ARCH_RESULT OUTPUT_VARIABLE CUDA_ARCH_OUTPUT ERROR_VARIABLE CUDA_ARCH_OUTPUT ) Loading @@ -189,7 +189,7 @@ if( WITH_CUDA STREQUAL "yes" ) endif() endif() endif() set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; ${CUDA_ARCH} -D_FORCE_INLINES ) 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 ) Loading Loading @@ -415,11 +415,12 @@ LINK_DIRECTORIES( ${LIBRARY_OUTPUT_PATH} ) #Pokracujeme dalsimi podadresari add_subdirectory( src ) add_subdirectory( share ) if( WITH_TESTS STREQUAL "yes" ) add_subdirectory( tests ) if( ${WITH_EXAMPLES} ) endif( WITH_TESTS STREQUAL "yes" ) if( WITH_EXAMPLES STREQUAL "yes" ) add_subdirectory( examples ) endif() endif( WITH_EXAMPLES STREQUAL "yes" ) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Template Numerical Library") set(CPACK_PACKAGE_VENDOR "MMG") Loading
build +24 −6 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ VERBOSE="" OFFLINE_BUILD="no" WITH_CLANG="no" WITH_MPI="yes" WITH_CUDA="yes" WITH_CUDA_ARCH="auto" WITH_OPENMP="yes" Loading Loading @@ -44,6 +45,7 @@ do --offline-build ) OFFLINE_BUILD="yes" ;; --help ) HELP="yes" ;; --with-clang=* ) WITH_CLANG="${option#*=}" ;; --with-mpi=* ) WITH_MPI="${option#*=}" ;; --with-mic=* ) WITH_MIC="${option#*=}" ;; --with-cuda=* ) WITH_CUDA="${option#*=}" ;; --with-cuda-arch=* ) WITH_CUDA_ARCH="${option#*=}";; Loading Loading @@ -78,12 +80,13 @@ then echo " --build-jobs=NUM Number of processes to be used for the build. It is set to the number of available CPU cores by default." echo " --prefix=PATH Prefix for the installation directory. ${HOME}/local by default." echo " --install=yes/no Enables the installation of TNL files." echo " --with-mic=yes/no Enable MIC (Intel Xeon Phi). 'no' by default (Intel Compiler required)." echo " --with-cuda=yes/no Enable CUDA. 'yes' by default (CUDA Toolkit is required)." echo " --with-cuda-arch=all/auto/30/35/... Choose CUDA architecture. 'auto' by default." echo " --with-openmp=yes/no Enable OpenMP. 'yes' by default." echo " --with-tests=yes/no Enable unit tests. 'yes' by default." echo " --with-coverage=yes/no Enable code coverage reports for unit tests. 'no' by default (lcov is required)." echo " --with-mpi=yes/no Enables MPI. 'no' by default (Intel Compiler required)." echo " --with-mic=yes/no Enables MIC (Intel Xeon Phi). 'no' by default (Intel Compiler required)." 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-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-templates-instantiation=yes/no Precompiles some TNL templates during the build. 'no' by default." echo " --cmake=CMAKE Path to cmake. 'cmake' by default." Loading @@ -100,6 +103,21 @@ then export CC=clang fi if test ${WITH_MPI} = "yes"; then if ! [ -x "$(command -v mpic++)" ]; then echo "Warning:mpic++ is not installed on this system. MPI support is turned off." else export CXX=mpic++ export CUDA_HOST_COMPILER=mpic++ fi if ! [ -x "$(command -v mpicc)" ]; then echo "Warning: mpicc is not installed on this system." else export CC=mpicc fi fi echo "Configuring ${BUILD} $TARGET ..." Loading
examples/heat-equation/HeatEquationBuildConfigTag.h +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ template<> struct ConfigTagReal< HeatEquationBuildConfigTag, long double > { enu * Turn off support for short int and long int indexing. */ template<> struct ConfigTagIndex< HeatEquationBuildConfigTag, short int >{ enum { enabled = false }; }; template<> struct ConfigTagIndex< HeatEquationBuildConfigTag, long int >{ enum { enabled = false }; }; template<> struct ConfigTagIndex< HeatEquationBuildConfigTag, long int >{ enum { enabled = true }; }; /**** * Please, chose your preferred time discretization here. Loading
examples/heat-equation/tnl-heat-equation-eoc.h +6 −6 Original line number Diff line number Diff line Loading @@ -8,8 +8,9 @@ /* See Copyright Notice in tnl/Copyright */ #ifndef TNL_HEAT_EQUATION_EOC_H_ #define TNL_HEAT_EQUATION_EOC_H_ #pragma once #define MPIIO #include <TNL/Solvers/Solver.h> #include <TNL/Solvers/FastBuildConfigTag.h> Loading Loading @@ -44,7 +45,8 @@ template< typename Real, typename Index, typename MeshType, typename MeshConfig, typename SolverStarter > typename SolverStarter, typename CommunicatorType > class heatEquationSetter { public: Loading @@ -64,7 +66,7 @@ class heatEquationSetter typedef HeatEquationEocRhs< ExactOperator, TestFunction > RightHandSide; typedef Containers::StaticVector < MeshType::getMeshDimension(), Real > Point; typedef Operators::DirichletBoundaryConditions< MeshType, TestFunction, Dimension, Real, Index > BoundaryConditions; typedef HeatEquationEocProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver; typedef HeatEquationEocProblem< MeshType, BoundaryConditions, RightHandSide, CommunicatorType, ApproximateOperator > Solver; SolverStarter solverStarter; return solverStarter.template run< Solver >( parameters ); }; Loading @@ -77,5 +79,3 @@ int main( int argc, char* argv[] ) return EXIT_FAILURE; return EXIT_SUCCESS; } #endif /* TNL_HEAT_EQUATION_EOC_H_ */
examples/heat-equation/tnl-heat-equation.h +12 −9 Original line number Diff line number Diff line Loading @@ -8,8 +8,9 @@ /* See Copyright Notice in tnl/Copyright */ #ifndef TNL_HEAT_EQUATION_H_ #define TNL_HEAT_EQUATION_H_ #pragma once #define MPIIO #include <TNL/Solvers/Solver.h> #include <TNL/Solvers/FastBuildConfigTag.h> Loading Loading @@ -48,6 +49,9 @@ class heatEquationConfig config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." ); config.addEntry< double >( "right-hand-side-constant", "This sets a constant value for the right-hand side.", 0.0 ); config.addEntry< String >( "initial-condition", "File with the initial condition.", "initial.tnl"); config.addEntry< String >( "distributed-grid-io-type", "Choose Distributed Grid IO Type", "LocalCopy"); config.addEntryEnum< String >( "LocalCopy" ); config.addEntryEnum< String >( "MpiIO" ); }; }; Loading @@ -56,7 +60,8 @@ template< typename Real, typename Index, typename MeshType, typename MeshConfig, typename SolverStarter > typename SolverStarter, typename CommunicatorType > class heatEquationSetter { public: Loading @@ -78,12 +83,12 @@ class heatEquationSetter if( boundaryConditionsType == "dirichlet" ) { typedef Operators::DirichletBoundaryConditions< MeshType, Constant > BoundaryConditions; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide,CommunicatorType, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); } typedef Operators::NeumannBoundaryConditions< MeshType, Constant, Real, Index > BoundaryConditions; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, CommunicatorType, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); } Loading @@ -91,12 +96,12 @@ class heatEquationSetter if( boundaryConditionsType == "dirichlet" ) { typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction > BoundaryConditions; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide,CommunicatorType, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); } typedef Operators::NeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; typedef HeatEquationProblem< MeshType, BoundaryConditions, RightHandSide,CommunicatorType, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); }; Loading @@ -108,5 +113,3 @@ int main( int argc, char* argv[] ) return EXIT_FAILURE; return EXIT_SUCCESS; } #endif /* TNL_HEAT_EQUATION_H_ */