Loading CMakeLists.txt +40 −32 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ # Vladimir Klement # Jakub Klinkovsky cmake_minimum_required( VERSION 3.2.0 ) cmake_minimum_required( VERSION 3.0 ) project( tnl ) Loading @@ -34,21 +34,26 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug") set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/bin ) set( debugExt -dbg ) set( CMAKE_CXX_FLAGS "${CXXFLAGS} -g ") #AddCompilerFlag( "-g" ) else() set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Release/src ) set( PROJECT_TESTS_PATH ${PROJECT_SOURCE_DIR}/Release/tests ) set( PROJECT_TOOLS_PATH ${PROJECT_SOURCE_DIR}/Release/tools ) set( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/lib) set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/bin) #OptimizeForArchitecture() AddCompilerFlag( "-O3 -march=native -DNDEBUG -g" ) endif() # set Debug/Release options set( CMAKE_CXX_FLAGS "-std=c++11" ) set( CMAKE_CXX_FLAGS_DEBUG "-g" ) set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG -g" ) # pass -rdynamic only in Debug mode set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" ) set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" ) 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..." ) AddCompilerFlag( "-DHAVE_ICPC" ) set( CMAKE_CXX_FLAGS "${CXXFLAGS} -DHAVE_ICPC ") endif() ##### Loading Loading @@ -102,9 +107,9 @@ if( WITH_CUDA STREQUAL "yes" ) set( CUDA_ARCH -gencode arch=compute_${WITH_CUDA_ARCH},code=sm_${WITH_CUDA_ARCH} ) endif() endif() set( CUDA_ADD_EXECUTABLE_OPTIONS ${CUDA_ARCH} ) set( CUDA_ADD_LIBRARY_OPTIONS ${CUDA_ARCH} -shared ) set( CUDA_LINKER_OPTIONS "-arch sm_20 -shared" ) set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; ${CUDA_ARCH} ) # TODO: this is necessary only due to a bug in cmake set( CUDA_ADD_LIBRARY_OPTIONS -shared ) #### # Check for cuBLAS Loading Loading @@ -148,15 +153,8 @@ if( WITH_CUDA STREQUAL "yes" ) set( CUSPARSE_LIBRARY "${CUDA_cusparse_LIBRARY}" ) endif() endif( NOT WITH_CUSPARSE STREQUAL "no" ) #else( CUDA_FOUND ) # AddCompilerFlag( "-std=c++11" ) endif( CUDA_FOUND ) #else( WITH_CUDA STREQUAL "yes" ) #AddCompilerFlag( "-std=gnu++0x -ftree-vectorizer-verbose=1" ) #AddCompilerFlag( "-std=c++11" ) endif( WITH_CUDA STREQUAL "yes" ) AddCompilerFlag( "-std=c++11" ) #### # Check for OpenMP Loading @@ -164,7 +162,7 @@ AddCompilerFlag( "-std=c++11" ) find_package( OpenMP ) if( OPENMP_FOUND ) message( "Compiler supports OpenMP." ) #set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_OPENMP -fopenmp") set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_OPENMP -fopenmp" ) endif() #### Loading Loading @@ -318,7 +316,6 @@ endif( WITH_TESTS STREQUAL "yes" ) # if( WITH_TEMPLATE_INSTANTIATION STREQUAL "yes" ) AddCompilerFlag( "-DTEMPLATE_EXPLICIT_INSTANTIATION " ) endif() if( INSTANTIATE_INT STREQUAL "yes" ) AddCompilerFlag( "-DINSTANTIATE_INT " ) Loading @@ -339,6 +336,7 @@ endif() if( INSTANTIATE_LONG_DOUBLE STREQUAL "yes" ) AddCompilerFlag( "-DINSTANTIATE_LONG_DOUBLE " ) endif() endif() set( CXX_TEST_FLAGS "-fprofile-arcs -ftest-coverage" ) set( LD_TEST_FLAGS "-lgcov -coverage" ) Loading Loading @@ -388,3 +386,13 @@ set(CPACK_SOURCE_STRIP_FILES "Release") #set(CPACK_PACKAGE_EXECUTABLES "MyExecutable" "My Executable") INCLUDE( CPack ) # Print compiler options message( "-- Compiler options:" ) message( " CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}" ) message( " CMAKE_CXX_FLAGS_DEBUG = ${CMAKE_CXX_FLAGS_DEBUG}" ) 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( " CUDA_NVCC_FLAGS = ${CUDA_NVCC_FLAGS}" ) examples/heat-equation/tnl-heat-equation.h +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ class heatEquationConfig config.addEntry< tnlString >( "boundary-conditions-file", "File with the values of the boundary conditions.", "boundary.tnl" ); 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< tnlString >( "initial-condition", "File with the initial condition.", "initial.tnl"); //config.addEntry< tnlString >( "initial-condition", "File with the initial condition.", "initial.tnl"); }; }; Loading src/core/tnlTimerCPU.cpp +6 −10 Original line number Diff line number Diff line Loading @@ -26,15 +26,9 @@ tnlTimerCPU :: tnlTimerCPU() void tnlTimerCPU::reset() { #ifdef HAVE_SYS_RESOURCE_H rusage init_usage; getrusage( RUSAGE_SELF, &init_usage ); initial_time = init_usage. ru_utime. tv_sec + 1.0e-6 * ( double ) init_usage. ru_utime. tv_usec; #else initial_time = 0; #endif total_time = 0.0; stop_state = false; stop_state = true; } void tnlTimerCPU::stop() Loading Loading @@ -63,8 +57,10 @@ void tnlTimerCPU::start() double tnlTimerCPU::getTime( int root, MPI_Comm comm ) { #ifdef HAVE_SYS_RESOURCE_H if( ! stop_state ) { stop(); start(); } double mpi_total_time; MPIReduce( total_time, mpi_total_time, 1, MPI_SUM, root, comm ); return mpi_total_time; Loading src/core/tnlTimerRT.cpp +8 −13 Original line number Diff line number Diff line Loading @@ -34,16 +34,9 @@ tnlTimerRT::tnlTimerRT() void tnlTimerRT::reset() { #ifdef HAVE_TIME struct timeval tp; int rtn = gettimeofday( &tp, NULL ); initial_time = ( double ) tp. tv_sec + 1.0e-6 * ( double ) tp. tv_usec; total_time = 0.0; stop_state = false; #else initial_time = 0.0; #endif total_time = 0.0; stop_state = true; } void tnlTimerRT::stop() Loading Loading @@ -72,8 +65,10 @@ void tnlTimerRT::start() double tnlTimerRT::getTime() { #ifdef HAVE_TIME if( ! stop_state ) { stop(); start(); } return total_time; #endif return -1; Loading src/core/vectors/tnlVector.h +1 −1 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ class tnlVector : public tnlArray< Real, Device, Index > //! Computes scalar dot product template< typename Vector > Real scalarProduct( const Vector& v ); Real scalarProduct( const Vector& v ) const; //! Computes this = thisMultiplicator * this + multiplicator * v. template< typename Vector > Loading Loading
CMakeLists.txt +40 −32 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ # Vladimir Klement # Jakub Klinkovsky cmake_minimum_required( VERSION 3.2.0 ) cmake_minimum_required( VERSION 3.0 ) project( tnl ) Loading @@ -34,21 +34,26 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug") set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Debug/bin ) set( debugExt -dbg ) set( CMAKE_CXX_FLAGS "${CXXFLAGS} -g ") #AddCompilerFlag( "-g" ) else() set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Release/src ) set( PROJECT_TESTS_PATH ${PROJECT_SOURCE_DIR}/Release/tests ) set( PROJECT_TOOLS_PATH ${PROJECT_SOURCE_DIR}/Release/tools ) set( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/lib) set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/bin) #OptimizeForArchitecture() AddCompilerFlag( "-O3 -march=native -DNDEBUG -g" ) endif() # set Debug/Release options set( CMAKE_CXX_FLAGS "-std=c++11" ) set( CMAKE_CXX_FLAGS_DEBUG "-g" ) set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG -g" ) # pass -rdynamic only in Debug mode set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" ) set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS_DEBUG "-rdynamic" ) 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..." ) AddCompilerFlag( "-DHAVE_ICPC" ) set( CMAKE_CXX_FLAGS "${CXXFLAGS} -DHAVE_ICPC ") endif() ##### Loading Loading @@ -102,9 +107,9 @@ if( WITH_CUDA STREQUAL "yes" ) set( CUDA_ARCH -gencode arch=compute_${WITH_CUDA_ARCH},code=sm_${WITH_CUDA_ARCH} ) endif() endif() set( CUDA_ADD_EXECUTABLE_OPTIONS ${CUDA_ARCH} ) set( CUDA_ADD_LIBRARY_OPTIONS ${CUDA_ARCH} -shared ) set( CUDA_LINKER_OPTIONS "-arch sm_20 -shared" ) set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ; ${CUDA_ARCH} ) # TODO: this is necessary only due to a bug in cmake set( CUDA_ADD_LIBRARY_OPTIONS -shared ) #### # Check for cuBLAS Loading Loading @@ -148,15 +153,8 @@ if( WITH_CUDA STREQUAL "yes" ) set( CUSPARSE_LIBRARY "${CUDA_cusparse_LIBRARY}" ) endif() endif( NOT WITH_CUSPARSE STREQUAL "no" ) #else( CUDA_FOUND ) # AddCompilerFlag( "-std=c++11" ) endif( CUDA_FOUND ) #else( WITH_CUDA STREQUAL "yes" ) #AddCompilerFlag( "-std=gnu++0x -ftree-vectorizer-verbose=1" ) #AddCompilerFlag( "-std=c++11" ) endif( WITH_CUDA STREQUAL "yes" ) AddCompilerFlag( "-std=c++11" ) #### # Check for OpenMP Loading @@ -164,7 +162,7 @@ AddCompilerFlag( "-std=c++11" ) find_package( OpenMP ) if( OPENMP_FOUND ) message( "Compiler supports OpenMP." ) #set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_OPENMP -fopenmp") set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_OPENMP -fopenmp" ) endif() #### Loading Loading @@ -318,7 +316,6 @@ endif( WITH_TESTS STREQUAL "yes" ) # if( WITH_TEMPLATE_INSTANTIATION STREQUAL "yes" ) AddCompilerFlag( "-DTEMPLATE_EXPLICIT_INSTANTIATION " ) endif() if( INSTANTIATE_INT STREQUAL "yes" ) AddCompilerFlag( "-DINSTANTIATE_INT " ) Loading @@ -339,6 +336,7 @@ endif() if( INSTANTIATE_LONG_DOUBLE STREQUAL "yes" ) AddCompilerFlag( "-DINSTANTIATE_LONG_DOUBLE " ) endif() endif() set( CXX_TEST_FLAGS "-fprofile-arcs -ftest-coverage" ) set( LD_TEST_FLAGS "-lgcov -coverage" ) Loading Loading @@ -388,3 +386,13 @@ set(CPACK_SOURCE_STRIP_FILES "Release") #set(CPACK_PACKAGE_EXECUTABLES "MyExecutable" "My Executable") INCLUDE( CPack ) # Print compiler options message( "-- Compiler options:" ) message( " CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}" ) message( " CMAKE_CXX_FLAGS_DEBUG = ${CMAKE_CXX_FLAGS_DEBUG}" ) 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( " CUDA_NVCC_FLAGS = ${CUDA_NVCC_FLAGS}" )
examples/heat-equation/tnl-heat-equation.h +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ class heatEquationConfig config.addEntry< tnlString >( "boundary-conditions-file", "File with the values of the boundary conditions.", "boundary.tnl" ); 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< tnlString >( "initial-condition", "File with the initial condition.", "initial.tnl"); //config.addEntry< tnlString >( "initial-condition", "File with the initial condition.", "initial.tnl"); }; }; Loading
src/core/tnlTimerCPU.cpp +6 −10 Original line number Diff line number Diff line Loading @@ -26,15 +26,9 @@ tnlTimerCPU :: tnlTimerCPU() void tnlTimerCPU::reset() { #ifdef HAVE_SYS_RESOURCE_H rusage init_usage; getrusage( RUSAGE_SELF, &init_usage ); initial_time = init_usage. ru_utime. tv_sec + 1.0e-6 * ( double ) init_usage. ru_utime. tv_usec; #else initial_time = 0; #endif total_time = 0.0; stop_state = false; stop_state = true; } void tnlTimerCPU::stop() Loading Loading @@ -63,8 +57,10 @@ void tnlTimerCPU::start() double tnlTimerCPU::getTime( int root, MPI_Comm comm ) { #ifdef HAVE_SYS_RESOURCE_H if( ! stop_state ) { stop(); start(); } double mpi_total_time; MPIReduce( total_time, mpi_total_time, 1, MPI_SUM, root, comm ); return mpi_total_time; Loading
src/core/tnlTimerRT.cpp +8 −13 Original line number Diff line number Diff line Loading @@ -34,16 +34,9 @@ tnlTimerRT::tnlTimerRT() void tnlTimerRT::reset() { #ifdef HAVE_TIME struct timeval tp; int rtn = gettimeofday( &tp, NULL ); initial_time = ( double ) tp. tv_sec + 1.0e-6 * ( double ) tp. tv_usec; total_time = 0.0; stop_state = false; #else initial_time = 0.0; #endif total_time = 0.0; stop_state = true; } void tnlTimerRT::stop() Loading Loading @@ -72,8 +65,10 @@ void tnlTimerRT::start() double tnlTimerRT::getTime() { #ifdef HAVE_TIME if( ! stop_state ) { stop(); start(); } return total_time; #endif return -1; Loading
src/core/vectors/tnlVector.h +1 −1 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ class tnlVector : public tnlArray< Real, Device, Index > //! Computes scalar dot product template< typename Vector > Real scalarProduct( const Vector& v ); Real scalarProduct( const Vector& v ) const; //! Computes this = thisMultiplicator * this + multiplicator * v. template< typename Vector > Loading