diff --git a/CMakeLists.txt b/CMakeLists.txt index a9abc70ef049459e1e3694917dc1b9a14faf0c4c..b85dd928d49b5f167bd83a0f17937f419ba83409 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,19 @@ cmake_minimum_required( VERSION 2.8 ) set( tnlVersion "0.1" ) +# Settings foro debug/release version +if( CMAKE_BUILD_TYPE STREQUAL "Debug") + set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Debug/src ) + 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 ) + set( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/lib) + set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/bin) + set( addAlsoSubdirs TRUE) +endif() + ##### # Check for bzip2 # @@ -17,53 +30,55 @@ endif( BZIP2_FOUND ) ##### # Check for CUDA # -find_package( CUDA ) -if( CUDA_FOUND ) - set( BUILD_CUDA TRUE) - set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-DHAVE_CUDA ) - if( CUDA_ARCHITECTURE STREQUAL "1.0" ) - set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_10;-DCUDA_ARCH=10) - endif() - if( CUDA_ARCHITECTURE STREQUAL "1.1" ) - set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_11;-DCUDA_ARCH=11) - endif() - if( CUDA_ARCHITECTURE STREQUAL "1.2" ) - set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_12;-DCUDA_ARCH=12) - endif() - if( CUDA_ARCHITECTURE STREQUAL "1.3" ) - set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_13;-DCUDA_ARCH=13) - endif() - if( CUDA_ARCHITECTURE STREQUAL "2.0" ) - set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_20;-DCUDA_ARCH=20) - endif() - if( CUDA_ARCHITECTURE STREQUAL "2.1" ) - set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_21;-DCUDA_ARCH=21) - endif() - if( CUDA_ARCHITECTURE STREQUAL "2.2" ) - set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_22;-DCUDA_ARCH=22) - endif() - if( CUDA_ARCHITECTURE STREQUAL "2.3" ) - set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_23;-DCUDA_ARCH=23) - endif() - if( CUDA_ARCHITECTURE STREQUAL "3.0" ) - set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_30;-DCUDA_ARCH=30) - endif() - - #### - # 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" ) - else() - message( "CUSP found. -- ${CUSP_INCLUDE_DIR}" ) - set( HAVE_CUSP "#define HAVE_CUSP" ) - cuda_include_directories( ${CUSP_INCLUDE_DIR} ) - endif() - -endif( CUDA_FOUND ) +if( NOT WITH_CUDA STREQUAL "no" ) + find_package( CUDA ) + if( CUDA_FOUND ) + set( BUILD_CUDA TRUE) + set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-DHAVE_CUDA ) + if( CUDA_ARCHITECTURE STREQUAL "1.0" ) + set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_10;-DCUDA_ARCH=10) + endif() + if( CUDA_ARCHITECTURE STREQUAL "1.1" ) + set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_11;-DCUDA_ARCH=11) + endif() + if( CUDA_ARCHITECTURE STREQUAL "1.2" ) + set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_12;-DCUDA_ARCH=12) + endif() + if( CUDA_ARCHITECTURE STREQUAL "1.3" ) + set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_13;-DCUDA_ARCH=13) + endif() + if( CUDA_ARCHITECTURE STREQUAL "2.0" ) + set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_20;-DCUDA_ARCH=20) + endif() + if( CUDA_ARCHITECTURE STREQUAL "2.1" ) + set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_21;-DCUDA_ARCH=21) + endif() + if( CUDA_ARCHITECTURE STREQUAL "2.2" ) + set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_22;-DCUDA_ARCH=22) + endif() + if( CUDA_ARCHITECTURE STREQUAL "2.3" ) + set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_23;-DCUDA_ARCH=23) + endif() + if( CUDA_ARCHITECTURE STREQUAL "3.0" ) + set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=sm_30;-DCUDA_ARCH=30) + endif() + + #### + # 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" ) + else() + message( "CUSP found. -- ${CUSP_INCLUDE_DIR}" ) + set( HAVE_CUSP "#define HAVE_CUSP" ) + cuda_include_directories( ${CUSP_INCLUDE_DIR} ) + endif() + + endif( CUDA_FOUND ) +endif( NOT WITH_CUDA STREQUAL "no" ) #### # Check for OpenMP @@ -124,19 +139,6 @@ endif(CPPUNIT_INCLUDE_DIR) ENABLE_TESTING() INCLUDE( Dart ) -#Nastaveni kam davat vysledne soubory pro debug/release verzi -if( CMAKE_BUILD_TYPE STREQUAL "Debug") - set( PROJECT_BUILD_PATH ${PROJECT_SOURCE_DIR}/Debug/src ) - 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 ) - set( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/lib) - set( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Release/bin) - set( addAlsoSubdirs TRUE) -endif() - set( configDirectory \"${CMAKE_INSTALL_PREFIX}/share/tnl-${tnlVersion}/\") CONFIGURE_FILE( "tnlConfig.h.in" "${PROJECT_BUILD_PATH}/tnlConfig.h" ) INSTALL( FILES ${PROJECT_BUILD_PATH}/tnlConfig.h DESTINATION include/tnl-${tnlVersion} ) diff --git a/buildAll b/buildAll index 1fc06a04a16883a85c1eb015bd798371c337fee9..6e747d45d33a8132d509cd2d4f424574acd13ebf 100755 --- a/buildAll +++ b/buildAll @@ -1,5 +1,9 @@ #!/bin/bash +CPUS=`grep -c processor /proc/cpuinfo` + +echo "Bulding TNL using $CPUS processors." + if [ ! -d Debug ]; then mkdir Debug @@ -10,13 +14,13 @@ then fi cd Debug -cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${HOME}/local -DCUDA_ARCHITECTURE=2.0 -make -j6 #VERBOSE=1 -make -j6 test -make -j6 install +cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${HOME}/local -DCUDA_ARCHITECTURE=2.0 -DWITH_CUDA=no +make -j${CPUS} #VERBOSE=1 +make -j${CPUS} test +make -j${CPUS} install cd ../Release -cmake .. -DCMAKE_INSTALL_PREFIX=${HOME}/local -DCUDA_ARCHITECTURE=2.0 -make -j6 -make -j6 test -make -j6 install +cmake .. -DCMAKE_INSTALL_PREFIX=${HOME}/local -DCUDA_ARCHITECTURE=2.0 -DWITH_CUDA=no +make -j${CPUS} +make -j${CPUS} test +make -j${CPUS} install diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3a58091cf4d711a962ebb3f0036ddb9606865a79..6a1226d20bb03453fb677da7a894aa7ec9ab52c8 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,7 +9,7 @@ ADD_SUBDIRECTORY( mesh ) ADD_SUBDIRECTORY( solver ) -ADD_LIBRARY( tnl${debugExt}-${tnlVersion} SHARED dummy.cpp ) +ADD_LIBRARY( tnl${debugExt}-${tnlVersion} dummy.cpp ) TARGET_LINK_LIBRARIES( tnl${debugExt}-${tnlVersion} tnlconfig${debugExt}-${tnlVersion} tnlcore${debugExt}-${tnlVersion} tnldebug${debugExt}-${tnlVersion} @@ -17,19 +17,19 @@ TARGET_LINK_LIBRARIES( tnl${debugExt}-${tnlVersion} tnlconfig${debugExt}-${tnlVe tnlmatrix${debugExt}-${tnlVersion} tnlmesh${debugExt}-${tnlVersion} tnlsolver${debugExt}-${tnlVersion} ) -INSTALL( TARGETS tnl${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) +INSTALL( TARGETS tnl${debugExt}-${tnlVersion} DESTINATION lib ) IF( BUILD_MPI ) - ADD_LIBRARY( tnl-mpi${debugExt}-${tnlVersion} SHARED dummy.cpp ) + ADD_LIBRARY( tnl-mpi${debugExt}-${tnlVersion} dummy.cpp ) TARGET_LINK_LIBRARIES( tnl-mpi${debugExt}-${tnlVersion} ${MPI_LIBRARIES} - tnlconfig-mpi${debugExt}-${tnlVersion} - tnlcore-mpi${debugExt}-${tnlVersion} - tnldebug-mpi${debugExt}-${tnlVersion} - tnldiff-mpi${debugExt}-${tnlVersion} - tnlmatrix-mpi${debugExt}-${tnlVersion} - tnlmesh-mpi${debugExt}-${tnlVersion} - tnlsolver-mpi${debugExt}-${tnlVersion} ) - INSTALL( TARGETS tnl-mpi${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) + tnlconfig-mpi${debugExt}-${tnlVersion} + tnlcore-mpi${debugExt}-${tnlVersion} + tnldebug-mpi${debugExt}-${tnlVersion} + tnldiff-mpi${debugExt}-${tnlVersion} + tnlmatrix-mpi${debugExt}-${tnlVersion} + tnlmesh-mpi${debugExt}-${tnlVersion} + tnlsolver-mpi${debugExt}-${tnlVersion} ) + INSTALL( TARGETS tnl-mpi${debugExt}-${tnlVersion} DESTINATION lib ) ENDIF() diff --git a/src/config/CMakeLists.txt b/src/config/CMakeLists.txt index 43092275dc52c4934d566dbd8208f40a857f391f..ca4bb47eb22a9249e91ba5dab50f2fd99be381d8 100755 --- a/src/config/CMakeLists.txt +++ b/src/config/CMakeLists.txt @@ -20,14 +20,14 @@ SET( sources tnlConfigDescription.cpp SET( libmconfigincludedir ${TNL_INCLUDE_DIR}/config ) SET( libmconfiginclude_HEADERS ${headers} ) -ADD_LIBRARY( tnlconfig${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) +ADD_LIBRARY( tnlconfig${debugExt}-${tnlVersion} ${sources} ${headers} ) INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/config ) -INSTALL( TARGETS tnlconfig${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) +INSTALL( TARGETS tnlconfig${debugExt}-${tnlVersion} DESTINATION lib ) if( BUILD_MPI ) - ADD_LIBRARY( tnlconfig-mpi${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) + ADD_LIBRARY( tnlconfig-mpi${debugExt}-${tnlVersion} ${sources} ${headers} ) SET_TARGET_PROPERTIES( tnlconfig-mpi${debugExt}-${tnlVersion} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}" ) - INSTALL( TARGETS tnlconfig-mpi${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) + INSTALL( TARGETS tnlconfig-mpi${debugExt}-${tnlVersion} DESTINATION lib ) endif() diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index fc1dcf97754ca1c450eec61a724341daa5af43f8..73279b4128b15c57fdc93798edc83b514bee5963 100755 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -14,7 +14,8 @@ set (headers tnlAssert.h tnlLongVectorCUDA.h tnlLogger.h tnlObject.h - tnlStack.h + tnlStack.h + tnlStatistics.h tnlString.h tnlReal.h tnlTimerCPU.h @@ -30,6 +31,7 @@ set( sources tnlFile.cpp tnlFlopsCounter.cpp tnlLogger.cpp tnlObject.cpp + tnlStatistics.cpp tnlString.cpp tnlTimerCPU.cpp tnlTimerRT.cpp @@ -40,16 +42,16 @@ set( sources tnlFile.cpp SET( libtnlcoreincludedir ${TNL_INCLUDE_DIR}/core ) SET( libtnlcoreinclude_HEADERS ${headers} ) -ADD_LIBRARY( tnlcore${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) +ADD_LIBRARY( tnlcore${debugExt}-${tnlVersion} ${sources} ${headers} ) TARGET_LINK_LIBRARIES( tnlcore${debugExt}-${tnlVersion} ${BZIP2_LIBRARIES} ) -INSTALL( TARGETS tnlcore${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) +INSTALL( TARGETS tnlcore${debugExt}-${tnlVersion} DESTINATION lib ) IF( BUILD_MPI ) - ADD_LIBRARY( tnlcore-mpi${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) + ADD_LIBRARY( tnlcore-mpi${debugExt}-${tnlVersion} ${sources} ${headers} ) TARGET_LINK_LIBRARIES( tnlcore-mpi${debugExt}-${tnlVersion} ${MPI_LIBRARIES} - ${BZIP2_LIBRARIES} ) + ${BZIP2_LIBRARIES} ) SET_TARGET_PROPERTIES( tnlcore-mpi${debugExt}-${tnlVersion} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}" ) - INSTALL( TARGETS tnlcore-mpi${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) + INSTALL( TARGETS tnlcore-mpi${debugExt}-${tnlVersion} DESTINATION lib ) ENDIF() INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/core ) diff --git a/src/core/tnlLongVectorBase.h b/src/core/tnlLongVectorBase.h index 7d47f2cbbd1c53e8d4fed9383261ce65526c63fc..ac748f19311739c1f2814b4d85a06147730b6a43 100644 --- a/src/core/tnlLongVectorBase.h +++ b/src/core/tnlLongVectorBase.h @@ -27,18 +27,6 @@ #ifdef HAVE_CUDA #include <cuda_runtime.h> -/*void tnlLongVectorCUDASetValue( int* data, - const int size, - const int& v ); - -void tnlLongVectorCUDASetValue( float* data, - const int size, - const float& v ); - -void tnlLongVectorCUDASetValue( double* data, - const int size, - const double& v ); -*/ #else #include <iostream> using namespace std; @@ -105,7 +93,8 @@ template< typename Real, typename Index = int > class tnlLongVectorBase : public */ void touch( long int touches = 1 ) const { - defaultTnlStatistics. addTransferedBytes( touches * getSize() * sizeof( Real ) ); + // TODO: fix this + //defaultTnlStatistics. addTransferedBytes( touches * getSize() * sizeof( Real ) ); }; virtual ~tnlLongVectorBase(){}; diff --git a/src/debug/CMakeLists.txt b/src/debug/CMakeLists.txt index 9300d4f8929c0f0597e562466a79498203189ad7..9b5b936d23c3efbf07298e4888005442b60dd36f 100755 --- a/src/debug/CMakeLists.txt +++ b/src/debug/CMakeLists.txt @@ -18,20 +18,20 @@ SET(headers tnlDbgDataElement.h tnlDebugScanner.h tnlDebugStructure.h ) -ADD_LIBRARY( tnldebug${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) +ADD_LIBRARY( tnldebug${debugExt}-${tnlVersion} ${sources} ${headers} ) ADD_EXECUTABLE( tnl-debug-test tnl-debug-test.cpp ) TARGET_LINK_LIBRARIES( tnl-debug-test tnldebug${debugExt}-${tnlVersion}) -INSTALL( TARGETS tnldebug${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) +INSTALL( TARGETS tnldebug${debugExt}-${tnlVersion} DESTINATION lib ) IF( BUILD_MPI ) - ADD_LIBRARY( tnldebug-mpi${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) + ADD_LIBRARY( tnldebug-mpi${debugExt}-${tnlVersion} ${sources} ${headers} ) SET_TARGET_PROPERTIES( tnldebug-mpi${debugExt}-${tnlVersion} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}" ) ADD_EXECUTABLE( tnl-debug-test-mpi tnl-debug-test.cpp ) TARGET_LINK_LIBRARIES( tnl-debug-test-mpi tnldebug-mpi${debugExt}-${tnlVersion}) SET_TARGET_PROPERTIES( tnl-debug-test-mpi PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}" ) - INSTALL( TARGETS tnldebug-mpi${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) + INSTALL( TARGETS tnldebug-mpi${debugExt}-${tnlVersion} DESTINATION lib ) ENDIF() diff --git a/src/diff/CMakeLists.txt b/src/diff/CMakeLists.txt index 4ef3f23152c6b7c0f7cacd42c9e97a8023a4ff89..5b573ca90b5371ab436b53f798b4c7224cd8142d 100755 --- a/src/diff/CMakeLists.txt +++ b/src/diff/CMakeLists.txt @@ -8,15 +8,15 @@ SET( sources ../dummy.cpp ) SET( libtnldiffincludedir ${TNL_INCLUDE_DIR}/diff ) SET( libtnldiffinclude_HEADERS ${headers} ) -ADD_LIBRARY( tnldiff${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) +ADD_LIBRARY( tnldiff${debugExt}-${tnlVersion} ${sources} ${headers} ) TARGET_LINK_LIBRARIES( tnldiff${debugExt}-${tnlVersion} ) -INSTALL( TARGETS tnldiff${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) +INSTALL( TARGETS tnldiff${debugExt}-${tnlVersion} DESTINATION lib ) IF( BUILD_MPI ) - ADD_LIBRARY( tnldiff-mpi${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) + ADD_LIBRARY( tnldiff-mpi${debugExt}-${tnlVersion} ${sources} ${headers} ) TARGET_LINK_LIBRARIES( tnldiff-mpi${debugExt}-${tnlVersion} ${MPI_LIBRARIES} ) SET_TARGET_PROPERTIES( tnldiff-mpi${debugExt}-${tnlVersion} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}" ) - INSTALL( TARGETS tnldiff-mpi${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) + INSTALL( TARGETS tnldiff-mpi${debugExt}-${tnlVersion} DESTINATION lib ) ENDIF() INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/diff ) \ No newline at end of file diff --git a/src/matrix/CMakeLists.txt b/src/matrix/CMakeLists.txt index 0624684c0f880f050d0e5067be91666be5537146..0ded6d53dfd6e4bd7981c56dec10cc881b491f81 100755 --- a/src/matrix/CMakeLists.txt +++ b/src/matrix/CMakeLists.txt @@ -14,15 +14,15 @@ SET( sources tnlMatrix.cpp ) SET( libtnlmatrixincludedir ${TNL_INCLUDE_DIR}/matrix ) SET( libtnlmatrixinclude_HEADERS ${headers} ) -ADD_LIBRARY( tnlmatrix${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) +ADD_LIBRARY( tnlmatrix${debugExt}-${tnlVersion} ${sources} ${headers} ) TARGET_LINK_LIBRARIES( tnlmatrix${debugExt}-${tnlVersion} ) -INSTALL( TARGETS tnlmatrix${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) +INSTALL( TARGETS tnlmatrix${debugExt}-${tnlVersion} DESTINATION lib ) IF( BUILD_MPI ) - ADD_LIBRARY( tnlmatrix-mpi${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) + ADD_LIBRARY( tnlmatrix-mpi${debugExt}-${tnlVersion} ${sources} ${headers} ) TARGET_LINK_LIBRARIES( tnlmatrix-mpi${debugExt}-${tnlVersion} ${MPI_LIBRARIES} ) SET_TARGET_PROPERTIES( tnlmatrix-mpi${debugExt}-${tnlVersion} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}" ) - INSTALL( TARGETS tnlmatrix-mpi${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) + INSTALL( TARGETS tnlmatrix-mpi${debugExt}-${tnlVersion} DESTINATION lib ) ENDIF() INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/matrix ) \ No newline at end of file diff --git a/src/mesh/CMakeLists.txt b/src/mesh/CMakeLists.txt index 39d3df84ea414e8617963cd28e809f5d73ad74dd..2f86c0d1ed39e69a828802cf3237ff1b886c90f9 100755 --- a/src/mesh/CMakeLists.txt +++ b/src/mesh/CMakeLists.txt @@ -6,15 +6,15 @@ SET( sources ../dummy.cpp ) SET( libtnlmeshincludedir ${TNL_INCLUDE_DIR}/mesh ) SET( libtnlmeshinclude_HEADERS ${headers} ) -ADD_LIBRARY( tnlmesh${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) +ADD_LIBRARY( tnlmesh${debugExt}-${tnlVersion} ${sources} ${headers} ) TARGET_LINK_LIBRARIES( tnlmesh${debugExt}-${tnlVersion} ) -INSTALL( TARGETS tnlmesh${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) +INSTALL( TARGETS tnlmesh${debugExt}-${tnlVersion} DESTINATION lib ) IF( BUILD_MPI ) - ADD_LIBRARY( tnlmesh-mpi${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) + ADD_LIBRARY( tnlmesh-mpi${debugExt}-${tnlVersion} ${sources} ${headers} ) TARGET_LINK_LIBRARIES( tnlmesh-mpi${debugExt}-${tnlVersion} ${MPI_LIBRARIES} ) SET_TARGET_PROPERTIES( tnlmesh-mpi${debugExt}-${tnlVersion} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}" ) - INSTALL( TARGETS tnlmesh-mpi${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) + INSTALL( TARGETS tnlmesh-mpi${debugExt}-${tnlVersion} DESTINATION lib ) ENDIF() INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/mesh ) \ No newline at end of file diff --git a/src/solver/CMakeLists.txt b/src/solver/CMakeLists.txt index 3b6a45a41c053828172d1eb4b2f715dd2945a0e5..2bd92035d26128010714123e11239edadcabeb15 100755 --- a/src/solver/CMakeLists.txt +++ b/src/solver/CMakeLists.txt @@ -17,15 +17,15 @@ SET( sources ../dummy.cpp ) SET( libtnlsolverincludedir ${TNL_INCLUDE_DIR}/mesh ) SET( libtnlsolverinclude_HEADERS ${headers} ) -ADD_LIBRARY( tnlsolver${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) +ADD_LIBRARY( tnlsolver${debugExt}-${tnlVersion} ${sources} ${headers} ) TARGET_LINK_LIBRARIES( tnlsolver${debugExt}-${tnlVersion} ) -INSTALL( TARGETS tnlsolver${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) +INSTALL( TARGETS tnlsolver${debugExt}-${tnlVersion} DESTINATION lib ) IF( BUILD_MPI ) - ADD_LIBRARY( tnlsolver-mpi${debugExt}-${tnlVersion} SHARED ${sources} ${headers} ) + ADD_LIBRARY( tnlsolver-mpi${debugExt}-${tnlVersion} ${sources} ${headers} ) TARGET_LINK_LIBRARIES( tnlsolver-mpi${debugExt}-${tnlVersion} ${MPI_LIBRARIES} ) SET_TARGET_PROPERTIES( tnlsolver-mpi${debugExt}-${tnlVersion} PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}" ) - INSTALL( TARGETS tnlsolver-mpi${debugExt}-${tnlVersion} LIBRARY DESTINATION lib ) + INSTALL( TARGETS tnlsolver-mpi${debugExt}-${tnlVersion} DESTINATION lib ) ENDIF() diff --git a/tests/benchmarks/CMakeLists.txt b/tests/benchmarks/CMakeLists.txt index a15ae8cb6a1322fb3a8085ed02497a001b94e055..abe3898269d1a2644ed967a7da25396dbdd38ee6 100755 --- a/tests/benchmarks/CMakeLists.txt +++ b/tests/benchmarks/CMakeLists.txt @@ -10,15 +10,10 @@ SET( tnlSpmvBenchmark_headers sparse-matrix-benchmark.h IF( BUILD_CUDA ) CUDA_ADD_EXECUTABLE( tnl-sparse-matrix-benchmark${debugExt} sparse-matrix-benchmark.cu ) - TARGET_LINK_LIBRARIES( tnl-sparse-matrix-benchmark${debugExt} tnl${debugExt}-${tnlVersion} - tnlcore${debugExt}-${tnlVersion} - tnlconfig${debugExt}-${tnlVersion} ) - + TARGET_LINK_LIBRARIES( tnl-sparse-matrix-benchmark${debugExt} tnl${debugExt}-${tnlVersion} ) ELSE() ADD_EXECUTABLE( tnl-sparse-matrix-benchmark${debugExt} sparse-matrix-benchmark.cpp ) - TARGET_LINK_LIBRARIES( tnl-sparse-matrix-benchmark${debugExt} tnl${debugExt}-${tnlVersion} - tnlcore${debugExt}-${tnlVersion} - tnlconfig${debugExt}-${tnlVersion} ) + TARGET_LINK_LIBRARIES( tnl-sparse-matrix-benchmark${debugExt} tnl${debugExt}-${tnlVersion} ) ENDIF() INSTALL( TARGETS tnl-sparse-matrix-benchmark${debugExt} diff --git a/tests/benchmarks/sparse-matrix-benchmark.h b/tests/benchmarks/sparse-matrix-benchmark.h index 2a60b51248260c0b1afe22d6821fe787483eb67d..5c9c208241f5916f37f867853d894dcb5da5b9fe 100644 --- a/tests/benchmarks/sparse-matrix-benchmark.h +++ b/tests/benchmarks/sparse-matrix-benchmark.h @@ -270,14 +270,12 @@ bool benchmarkMatrix( const tnlString& inputFile, cudaRgCsrMatrixBenchmark. setAdaptiveGroupSizeStrategy( tnlAdaptiveGroupSizeStrategyByAverageRowSize ); cudaRgCsrMatrixBenchmark. setMaxIterations( maxIterations ); cudaRgCsrMatrixBenchmark. setup( csrMatrix ); - if( formatTest ) - cudaRgCsrMatrixBenchmark. testMatrix( csrMatrix, verbose ); for( int cudaBlockSize = 32; cudaBlockSize <= 256; cudaBlockSize *= 2 ) { cudaRgCsrMatrixBenchmark. setCudaBlockSize( cudaBlockSize ); - //if( formatTest ) - // cudaRgCsrMatrixBenchmark. testMatrix( csrMatrix, verbose ); - //cudaRgCsrMatrixBenchmark. runBenchmark( cudaX, refB, verbose ); + if( formatTest ) + cudaRgCsrMatrixBenchmark. testMatrix( csrMatrix, verbose ); + cudaRgCsrMatrixBenchmark. runBenchmark( cudaX, refB, verbose ); if( logFileName ) cudaRgCsrMatrixBenchmark. writeToLogTable( logFile, csrMatrixBenchmark. getGflops(), @@ -305,7 +303,6 @@ bool benchmarkMatrix( const tnlString& inputFile, int rowSize = csrMatrix. getNonzeroElementsInRow( rowPermutation[ 0 ] ); for( int i = 1; i < csrMatrix. getSize(); i ++ ) { - //cout << csrMatrix. getNonzeroElementsInRow( rowPermutation[ i ] ) << endl; if( rowSize < csrMatrix. getNonzeroElementsInRow( rowPermutation[ i ] ) ) { cerr << "The rows are not sorted properly. Error is at row number " << i << endl; @@ -352,10 +349,10 @@ bool benchmarkMatrix( const tnlString& inputFile, cudaRgCsrMatrixBenchmark. setMaxIterations( maxIterations ); for( int cudaBlockSize = 32; cudaBlockSize <= 256; cudaBlockSize *= 2 ) { - //cudaRgCsrMatrixBenchmark. setCudaBlockSize( cudaBlockSize ); - //if( formatTest ) - // cudaRgCsrMatrixBenchmark. testMatrix( csrMatrix, verbose ); - //cudaRgCsrMatrixBenchmark. runBenchmark( cudaX, refB, verbose ); + cudaRgCsrMatrixBenchmark. setCudaBlockSize( cudaBlockSize ); + if( formatTest ) + cudaRgCsrMatrixBenchmark. testMatrix( csrMatrix, verbose ); + cudaRgCsrMatrixBenchmark. runBenchmark( cudaX, refB, verbose ); if( logFileName ) cudaRgCsrMatrixBenchmark. writeToLogTable( logFile, csrMatrixBenchmark. getGflops(), @@ -405,203 +402,6 @@ bool benchmarkMatrix( const tnlString& inputFile, } -#ifdef UNDEF - /* - * Benchmark of the Fast CSR format. - */ - { - if( verbose ) - cout << left << setw( 30 ) << "Fast CSR " << flush; - - tnlFastCSRMatrix< Real > fast_csrMatrix( "fast-csr-matrix" ); - - if( fast_csrMatrix. copyFrom( csrMatrix ) ) - { - benchmarkStatistics. fast_csr_compression = 100.0 * ( 1.0 - ( double ) fast_csrMatrix. getColumnSequencesLength() / ( double ) fast_csrMatrix. getNonzeroElements() ); - - time = stop_time; - benchmarkSpMV< Real, tnlHost >( fast_csrMatrix, - host_x, - nonzero_elements, - host_b, - time, - benchmarkStatistics. spmv_fast_csr_gflops, - benchmarkStatistics. spmv_fast_csr_iter ); - if( verbose ) - cout << right << setw( 12 ) << setprecision( 2 ) << time - << right << setw( 15 ) << benchmarkStatistics. spmv_fast_csr_iter - << right << setw( 12 ) << setprecision( 2 ) << benchmarkStatistics. spmv_fast_csr_gflops << flush; - - if( refB != host_b ) - { - if( verbose ) - cout << right << setw( 12 ) << "FAILED." << endl; - Real max_err( 0.0 ); - for( int i = 0; i < size; i ++ ) - max_err = Max( max_err, ( Real ) fabs( host_b[ i ] - refB[ i ] ) ); - if( verbose ) - cout << left << setw( 12 ) << " Max. err. is " << max_err << endl; - benchmarkStatistics. spmv_fast_csr_gflops = -1.0; - return false; - } - if( verbose ) - cout << left << setw( 12 ) << " OK." - << right << setw( 14 ) << "Compression: " << benchmarkStatistics. fast_csr_compression << "%" << endl; - } - else - if( verbose ) - cout << "Format transfer failed!!!" << endl; - /* - * Benchmark Coalesced Fast CSR format. - */ - block_iter = 0; - for( int block_size = 16; block_size < 64; block_size *= 2 ) - { - if( verbose ) - cout << left << setw( 25 ) << "Colesced Fast CSR " << setw( 5 ) << block_size << flush; - - tnlFastRgCSRMatrix< Real > coa_fast_csrMatrix( "coa_fast-csr-matrix", block_size ); - - if( coa_fast_csrMatrix. copyFrom( fast_csrMatrix ) ) - { - //coa_fast_csr_compression = 100.0 * ( 1.0 - ( double ) coa_fast_csrMatrix. getColumnSequencesLength() / ( double ) coa_fast_csrMatrix. getNonzeroElements() ); - benchmarkStatistics. coa_fast_csr_max_cs_dict_size[ block_iter ] = coa_fast_csrMatrix. getMaxColumnSequenceDictionarySize(); - time = stop_time; - benchmarkSpMV< Real, tnlHost >( coa_fast_csrMatrix, - host_x, - nonzero_elements, - host_b, - time, - benchmarkStatistics. spmv_coa_fast_csr_gflops[ block_iter ], - benchmarkStatistics. spmv_coa_fast_csr_iter[ block_iter ] ); - if( verbose ) - cout << right << setw( 12 ) << setprecision( 2 ) << time - << right << setw( 15 ) << benchmarkStatistics. spmv_coa_fast_csr_iter[ block_iter ] - << right << setw( 12 ) << setprecision( 2 ) << benchmarkStatistics. spmv_coa_fast_csr_gflops[ block_iter ] << flush; - - if( refB != host_b ) - { - if( verbose ) - cout << right << setw( 12 ) << "FAILED." << endl; - benchmarkStatistics. spmv_coa_fast_csr_gflops[ block_iter ] = -1.0; - return false; - } - if( verbose ) - cout << left << setw( 12 ) << " OK." << endl; - } - else - { - benchmarkStatistics. coa_fast_csr_max_cs_dict_size[ block_iter ] = coa_fast_csrMatrix. getMaxColumnSequenceDictionarySize(); - if( verbose ) - cout << "Format transfer failed!!!" << endl; - continue; - } - -#ifdef HAVE_CUDA - /* - * Benchmark Coalesced Fast CSR format on the CUDA device. - */ - - if( verbose ) - cout << left << setw( 25 ) << "Coalesced Fast CSR CUDA" << setw( 5 ) << block_size << flush; - - tnlFastRgCSRMatrix< Real, tnlCuda > cuda_coa_fast_csrMatrix( "cuda-coa-fast-csr-matrix" ); - - if( cuda_coa_fast_csrMatrix. copyFrom( coa_fast_csrMatrix ) ) - { - time = stop_time; - cuda_b. setValue( -1.0 ); - benchmarkSpMV< Real, tnlCuda >( cuda_coa_fast_csrMatrix, - cuda_x, - nonzero_elements, - cuda_b, - time, - benchmarkStatistics. spmv_cuda_coa_fast_csr_gflops[ block_iter ], - benchmarkStatistics. spmv_cuda_coa_fast_csr_iter[ block_iter ] ); - - if( verbose ) - cout << right << setw( 12 ) << setprecision( 2 ) << time - << right << setw( 15 ) << benchmarkStatistics. spmv_cuda_coa_fast_csr_iter[ block_iter ] - << right << setw( 12 ) << setprecision( 2 ) << benchmarkStatistics. spmv_cuda_coa_fast_csr_gflops[ block_iter ] << endl; - - //if( refB != cuda_b ) - // { - // if( verbose ) - // cout << right << setw( 12 ) << "FAILED." << endl; - // //spmv_cuda_coa_fast_csr_gflops[ block_iter ] = -1.0; - // return false; - // } - // else - // if( verbose ) - // cout << right << setw( 12 ) << "OK." << endl; - } - else - if( verbose ) - cout << "Format transfer failed!!!" << endl; -#endif - block_iter ++; - } - } - - - - /* - * Benchmarks of the ELLPACK format. - */ - /*{ - if( verbose ) - cout << "Benchmarking ELLPACK format ... " << flush; - - int max_row_length, min_row_length, average_row_length; - csrMatrix. getRowStatistics( min_row_length, - max_row_length, - average_row_length ); - double alpha= 1.0; - int ellpack_row_length = ( 1.0 - alpha ) * average_row_length + - alpha * max_row_length; - tnlEllpackMatrix< Real, tnlHost > ellpack_matrix( "ellpack-matrix", ellpack_row_length ); - ellpack_artificial_zeros = 100.0 * ( double ) ellpack_matrix. getArtificialZeroElements() / ( double ) ellpack_matrix. getNonzeroElements(); - ellpack_matrix. copyFrom( csrMatrix ); - if( verbose ) - cout << "Min row length = " << min_row_length << endl - << "Max row length = " << max_row_length << endl - << "Average row length = " << average_row_length << endl - << "Ellpack row length = " << ellpack_row_length << endl - << "COO elements = " << ellpack_matrix. getCOONonzeroElements() << endl; - time = stop_time; - host_x. setValue( 1.0 ); - host_b. setValue( 0.0 ); - benchmarkSpMV< Real, tnlHost >( ellpack_matrix, - host_x, - host_b, - time, - spmv_ellpack_gflops, - spmv_ellpack_iter ); - - if( verbose ) - cout << time << " sec. " << spmv_ellpack_iter << " iterations " << spmv_ellpack_gflops << " GFLOPS." << endl; - if( verbose ) - cout << "Comparing results ... "; - if( refB != host_b ) - { - if( verbose ) - cout << "FAILED." << endl; - return false; - } - if( verbose ) - cout << "OK." << endl; - - }*/ - - if( verbose ) - cout << setfill( '-' ) << setw( 95 ) << "--" << endl - << setfill( ' '); - return true; - -} -#endif - - int main( int argc, char* argv[] ) { dbgFunctionName( "", "main" ); diff --git a/tests/unit-tests/tnl-unit-tests.cpp b/tests/unit-tests/tnl-unit-tests.cpp index e39014e75c1625545d84f3faae60b158c71c2c7e..ea7c2ffc3142f3d64ff489230b40402f45866896 100644 --- a/tests/unit-tests/tnl-unit-tests.cpp +++ b/tests/unit-tests/tnl-unit-tests.cpp @@ -15,4 +15,4 @@ * * ***************************************************************************/ -#include "tnl-unit-test.h" +#include "tnl-unit-tests.h"