diff --git a/CMakeLists.txt b/CMakeLists.txt index e74510f942beb67e37384caeaf5ecd488ee1a24e..9e15d88ca1212dfc253f8e54b634d0fa0e825cc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,7 @@ set( CMAKE_CXX_STANDARD_REQUIRED ON ) set( CMAKE_CXX_EXTENSIONS OFF ) # set default build options -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall -Wno-unused-local-typedefs -Wno-unused-variable -Wno-unknown-pragmas" ) +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wall -Wno-unused-local-typedefs -Wno-unknown-pragmas" ) set( CMAKE_CXX_FLAGS_DEBUG "-g" ) set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" ) # pass -rdynamic only in Debug mode diff --git a/src/Benchmarks/BLAS/array-operations.h b/src/Benchmarks/BLAS/array-operations.h index 84767a7b1f97e96387c25e6e52356259c67505d2..a8c606d386c32573599ad67144006bf56f19d9bb 100644 --- a/src/Benchmarks/BLAS/array-operations.h +++ b/src/Benchmarks/BLAS/array-operations.h @@ -43,7 +43,7 @@ benchmarkArrayOperations( Benchmark & benchmark, deviceArray2.setSize( size ); #endif - Real resultHost, resultDevice; + Real resultHost; // reset functions @@ -104,6 +104,7 @@ benchmarkArrayOperations( Benchmark & benchmark, benchmark.setOperation( "comparison (operator==)", 2 * datasetSize ); benchmark.time< Devices::Host >( reset1, "CPU", compareHost ); #ifdef HAVE_CUDA + Real resultDevice; auto compareCuda = [&]() { resultDevice = (int) ( deviceArray == deviceArray2 ); }; @@ -118,6 +119,7 @@ benchmarkArrayOperations( Benchmark & benchmark, // copyBasetime is used later inside HAVE_CUDA guard, so the compiler will // complain when compiling without CUDA const double copyBasetime = benchmark.time< Devices::Host >( reset1, "CPU", copyAssignHostHost ); + (void)copyBasetime; // ignore unused variable #ifdef HAVE_CUDA auto copyAssignCudaCuda = [&]() { deviceArray = deviceArray2; diff --git a/src/Benchmarks/DistSpMV/tnl-benchmark-distributed-spmv.h b/src/Benchmarks/DistSpMV/tnl-benchmark-distributed-spmv.h index 4f7b07dee9b6a780bcb7665a2014658b7a20cbaf..ec06c946aaf1e1cb57a7e5f5ba7f8e1801b986bb 100644 --- a/src/Benchmarks/DistSpMV/tnl-benchmark-distributed-spmv.h +++ b/src/Benchmarks/DistSpMV/tnl-benchmark-distributed-spmv.h @@ -241,7 +241,7 @@ struct SpmvBenchmark const auto gi = distributedMatrix.getLocalRowRange().getGlobalIndex( i ); distributedRowLengths[ gi ] = matrix.getRowCapacity( gi ); } - distributedMatrix.setCompressedRowLengths( distributedRowLengths ); + distributedMatrix.setRowCapacities( distributedRowLengths ); // copy data from the global matrix/vector into the distributed matrix/vector for( IndexType i = 0; i < distributedMatrix.getLocalMatrix().getRows(); i++ ) { diff --git a/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem_impl.h b/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem_impl.h index 8fa3ede2457d6d45ee1b5f864fdaed373a1a1fb8..7c0fdf748cbe7162ddae350d479353f17bc4e499 100644 --- a/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem_impl.h +++ b/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem_impl.h @@ -646,7 +646,6 @@ HeatEquationBenchmarkProblem< Mesh, BoundaryCondition, RightHandSide, Differenti applyBoundaryConditions( const RealType& time, DofVectorPointer& uDofs ) { - const MeshPointer& mesh = this->getMesh(); if( this->cudaKernelType == "templated" ) { this->bindDofs( uDofs ); @@ -698,6 +697,7 @@ applyBoundaryConditions( const RealType& time, #endif userData.boundaryConditions = &this->boundaryConditionPointer.template getData< Devices::Cuda >(); Meshes::Traverser< MeshType, Cell > meshTraverser; + const MeshPointer& mesh = this->getMesh(); // */ /*meshTraverser.template processBoundaryEntities< BoundaryEntitiesProcessor > ( mesh, diff --git a/src/Benchmarks/LinearSolvers/tnl-benchmark-linear-solvers.h b/src/Benchmarks/LinearSolvers/tnl-benchmark-linear-solvers.h index 36ca471e165121e31caf3057e72eb60e6b5fd6cd..0d1978e3d9f9c99d93d300f88a585b32ad6122b7 100644 --- a/src/Benchmarks/LinearSolvers/tnl-benchmark-linear-solvers.h +++ b/src/Benchmarks/LinearSolvers/tnl-benchmark-linear-solvers.h @@ -457,13 +457,13 @@ struct LinearSolversBenchmark DistributedVector dist_x0( localRange, matrixPointer->getRows(), group ); DistributedVector dist_b( localRange, matrixPointer->getRows(), group ); - // copy the row lengths from the global matrix to the distributed matrix + // copy the row capacities from the global matrix to the distributed matrix DistributedRowLengths distributedRowLengths( localRange, matrixPointer->getRows(), group ); for( IndexType i = 0; i < distMatrixPointer->getLocalMatrix().getRows(); i++ ) { const auto gi = distMatrixPointer->getLocalRowRange().getGlobalIndex( i ); distributedRowLengths[ gi ] = matrixPointer->getRowCapacity( gi ); } - distMatrixPointer->setCompressedRowLengths( distributedRowLengths ); + distMatrixPointer->setRowCapacities( distributedRowLengths ); // copy data from the global matrix/vector into the distributed matrix/vector for( IndexType i = 0; i < distMatrixPointer->getLocalMatrix().getRows(); i++ ) { diff --git a/src/Benchmarks/ODESolvers/Merson.hpp b/src/Benchmarks/ODESolvers/Merson.hpp index 3c74bdf480c66025f44de201e18ad5368d050e6f..c97bfc236b8db8f321874c92f23fe11ca9771e08 100644 --- a/src/Benchmarks/ODESolvers/Merson.hpp +++ b/src/Benchmarks/ODESolvers/Merson.hpp @@ -244,7 +244,7 @@ void Merson< Problem, SolverMonitor >::computeKFunctions( DofVectorPointer& u, RealType* _k2 = k2->getData(); RealType* _k3 = k3->getData(); RealType* _k4 = k4->getData(); - RealType* _k5 = k5->getData(); + //RealType* _k5 = k5->getData(); RealType* _kAux = kAux->getData(); RealType* _u = u->getData(); @@ -353,7 +353,6 @@ typename Problem :: RealType Merson< Problem, SolverMonitor >::computeError( con const RealType* _k3 = k3->getData(); const RealType* _k4 = k4->getData(); const RealType* _k5 = k5->getData(); - RealType* _kAux = kAux->getData(); RealType eps( 0.0 ), maxEps( 0.0 ); if( std::is_same< DeviceType, Devices::Host >::value ) @@ -383,6 +382,7 @@ typename Problem :: RealType Merson< Problem, SolverMonitor >::computeError( con if( std::is_same< DeviceType, Devices::Cuda >::value ) { #ifdef HAVE_CUDA + RealType* _kAux = kAux->getData(); dim3 cudaBlockSize( 512 ); const IndexType cudaBlocks = Cuda::getNumberOfBlocks( size, cudaBlockSize.x ); const IndexType cudaGrids = Cuda::getNumberOfGrids( cudaBlocks ); diff --git a/src/Examples/transport-equation/transportEquationProblem_impl.h b/src/Examples/transport-equation/transportEquationProblem_impl.h index 96cf1a6ec263029f783c9a95e87327927d13ce71..ebfb3d0da2928c3aae0ad9d7de42285219e30a24 100644 --- a/src/Examples/transport-equation/transportEquationProblem_impl.h +++ b/src/Examples/transport-equation/transportEquationProblem_impl.h @@ -188,7 +188,7 @@ getExplicitUpdate( const RealType& time, */ const MeshPointer& mesh = this->getMesh(); typedef typename MeshType::Cell Cell; - int count = ::sqrt(mesh->template getEntitiesCount< Cell >()); + //int count = ::sqrt(mesh->template getEntitiesCount< Cell >()); this->bindDofs( _u ); Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater; Pointers::SharedPointer< MeshFunctionType > u( mesh, _u ); diff --git a/src/TNL/Communicators/MpiCommunicator.h b/src/TNL/Communicators/MpiCommunicator.h index 0aa14a9ece5d518ce5e142898cea56593d375189..5b4fa4505f12f217d799a96b16ff372411ddadcf 100644 --- a/src/TNL/Communicators/MpiCommunicator.h +++ b/src/TNL/Communicators/MpiCommunicator.h @@ -144,6 +144,14 @@ class MpiCommunicator MPI_Init( &argc, &argv ); selectGPU(); #endif + + // silence warnings about (potentially) unused variables + (void) NullGroup; + (void) NullRequest; + (void) backup; + (void) psbuf; + (void) filestr; + (void) redirect; } static void setRedirection( bool redirect_ ) diff --git a/src/TNL/Containers/Segments/ChunkedEllpackView.hpp b/src/TNL/Containers/Segments/ChunkedEllpackView.hpp index 7ca3fb9050198e80800639661a114ffbbe8f4ec2..78a668415087b56416f7548725d8440fa2a823d6 100644 --- a/src/TNL/Containers/Segments/ChunkedEllpackView.hpp +++ b/src/TNL/Containers/Segments/ChunkedEllpackView.hpp @@ -622,7 +622,7 @@ segmentsReductionKernel( IndexType gridIdx, const IndexType sliceOffset = sliceInfo.pointer; const IndexType chunkSize = sliceInfo.chunkSize; - const IndexType chunkIdx = sliceIdx * chunksInSlice + threadIdx.x; + //const IndexType chunkIdx = sliceIdx * chunksInSlice + threadIdx.x; bool compute( true ); if( Organization == RowMajorOrder ) diff --git a/src/TNL/Containers/Segments/SlicedEllpackView.hpp b/src/TNL/Containers/Segments/SlicedEllpackView.hpp index 34f24def68187abf603d38da8eadae43b8b3e26c..e9adececb432b7f7e25a6f8c2cc15e00835b51ea 100644 --- a/src/TNL/Containers/Segments/SlicedEllpackView.hpp +++ b/src/TNL/Containers/Segments/SlicedEllpackView.hpp @@ -253,7 +253,7 @@ forSegments( IndexType first, IndexType last, Function& f, Args... args ) const auto l = [=] __cuda_callable__ ( const IndexType segmentIdx, Args... args ) mutable { const IndexType sliceIdx = segmentIdx / SliceSize; const IndexType segmentInSliceIdx = segmentIdx % SliceSize; - const IndexType segmentSize = sliceSegmentSizes_view[ sliceIdx ]; + //const IndexType segmentSize = sliceSegmentSizes_view[ sliceIdx ]; const IndexType begin = sliceOffsets_view[ sliceIdx ] + segmentInSliceIdx; const IndexType end = sliceOffsets_view[ sliceIdx + 1 ]; IndexType localIdx( 0 ); @@ -312,7 +312,7 @@ segmentsReduction( IndexType first, IndexType last, Fetch& fetch, const Reductio auto l = [=] __cuda_callable__ ( const IndexType segmentIdx, Args... args ) mutable { const IndexType sliceIdx = segmentIdx / SliceSize; const IndexType segmentInSliceIdx = segmentIdx % SliceSize; - const IndexType segmentSize = sliceSegmentSizes_view[ sliceIdx ]; + //const IndexType segmentSize = sliceSegmentSizes_view[ sliceIdx ]; const IndexType begin = sliceOffsets_view[ sliceIdx ] + segmentInSliceIdx; const IndexType end = sliceOffsets_view[ sliceIdx + 1 ]; RealType aux( zero ); diff --git a/src/TNL/Containers/Segments/details/BiEllpack.h b/src/TNL/Containers/Segments/details/BiEllpack.h index 480e7a359b70b317845a4ab35705eaf7f7ab4cdc..059a6a88dfe79fcb1af4d2afad0e17a8768f0207 100644 --- a/src/TNL/Containers/Segments/details/BiEllpack.h +++ b/src/TNL/Containers/Segments/details/BiEllpack.h @@ -104,8 +104,8 @@ class BiEllpack const IndexType segmentIdx ) { const IndexType strip = segmentIdx / getWarpSize(); - const IndexType groupIdx = strip * ( getLogWarpSize() + 1 ); - const IndexType rowStripPerm = rowPermArray[ segmentIdx ] - strip * getWarpSize(); + //const IndexType groupIdx = strip * ( getLogWarpSize() + 1 ); + //const IndexType rowStripPerm = rowPermArray[ segmentIdx ] - strip * getWarpSize(); const IndexType groupsCount = getActiveGroupsCountDirect( rowPermArray, segmentIdx ); IndexType groupHeight = getWarpSize(); IndexType segmentSize = 0; @@ -125,8 +125,8 @@ class BiEllpack const IndexType segmentIdx ) { const IndexType strip = segmentIdx / getWarpSize(); - const IndexType groupIdx = strip * ( getLogWarpSize() + 1 ); - const IndexType rowStripPerm = rowPermArray.getElement( segmentIdx ) - strip * getWarpSize(); + //const IndexType groupIdx = strip * ( getLogWarpSize() + 1 ); + //const IndexType rowStripPerm = rowPermArray.getElement( segmentIdx ) - strip * getWarpSize(); const IndexType groupsCount = getActiveGroupsCount( rowPermArray, segmentIdx ); IndexType groupHeight = getWarpSize(); IndexType segmentSize = 0; diff --git a/src/TNL/Containers/Segments/details/ChunkedEllpack.h b/src/TNL/Containers/Segments/details/ChunkedEllpack.h index 692b18d5f6a09c8857330ca52a0c875b4c40d56a..33814d967902451b6ddbf47d06b173c2d2f5b2be 100644 --- a/src/TNL/Containers/Segments/details/ChunkedEllpack.h +++ b/src/TNL/Containers/Segments/details/ChunkedEllpack.h @@ -119,11 +119,12 @@ class ChunkedEllpack if( segmentIdx != slices[ sliceIndex ].firstSegment ) firstChunkOfSegment = segmentsToChunksMapping[ segmentIdx - 1 ]; - const IndexType lastChunkOfSegment = segmentsToChunksMapping[ segmentIdx ]; - const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment; + //const IndexType lastChunkOfSegment = segmentsToChunksMapping[ segmentIdx ]; + //const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment; const IndexType sliceOffset = slices[ sliceIndex ].pointer; const IndexType chunkSize = slices[ sliceIndex ].chunkSize; - TNL_ASSERT_LE( localIdx, segmentChunksCount * chunkSize, "" ); + //TNL_ASSERT_LE( localIdx, segmentChunksCount * chunkSize, "" ); + TNL_ASSERT_LE( localIdx, ( segmentsToChunksMapping[ segmentIdx ] - firstChunkOfSegment ) * chunkSize, "" ); if( Organization == RowMajorOrder ) return sliceOffset + firstChunkOfSegment * chunkSize + localIdx; @@ -148,11 +149,12 @@ class ChunkedEllpack if( segmentIdx != slices.getElement( sliceIndex ).firstSegment ) firstChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx - 1 ); - const IndexType lastChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx ); - const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment; + //const IndexType lastChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx ); + //const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment; const IndexType sliceOffset = slices.getElement( sliceIndex ).pointer; const IndexType chunkSize = slices.getElement( sliceIndex ).chunkSize; - TNL_ASSERT_LE( localIdx, segmentChunksCount * chunkSize, "" ); + //TNL_ASSERT_LE( localIdx, segmentChunksCount * chunkSize, "" ); + TNL_ASSERT_LE( localIdx, ( segmentsToChunksMapping.getElement( segmentIdx ) - firstChunkOfSegment ) * chunkSize, "" ); if( Organization == RowMajorOrder ) return sliceOffset + firstChunkOfSegment * chunkSize + localIdx; diff --git a/src/TNL/Functions/Analytic/Blob_impl.h b/src/TNL/Functions/Analytic/Blob_impl.h index f5195f758e979441a81e7dcfbcf2431705a6f8bd..6a8d8d437a7b95b520864d7e57d79da294126fed 100644 --- a/src/TNL/Functions/Analytic/Blob_impl.h +++ b/src/TNL/Functions/Analytic/Blob_impl.h @@ -47,7 +47,7 @@ Blob< 1, Real >:: getPartialDerivative( const PointType& v, const Real& time ) const { - const RealType& x = v.x(); + //const RealType& x = v.x(); if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if( XDiffOrder == 0 ) @@ -120,9 +120,9 @@ Blob< 3, Real >:: getPartialDerivative( const PointType& v, const Real& time ) const { - const RealType& x = v.x(); - const RealType& y = v.y(); - const RealType& z = v.z(); + //const RealType& x = v.x(); + //const RealType& y = v.y(); + //const RealType& z = v.z(); if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) return 0.0; return 0.0; diff --git a/src/TNL/Functions/Analytic/PseudoSquare_impl.h b/src/TNL/Functions/Analytic/PseudoSquare_impl.h index 18edb0d347709369a750c3114dc1884a912b9d84..fcfd0c39fa897bbb5b8d2218f83c0fa39fcfc49a 100644 --- a/src/TNL/Functions/Analytic/PseudoSquare_impl.h +++ b/src/TNL/Functions/Analytic/PseudoSquare_impl.h @@ -48,7 +48,7 @@ PseudoSquare< 1, Real >:: getPartialDerivative( const PointType& v, const Real& time ) const { - const RealType& x = v.x(); + //const RealType& x = v.x(); if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if( XDiffOrder == 0 ) @@ -121,9 +121,9 @@ PseudoSquare< 3, Real >:: getPartialDerivative( const PointType& v, const Real& time ) const { - const RealType& x = v.x(); - const RealType& y = v.y(); - const RealType& z = v.z(); + //const RealType& x = v.x(); + //const RealType& y = v.y(); + //const RealType& z = v.z(); if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) return 0.0; return 0.0; diff --git a/src/TNL/Functions/Analytic/Twins_impl.h b/src/TNL/Functions/Analytic/Twins_impl.h index 7b2ce41c7c2543a20d7b3750f406be241fca490c..e31c94ef132e3a95f2e268f7fd902b75514f877f 100644 --- a/src/TNL/Functions/Analytic/Twins_impl.h +++ b/src/TNL/Functions/Analytic/Twins_impl.h @@ -46,7 +46,7 @@ Real Twins< 1, Real >::getPartialDerivative( const Point& v, const Real& time ) const { - const RealType& x = v.x(); + //const RealType& x = v.x(); if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if( XDiffOrder == 0 ) @@ -123,9 +123,9 @@ Twins< 3, Real >:: getPartialDerivative( const Point& v, const Real& time ) const { - const RealType& x = v.x(); - const RealType& y = v.y(); - const RealType& z = v.z(); + //const RealType& x = v.x(); + //const RealType& y = v.y(); + //const RealType& z = v.z(); if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) return 0.0; return 0.0; diff --git a/src/TNL/Images/JPEGImage_impl.h b/src/TNL/Images/JPEGImage_impl.h index 324f00c5746f25dfb0b4284ef2e163dad4e45ee9..a703f9c5122f44c0c940aa704480bd448b64d99d 100644 --- a/src/TNL/Images/JPEGImage_impl.h +++ b/src/TNL/Images/JPEGImage_impl.h @@ -143,7 +143,7 @@ read( const RegionOfInterest< Index > roi, // roi.getBottom() - 1 - i ) ); cell.refresh(); unsigned char char_color[ 4 ]; - unsigned int int_color[ 4 ]; + //unsigned int int_color[ 4 ]; Real value, r, g, b; switch( this->components ) { diff --git a/src/TNL/Images/PNGImage_impl.h b/src/TNL/Images/PNGImage_impl.h index 8d1508185c69ba2ea36699a09c0cb64b0825b0d3..d6aa3cedde9a90e6048cbe160fe5f20400b20d90 100644 --- a/src/TNL/Images/PNGImage_impl.h +++ b/src/TNL/Images/PNGImage_impl.h @@ -253,7 +253,7 @@ writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid ) */ //png_set_compression_level( this->png_ptr, Z_BEST_COMPRESSION ); - const int bitDepth( 8 ); + //const int bitDepth( 8 ); png_set_IHDR( this->png_ptr, this->info_ptr, grid.getDimensions().x(), diff --git a/src/TNL/Matrices/DistributedMatrix.h b/src/TNL/Matrices/DistributedMatrix.h index 98cade7ce77859fa2c1a293354ae258d12f676b3..02a181c02cbf0122092c58c37b47fa781bdebe16 100644 --- a/src/TNL/Matrices/DistributedMatrix.h +++ b/src/TNL/Matrices/DistributedMatrix.h @@ -102,7 +102,7 @@ public: __cuda_callable__ IndexType getColumns() const; - void setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ); + void setRowCapacities( const CompressedRowLengthsVector& rowLengths ); template< typename Vector > void getCompressedRowLengths( Vector& rowLengths ) const; diff --git a/src/TNL/Matrices/DistributedMatrix_impl.h b/src/TNL/Matrices/DistributedMatrix_impl.h index 38b7f3af0aec7168cafaee600ebfc332c96925f6..1cc033bf3279407f998e02fdc4d4eb6d6767ea93 100644 --- a/src/TNL/Matrices/DistributedMatrix_impl.h +++ b/src/TNL/Matrices/DistributedMatrix_impl.h @@ -151,14 +151,14 @@ template< typename Matrix, typename Communicator > void DistributedMatrix< Matrix, Communicator >:: -setCompressedRowLengths( const CompressedRowLengthsVector& rowLengths ) +setRowCapacities( const CompressedRowLengthsVector& rowLengths ) { TNL_ASSERT_EQ( rowLengths.getSize(), getRows(), "row lengths vector has wrong size" ); TNL_ASSERT_EQ( rowLengths.getLocalRange(), getLocalRowRange(), "row lengths vector has wrong distribution" ); TNL_ASSERT_EQ( rowLengths.getCommunicationGroup(), getCommunicationGroup(), "row lengths vector has wrong communication group" ); if( getCommunicationGroup() != CommunicatorType::NullGroup ) { - localMatrix.setCompressedRowLengths( rowLengths.getConstLocalView() ); + localMatrix.setRowCapacities( rowLengths.getConstLocalView() ); spmv.reset(); } diff --git a/src/TNL/Matrices/Legacy/CSR_impl.h b/src/TNL/Matrices/Legacy/CSR_impl.h index bb3dfae7935031ae930dcecea45320bab84b2098..3774b3bd811097283271e15ea8b5e4fb04559fee 100644 --- a/src/TNL/Matrices/Legacy/CSR_impl.h +++ b/src/TNL/Matrices/Legacy/CSR_impl.h @@ -825,9 +825,9 @@ void CSR< Real, Device, Index, KernelType >::spmvCSRAdaptive( const InVector& in constexpr size_t SHARED = 49152/sizeof(float); constexpr size_t SHARED_PER_WARP = SHARED / warpSize; constexpr size_t MAX_PER_WARP = 65536; - constexpr size_t ELEMENTS_PER_WARP = 1024; - constexpr size_t THREADS_PER_BLOCK = 1024; - constexpr size_t WARPS_PER_BLOCK = THREADS_PER_BLOCK / warpSize; + //constexpr size_t ELEMENTS_PER_WARP = 1024; + //constexpr size_t THREADS_PER_BLOCK = 1024; + //constexpr size_t WARPS_PER_BLOCK = THREADS_PER_BLOCK / warpSize; //-------------------------------------------------------------------- const IndexType index = blockIdx.x * blockDim.x + threadIdx.x; const IndexType laneID = index % warpSize; @@ -881,9 +881,9 @@ void CSR< Real, Device, Index, KernelType >::spmvCSRAdaptive( const InVector& in if (laneID == 0) outVector[minRow] = result; // Write result } else { /////////////////////////////////////* CSR VECTOR LONG *////////////// - const size_t warps = (elements - ELEMENTS_PER_WARP) / ELEMENTS_PER_WARP + 1; - const size_t blocks = warps <= WARPS_PER_BLOCK ? 1 : warps / WARPS_PER_BLOCK + 1; - const size_t threads_per_block = blocks == 1 ? warps * warpSize : WARPS_PER_BLOCK * warpSize; + //const size_t warps = (elements - ELEMENTS_PER_WARP) / ELEMENTS_PER_WARP + 1; + //const size_t blocks = warps <= WARPS_PER_BLOCK ? 1 : warps / WARPS_PER_BLOCK + 1; + //const size_t threads_per_block = blocks == 1 ? warps * warpSize : WARPS_PER_BLOCK * warpSize; // spmvCSRVectorHelper <<>>( // inVector, // &outVector[minRow], @@ -1088,15 +1088,16 @@ void CSRVectorProductCuda( const CSR< Real, Devices::Cuda, Index, KernelType >& cudaMemcpy(kernelBlocks, blocks, size * sizeof(int), cudaMemcpyHostToDevice); TNL_CHECK_CUDA_DEVICE; - dim3 cudaBlockSize( 256 ), cudaGridSize( Cuda::getMaxGridSize() ); + dim3 cudaBlockSize( 256 ); + //dim3 cudaGridSize( Cuda::getMaxGridSize() ); const IndexType cudaBlocks = roundUpDivision( matrix.getRows(), cudaBlockSize.x ); const IndexType cudaGrids = roundUpDivision( cudaBlocks, Cuda::getMaxGridSize() ); for( IndexType gridIdx = 0; gridIdx < cudaGrids; gridIdx++ ) { - if( gridIdx == cudaGrids - 1 ) - cudaGridSize.x = cudaBlocks % Cuda::getMaxGridSize(); - const int sharedMemory = cudaBlockSize.x * sizeof( Real ); - // const int threads = cudaBlockSize.x; + //if( gridIdx == cudaGrids - 1 ) + // cudaGridSize.x = cudaBlocks % Cuda::getMaxGridSize(); + //const int sharedMemory = cudaBlockSize.x * sizeof( Real ); + //const int threads = cudaBlockSize.x; if( matrix.getCudaWarpSize() == 32 ) { // printf("BL %d BLSIZE %d\n", (int)cudaBlocks, (int)threads); CSRVectorProductCudaKernel< Real, Index, KernelType, InVector, OutVector, 32 > diff --git a/src/TNL/Matrices/Legacy/ChunkedEllpack_impl.h b/src/TNL/Matrices/Legacy/ChunkedEllpack_impl.h index 2de0a252c870f4bae1ac28c7c7179e09ad24c890..ec05515fdf128c32b9f43547f015757ff7689a83 100644 --- a/src/TNL/Matrices/Legacy/ChunkedEllpack_impl.h +++ b/src/TNL/Matrices/Legacy/ChunkedEllpack_impl.h @@ -1324,9 +1324,9 @@ void ChunkedEllpack< Real, Device, Index >::print( std::ostream& str ) const { str <<"Row: " << row << " -> "; - const IndexType& sliceIndex = rowToSliceMapping.getElement( row ); + //const IndexType& sliceIndex = rowToSliceMapping.getElement( row ); //TNL_ASSERT( sliceIndex < this->rows, ); - const IndexType& chunkSize = slices.getElement( sliceIndex ).chunkSize; + //const IndexType& chunkSize = slices.getElement( sliceIndex ).chunkSize; IndexType elementPtr = rowPointers.getElement( row ); const IndexType rowEnd = rowPointers.getElement( row + 1 ); diff --git a/src/TNL/Matrices/Legacy/Ellpack_impl.h b/src/TNL/Matrices/Legacy/Ellpack_impl.h index 2fb582f6039a61ca0fce2dd10d9772a010806c6c..39e27f8f9eb6e42417bedf7d8ed9b48b2435968e 100644 --- a/src/TNL/Matrices/Legacy/Ellpack_impl.h +++ b/src/TNL/Matrices/Legacy/Ellpack_impl.h @@ -354,7 +354,7 @@ bool Ellpack< Real, Device, Index > :: setRow( const IndexType row, { typedef EllpackDeviceDependentCode< DeviceType > DDCType; IndexType elementPointer = DDCType::getRowBegin( *this, row ); - const IndexType rowEnd = DDCType::getRowEnd( *this, row ); + //const IndexType rowEnd = DDCType::getRowEnd( *this, row ); const IndexType step = DDCType::getElementStep( *this ); if( elements > this->rowLengths ) @@ -574,7 +574,7 @@ bool Ellpack< Real, Device, Index > :: performSORIteration( const Vector1& b, IndexType i = DeviceDependentCode::getRowBegin( *this, row ); const IndexType rowEnd = DeviceDependentCode::getRowEnd( *this, row ); - const IndexType step = DeviceDependentCode::getElementStep( *this ); + //const IndexType step = DeviceDependentCode::getElementStep( *this ); IndexType column; while( i < rowEnd && ( column = this->columnIndexes[ i ] ) < this->columns ) @@ -614,7 +614,7 @@ performJacobiIteration( const Vector& b, IndexType i = DeviceDependentCode::getRowBegin( *this, row ); const IndexType rowEnd = DeviceDependentCode::getRowEnd( *this, row ); - const IndexType step = DeviceDependentCode::getElementStep( *this ); + //const IndexType step = DeviceDependentCode::getElementStep( *this ); IndexType column; while( i < rowEnd && ( column = this->columnIndexes[ i ] ) < this->columns ) @@ -779,7 +779,7 @@ template< typename Real, typename Index > void Ellpack< Real, Device, Index >::allocateElements() { - IndexType numMtxElmnts = this->alignedRows * this->rowLengths; + const IndexType numMtxElmnts = this->alignedRows * this->rowLengths; if( this->alignedRows != 0 ) { @@ -787,7 +787,7 @@ void Ellpack< Real, Device, Index >::allocateElements() "Ellpack cannot store this matrix. The number of matrix elements has overflown the value that IndexType is capable of storing" ); } - Sparse< Real, Device, Index >::allocateMatrixElements( this->alignedRows * this->rowLengths ); + Sparse< Real, Device, Index >::allocateMatrixElements( numMtxElmnts ); } template<> diff --git a/src/TNL/Matrices/SparseMatrix.hpp b/src/TNL/Matrices/SparseMatrix.hpp index d60d49611dbfff4cad01049d8fdc4ed7657b19cc..8caced0224b047e2dc5ab5925623421fc52f9d27 100644 --- a/src/TNL/Matrices/SparseMatrix.hpp +++ b/src/TNL/Matrices/SparseMatrix.hpp @@ -218,7 +218,7 @@ void SparseMatrix< Real, Device, Index, MatrixType, Segments, RealAllocator, IndexAllocator >:: setRowCapacities( const RowsCapacitiesVector& rowsCapacities ) { - TNL_ASSERT_EQ( rowsCapacities.getSize(), this->getRows(), "Number of matrix rows does not fit with rowLengths vector size." ); + TNL_ASSERT_EQ( rowsCapacities.getSize(), this->getRows(), "Number of matrix rows does not fit with rowCapacities vector size." ); using RowsCapacitiesVectorDevice = typename RowsCapacitiesVector::DeviceType; if( std::is_same< DeviceType, RowsCapacitiesVectorDevice >::value ) this->segments.setSegmentsSizes( rowsCapacities ); @@ -263,7 +263,7 @@ setElements( const std::initializer_list< std::tuple< IndexType, IndexType, Real rowCapacities[ std::get< 0 >( i ) ]++; } SparseMatrix< Real, Devices::Host, Index, MatrixType, Segments > hostMatrix( rows, columns ); - hostMatrix.setCompressedRowLengths( rowCapacities ); + hostMatrix.setRowCapacities( rowCapacities ); for( const auto& i : data ) { if( std::get< 1 >( i ) >= columns ) @@ -296,14 +296,14 @@ setElements( const std::map< std::pair< MapIndex, MapIndex > , MapValue >& map ) if( !std::is_same< DeviceType, Devices::Host >::value ) { SparseMatrix< Real, Devices::Host, Index, MatrixType, Segments > hostMatrix( this->getRows(), this->getColumns() ); - hostMatrix.setCompressedRowLengths( rowsCapacities ); + hostMatrix.setRowCapacities( rowsCapacities ); for( auto element : map ) hostMatrix.setElement( element.first.first, element.first.second, element.second ); *this = hostMatrix; } else { - this->setCompressedRowLengths( rowsCapacities ); + this->setRowCapacities( rowsCapacities ); for( auto element : map ) this->setElement( element.first.first, element.first.second, element.second ); } @@ -677,7 +677,7 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato Containers::Vector< RHSIndexType, RHSDeviceType, RHSIndexType > rowLengths; matrix.getCompressedRowLengths( rowLengths ); this->setLike( matrix ); - this->setCompressedRowLengths( rowLengths ); + this->setRowCapacities( rowLengths ); Containers::Vector< IndexType, DeviceType, IndexType > rowLocalIndexes( matrix.getRows() ); rowLocalIndexes = 0; @@ -787,7 +787,7 @@ operator=( const RHSMatrix& matrix ) Containers::Vector< RHSIndexType, RHSDeviceType, RHSIndexType > rowLengths; matrix.getCompressedRowLengths( rowLengths ); this->setDimensions( matrix.getRows(), matrix.getColumns() ); - this->setCompressedRowLengths( rowLengths ); + this->setRowCapacities( rowLengths ); Containers::Vector< IndexType, DeviceType, IndexType > rowLocalIndexes( matrix.getRows() ); rowLocalIndexes = 0; @@ -861,7 +861,7 @@ operator=( const RHSMatrix& matrix ) //// // Copy matrix elements from the buffer to the matrix and ignoring // zero matrix elements - const IndexType matrix_columns = this->getColumns(); + //const IndexType matrix_columns = this->getColumns(); const auto thisRowLengths_view = thisRowLengths.getConstView(); auto f2 = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIndex, RealType& value, bool& compute ) mutable { RealType inValue( 0.0 ); diff --git a/src/TNL/Matrices/SparseMatrixView.hpp b/src/TNL/Matrices/SparseMatrixView.hpp index 5475faa56aed9c2c50128e8f0fdd3da4e1c94187..d63e991b248357373e82afe20c6d8f217304d8cf 100644 --- a/src/TNL/Matrices/SparseMatrixView.hpp +++ b/src/TNL/Matrices/SparseMatrixView.hpp @@ -508,7 +508,7 @@ forRows( IndexType begin, IndexType end, Function& function ) const { const auto columns_view = this->columnIndexes.getConstView(); const auto values_view = this->values.getConstView(); - const IndexType paddingIndex_ = this->getPaddingIndex(); + //const IndexType paddingIndex_ = this->getPaddingIndex(); auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable -> bool { if( isBinary() ) function( rowIdx, localIdx, columns_view[ globalIdx ], 1, compute ); diff --git a/src/TNL/Matrices/SparseOperations_impl.h b/src/TNL/Matrices/SparseOperations_impl.h index 97f86c4eec8e60b5f7cf95cfd8996e549885826a..43899e4f3522f2ef7a359448f1c2abf355b11e9c 100644 --- a/src/TNL/Matrices/SparseOperations_impl.h +++ b/src/TNL/Matrices/SparseOperations_impl.h @@ -285,7 +285,7 @@ reorderSparseMatrix( const Matrix1& matrix1, Matrix2& matrix2, const Permutation length++; rowLengths[ i ] = length; } - matrix2.setCompressedRowLengths( rowLengths ); + matrix2.setRowCapacities( rowLengths ); // set row elements for( IndexType i = 0; i < matrix2.getRows(); i++ ) { diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedGridIO_MeshFunction.h b/src/TNL/Meshes/DistributedMeshes/DistributedGridIO_MeshFunction.h index 3d7c6e5cdf72f292b76571b6eda2acf8dcda3da6..0282d10a93d8958419cf26f577e991a7c269ce69 100644 --- a/src/TNL/Meshes/DistributedMeshes/DistributedGridIO_MeshFunction.h +++ b/src/TNL/Meshes/DistributedMeshes/DistributedGridIO_MeshFunction.h @@ -166,7 +166,8 @@ class DistributedGridIO_MPIIOBase MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &file); - TNL_ASSERT_EQ(ok,0,"Open file falied"); + if( ok != 0 ) + throw std::runtime_error("Open file falied"); int written=save(file,meshFunction, data,0); diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h b/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h index dfe572deaef83426094525835f656ce4ae40b8a7..ac8232f2639b26c6642b062422b8a49c1447a133 100644 --- a/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h +++ b/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h @@ -83,7 +83,6 @@ class DistributedMeshSynchronizer< Functions::MeshFunction< Grid< MeshDimension, const CoordinatesType& localBegin = this->distributedGrid->getLocalBegin(); const CoordinatesType& localSize = this->distributedGrid->getLocalSize(); - const CoordinatesType& localGridSize = this->distributedGrid->getLocalGridSize(); const int *neighbors = distributedGrid->getNeighbors(); diff --git a/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h b/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h index 9a8a2b062e913e423ea53ba75ef1b7388792f8ec..858dd376385b1a2eb3ff7c06dfb19e27f5538551 100644 --- a/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h +++ b/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h @@ -181,7 +181,7 @@ processAllEntities( const GridPointer& gridPointer, } else { - const int* neighbors=distributedGrid->getNeighbors(); + //const int* neighbors=distributedGrid->getNeighbors(); CoordinatesType begin( distributedGrid->getLowerOverlap() ); CoordinatesType end( gridPointer->getDimensions() - distributedGrid->getUpperOverlap()- CoordinatesType(1,1) ); diff --git a/src/TNL/Operators/NeumannBoundaryConditions.h b/src/TNL/Operators/NeumannBoundaryConditions.h index 3b6d48fa18c186abd83bba63100576e34c6f1369..baa52db08fbefb4db06e3a50fd65c47160a7f1c7 100644 --- a/src/TNL/Operators/NeumannBoundaryConditions.h +++ b/src/TNL/Operators/NeumannBoundaryConditions.h @@ -119,9 +119,9 @@ class NeumannBoundaryConditions< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, const EntityType& entity, const RealType& time = 0 ) const { - const MeshType& mesh = entity.getMesh(); + //const MeshType& mesh = entity.getMesh(); const auto& neighborEntities = entity.getNeighborEntities(); - const IndexType& index = entity.getIndex(); + //const IndexType& index = entity.getIndex(); if( entity.getCoordinates().x() == 0 ) return u[ neighborEntities.template getEntityIndex< 1 >() ] + entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); @@ -212,9 +212,9 @@ class NeumannBoundaryConditions< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, const EntityType& entity, const RealType& time = 0 ) const { - const MeshType& mesh = entity.getMesh(); + //const MeshType& mesh = entity.getMesh(); const auto& neighborEntities = entity.getNeighborEntities(); - const IndexType& index = entity.getIndex(); + //const IndexType& index = entity.getIndex(); if( entity.getCoordinates().x() == 0 ) { return u[ neighborEntities.template getEntityIndex< 1, 0 >() ] + entity.getMesh().getSpaceSteps().x() * @@ -330,9 +330,9 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, const EntityType& entity, const RealType& time = 0 ) const { - const MeshType& mesh = entity.getMesh(); + //const MeshType& mesh = entity.getMesh(); const auto& neighborEntities = entity.getNeighborEntities(); - const IndexType& index = entity.getIndex(); + //const IndexType& index = entity.getIndex(); if( entity.getCoordinates().x() == 0 ) { return u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] + entity.getMesh().getSpaceSteps().x() * diff --git a/src/TNL/Problems/HeatEquationProblem_impl.h b/src/TNL/Problems/HeatEquationProblem_impl.h index fbb7e7d01084385b0ee111d3aa090163550c0ffc..5038e76528f2234b75826789613b48b21148cdc2 100644 --- a/src/TNL/Problems/HeatEquationProblem_impl.h +++ b/src/TNL/Problems/HeatEquationProblem_impl.h @@ -123,7 +123,7 @@ void HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, Communicator, DifferentialOperator >:: bindDofs( const DofVectorPointer& dofVector ) { - const IndexType dofs = this->getMesh()->template getEntitiesCount< typename MeshType::Cell >(); + //const IndexType dofs = this->getMesh()->template getEntitiesCount< typename MeshType::Cell >(); this->uPointer->bind( this->getMesh(), dofVector ); } @@ -189,7 +189,7 @@ setupLinearSystem( MatrixPointer& matrixPointer ) boundaryConditionPointer, rowLengthsPointer ); matrixPointer->setDimensions( dofs, dofs ); - matrixPointer->setCompressedRowLengths( *rowLengthsPointer ); + matrixPointer->setRowCapacities( *rowLengthsPointer ); return true; } diff --git a/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h b/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h index 48807addfbe91837f55f47a4cb9fe60dafe3b023..c44c4ecdf9b05e7ebcf1e9e06b6ed4acb4e930db 100644 --- a/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h +++ b/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h @@ -138,7 +138,7 @@ setupLinearSystem( const MeshType& mesh, rowLengths ); matrix.setDimensions( dofs, dofs ); - matrix.setCompressedRowLengths( rowLengths ); + matrix.setRowCapacities( rowLengths ); return true; } diff --git a/src/TNL/Solvers/Linear/Preconditioners/ILU0_impl.h b/src/TNL/Solvers/Linear/Preconditioners/ILU0_impl.h index acf2ce129df7d853806ab3de6dee2338c88860b6..e224e1e72c1c5c815f488dc9355591bf8a0b5608 100644 --- a/src/TNL/Solvers/Linear/Preconditioners/ILU0_impl.h +++ b/src/TNL/Solvers/Linear/Preconditioners/ILU0_impl.h @@ -59,8 +59,8 @@ update( const MatrixPointer& matrixPointer ) L_rowLengths[ i ] = L_entries; U_rowLengths[ N - 1 - i ] = U_entries; } - L.setCompressedRowLengths( L_rowLengths ); - U.setCompressedRowLengths( U_rowLengths ); + L.setRowCapacities( L_rowLengths ); + U.setRowCapacities( U_rowLengths ); // Incomplete LU factorization // The factors L and U are stored separately and the rows of U are reversed. diff --git a/src/TNL/Solvers/Linear/Preconditioners/ILUT_impl.h b/src/TNL/Solvers/Linear/Preconditioners/ILUT_impl.h index 29b173b250b5a0eb47801d3f5e8b36b908dd6cac..c9c2a0b7768d1a0da4ba11460a2e0fa0c67eb068 100644 --- a/src/TNL/Solvers/Linear/Preconditioners/ILUT_impl.h +++ b/src/TNL/Solvers/Linear/Preconditioners/ILUT_impl.h @@ -78,8 +78,8 @@ update( const MatrixPointer& matrixPointer ) L_rowLengths[ i ] = L_entries + p; U_rowLengths[ N - 1 - i ] = U_entries + p; } - L.setCompressedRowLengths( L_rowLengths ); - U.setCompressedRowLengths( U_rowLengths ); + L.setRowCapacities( L_rowLengths ); + U.setRowCapacities( U_rowLengths ); // timer_rowlengths.stop(); // intermediate full vector for the i-th row of A diff --git a/src/UnitTests/Containers/VectorBinaryOperationsTest.h b/src/UnitTests/Containers/VectorBinaryOperationsTest.h index e8932d3e4ad2e0426746a8e647b742aa5c875cd5..46833c235b55a733f53b7fb93bff11f5daaca721 100644 --- a/src/UnitTests/Containers/VectorBinaryOperationsTest.h +++ b/src/UnitTests/Containers/VectorBinaryOperationsTest.h @@ -94,9 +94,6 @@ protected: using LocalRangeType = typename LeftVector::LocalRangeType; const LocalRangeType localRange = Partitioner< typename Left::IndexType, CommunicatorType >::splitRange( size, group ); - const int rank = CommunicatorType::GetRank(group); - const int nproc = CommunicatorType::GetSize(group); - _L1.setDistribution( localRange, size, group ); _L2.setDistribution( localRange, size, group ); _R1.setDistribution( localRange, size, group ); @@ -130,6 +127,8 @@ protected: #pragma diag_suppress = declared_but_not_referenced #endif +#define MAYBE_UNUSED(expr) (void)(expr) + #define SETUP_BINARY_TEST_ALIASES \ using Left = typename TestFixture::Left; \ using Right = typename TestFixture::Right; \ @@ -137,6 +136,10 @@ protected: Left& L2 = this->L2; \ Right& R1 = this->R1; \ Right& R2 = this->R2; \ + MAYBE_UNUSED(L1); \ + MAYBE_UNUSED(L2); \ + MAYBE_UNUSED(R1); \ + MAYBE_UNUSED(R2); \ // types for which VectorBinaryOperationsTest is instantiated #if defined(DISTRIBUTED_VECTOR) diff --git a/src/UnitTests/Containers/VectorUnaryOperationsTest.h b/src/UnitTests/Containers/VectorUnaryOperationsTest.h index aa595d8e97be4f34b9275adaf55cae182819fc02..9baea01c51d97cecb35136669c089cff7ce47521 100644 --- a/src/UnitTests/Containers/VectorUnaryOperationsTest.h +++ b/src/UnitTests/Containers/VectorUnaryOperationsTest.h @@ -142,7 +142,6 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes ); #ifdef STATIC_VECTOR #define SETUP_UNARY_VECTOR_TEST( _ ) \ using VectorOrView = typename TestFixture::VectorOrView; \ - constexpr int size = VectorOrView::getSize(); \ \ VectorOrView V1, V2; \ \ @@ -153,13 +152,13 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes ); using VectorOrView = typename TestFixture::VectorOrView; \ using RealType = typename VectorOrView::RealType; \ using ExpectedVector = typename TestFixture::template Vector< decltype(function(RealType{})) >; \ - constexpr int size = VectorOrView::getSize(); \ + constexpr int _size = VectorOrView::getSize(); \ \ VectorOrView V1; \ ExpectedVector expected; \ \ - const double h = (double) (end - begin) / size; \ - for( int i = 0; i < size; i++ ) \ + const double h = (double) (end - begin) / _size; \ + for( int i = 0; i < _size; i++ ) \ { \ const RealType x = begin + i * h; \ V1[ i ] = x; \ @@ -167,18 +166,14 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes ); } \ #elif defined(DISTRIBUTED_VECTOR) - #define SETUP_UNARY_VECTOR_TEST( _size ) \ + #define SETUP_UNARY_VECTOR_TEST( size ) \ using VectorType = typename TestFixture::VectorType; \ using VectorOrView = typename TestFixture::VectorOrView; \ - constexpr int size = _size; \ using CommunicatorType = typename VectorOrView::CommunicatorType; \ const auto group = CommunicatorType::AllGroup; \ using LocalRangeType = typename VectorOrView::LocalRangeType; \ const LocalRangeType localRange = Partitioner< typename VectorOrView::IndexType, CommunicatorType >::splitRange( size, group ); \ \ - const int rank = CommunicatorType::GetRank(group); \ - const int nproc = CommunicatorType::GetSize(group); \ - \ VectorType _V1, _V2; \ _V1.setDistribution( localRange, size, group ); \ _V2.setDistribution( localRange, size, group ); \ @@ -188,14 +183,13 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes ); \ VectorOrView V1( _V1 ), V2( _V2 ); \ - #define SETUP_UNARY_VECTOR_TEST_FUNCTION( _size, begin, end, function ) \ + #define SETUP_UNARY_VECTOR_TEST_FUNCTION( size, begin, end, function ) \ using VectorType = typename TestFixture::VectorType; \ using VectorOrView = typename TestFixture::VectorOrView; \ using RealType = typename VectorType::RealType; \ using ExpectedVector = typename TestFixture::template Vector< decltype(function(RealType{})) >; \ using HostVector = typename VectorType::template Self< RealType, Devices::Host >; \ using HostExpectedVector = typename ExpectedVector::template Self< decltype(function(RealType{})), Devices::Host >; \ - constexpr int size = _size; \ using CommunicatorType = typename VectorOrView::CommunicatorType; \ const auto group = CommunicatorType::AllGroup; \ using LocalRangeType = typename VectorOrView::LocalRangeType; \ @@ -219,10 +213,9 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes ); ExpectedVector expected; expected = expected_h; \ #else - #define SETUP_UNARY_VECTOR_TEST( _size ) \ + #define SETUP_UNARY_VECTOR_TEST( size ) \ using VectorType = typename TestFixture::VectorType; \ using VectorOrView = typename TestFixture::VectorOrView; \ - constexpr int size = _size; \ \ VectorType _V1( size ), _V2( size ); \ \ @@ -231,14 +224,13 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes ); \ VectorOrView V1( _V1 ), V2( _V2 ); \ - #define SETUP_UNARY_VECTOR_TEST_FUNCTION( _size, begin, end, function ) \ + #define SETUP_UNARY_VECTOR_TEST_FUNCTION( size, begin, end, function ) \ using VectorType = typename TestFixture::VectorType; \ using VectorOrView = typename TestFixture::VectorOrView; \ using RealType = typename VectorType::RealType; \ using ExpectedVector = typename TestFixture::template Vector< decltype(function(RealType{})) >; \ using HostVector = typename VectorType::template Self< RealType, Devices::Host >; \ using HostExpectedVector = typename ExpectedVector::template Self< decltype(function(RealType{})), Devices::Host >; \ - constexpr int size = _size; \ \ HostVector _V1h( size ); \ HostExpectedVector expected_h( size ); \ diff --git a/src/UnitTests/Containers/VectorVerticalOperationsTest.h b/src/UnitTests/Containers/VectorVerticalOperationsTest.h index 0650e3154a74830afd6ca24e2640df2f0ebe0b0e..e987cb8fd91e185d4c586e309604d6a5dcc7ef36 100644 --- a/src/UnitTests/Containers/VectorVerticalOperationsTest.h +++ b/src/UnitTests/Containers/VectorVerticalOperationsTest.h @@ -80,9 +80,6 @@ protected: using LocalRangeType = typename VectorOrView::LocalRangeType; const LocalRangeType localRange = Partitioner< typename VectorOrView::IndexType, CommunicatorType >::splitRange( size, group ); - const int rank = CommunicatorType::GetRank(group); - const int nproc = CommunicatorType::GetSize(group); - _V1.setDistribution( localRange, size, group ); #else _V1.setSize( size ); diff --git a/src/UnitTests/Matrices/BinarySparseMatrixTest.hpp b/src/UnitTests/Matrices/BinarySparseMatrixTest.hpp index 8d532ae7123b49f592b47a268ffc0bc3230580ab..99773f3b8eb7ca6e01c42ac4384e0c50078264f2 100644 --- a/src/UnitTests/Matrices/BinarySparseMatrixTest.hpp +++ b/src/UnitTests/Matrices/BinarySparseMatrixTest.hpp @@ -827,7 +827,6 @@ void test_VectorProduct() rowLengths_5.setElement(7, 8); m_5.setCompressedRowLengths( rowLengths_5 ); - RealType value_5 = 1; for( IndexType i = 0; i < 3; i++ ) // 0th row m_5.setElement( 0, i, 1 ); diff --git a/src/UnitTests/Matrices/DistributedMatrixTest.h b/src/UnitTests/Matrices/DistributedMatrixTest.h index d030777a696ce36a6808d2f13cc556802688cb59..30a76f86a60c707926c6f2b7aa88de08964477c0 100644 --- a/src/UnitTests/Matrices/DistributedMatrixTest.h +++ b/src/UnitTests/Matrices/DistributedMatrixTest.h @@ -30,21 +30,21 @@ void setLinearSequence( Vector& deviceVector, typename Vector::RealType offset = deviceVector = a; } -template< typename Matrix, typename RowLengths > -void setMatrix( Matrix& matrix, const RowLengths& rowLengths ) +template< typename Matrix, typename RowCapacities > +void setMatrix( Matrix& matrix, const RowCapacities& rowCapacities ) { using HostMatrix = Matrices::DistributedMatrix< typename Matrix::MatrixType::template Self< typename Matrix::RealType, TNL::Devices::Sequential >, typename Matrix::CommunicatorType >; - using HostRowLengths = typename RowLengths::template Self< typename RowLengths::RealType, TNL::Devices::Sequential >; + using HostRowCapacities = typename RowCapacities::template Self< typename RowCapacities::RealType, TNL::Devices::Sequential >; HostMatrix hostMatrix; - HostRowLengths hostRowLengths; + HostRowCapacities hostRowCapacities; hostMatrix.setLike( matrix ); - hostRowLengths = rowLengths; - hostMatrix.setCompressedRowLengths( hostRowLengths ); + hostRowCapacities = rowCapacities; + hostMatrix.setRowCapacities( hostRowCapacities ); for( int i = 0; i < hostMatrix.getLocalMatrix().getRows(); i++ ) { const auto gi = hostMatrix.getLocalRowRange().getGlobalIndex( i ); - for( int j = 0; j < hostRowLengths[ gi ]; j++ ) + for( int j = 0; j < hostRowCapacities[ gi ]; j++ ) hostMatrix.setElement( gi, hostMatrix.getColumns() - j - 1, 1 ); } @@ -70,7 +70,7 @@ protected: using IndexType = typename DistributedMatrix::IndexType; using DistributedMatrixType = DistributedMatrix; - using RowLengthsVector = typename DistributedMatrixType::CompressedRowLengthsVector; + using RowCapacitiesVector = typename DistributedMatrixType::CompressedRowLengthsVector; using GlobalVector = Containers::Vector< RealType, DeviceType, IndexType >; using DistributedVector = Containers::DistributedVector< RealType, DeviceType, IndexType, CommunicatorType >; @@ -83,19 +83,19 @@ protected: DistributedMatrixType matrix; - RowLengthsVector rowLengths; + RowCapacitiesVector rowCapacities; DistributedMatrixTest() { using LocalRangeType = typename DistributedMatrix::LocalRangeType; const LocalRangeType localRange = Containers::Partitioner< IndexType, CommunicatorType >::splitRange( globalSize, group ); matrix.setDistribution( localRange, globalSize, globalSize, group ); - rowLengths.setDistribution( localRange, globalSize, group ); + rowCapacities.setDistribution( localRange, globalSize, group ); EXPECT_EQ( matrix.getLocalRowRange(), localRange ); EXPECT_EQ( matrix.getCommunicationGroup(), group ); - setLinearSequence( rowLengths, 1 ); + setLinearSequence( rowCapacities, 1 ); } }; @@ -148,14 +148,14 @@ TYPED_TEST( DistributedMatrixTest, reset ) EXPECT_EQ( this->matrix.getLocalMatrix().getRows(), 0 ); } -TYPED_TEST( DistributedMatrixTest, setCompressedRowLengths ) +TYPED_TEST( DistributedMatrixTest, setRowCapacities ) { for( int i = 0; i < this->matrix.getLocalMatrix().getRows(); i++ ) { const auto gi = this->matrix.getLocalRowRange().getGlobalIndex( i ); EXPECT_EQ( this->matrix.getRowCapacity( gi ), 0 ); EXPECT_EQ( this->matrix.getLocalMatrix().getRowCapacity( i ), 0 ); } - this->matrix.setCompressedRowLengths( this->rowLengths ); + this->matrix.setRowCapacities( this->rowCapacities ); for( int i = 0; i < this->matrix.getLocalMatrix().getRows(); i++ ) { const auto gi = this->matrix.getLocalRowRange().getGlobalIndex( i ); EXPECT_EQ( this->matrix.getRowCapacity( gi ), gi + 1 ); @@ -165,10 +165,10 @@ TYPED_TEST( DistributedMatrixTest, setCompressedRowLengths ) TYPED_TEST( DistributedMatrixTest, getCompressedRowLengths ) { - using RowLengthsVector = typename TestFixture::RowLengthsVector; + using RowCapacitiesVector = typename TestFixture::RowCapacitiesVector; - this->matrix.setCompressedRowLengths( this->rowLengths ); - RowLengthsVector output; + this->matrix.setRowCapacities( this->rowCapacities ); + RowCapacitiesVector output; this->matrix.getCompressedRowLengths( output ); // zero row lengths because the matrix is empty EXPECT_EQ( output, 0 ); @@ -176,7 +176,7 @@ TYPED_TEST( DistributedMatrixTest, getCompressedRowLengths ) const auto gi = this->matrix.getLocalRowRange().getGlobalIndex( i ); output.setElement( gi, this->matrix.getRowCapacity( gi ) ); } - EXPECT_EQ( output, this->rowLengths ); + EXPECT_EQ( output, this->rowCapacities ); } TYPED_TEST( DistributedMatrixTest, setGetElement ) @@ -186,15 +186,15 @@ TYPED_TEST( DistributedMatrixTest, setGetElement ) if( std::is_same< typename TestFixture::DeviceType, Devices::Cuda >::value ) return; - this->matrix.setCompressedRowLengths( this->rowLengths ); + this->matrix.setRowCapacities( this->rowCapacities ); for( int i = 0; i < this->matrix.getLocalMatrix().getRows(); i++ ) { const auto gi = this->matrix.getLocalRowRange().getGlobalIndex( i ); - for( int j = 0; j < this->rowLengths.getElement( gi ); j++ ) + for( int j = 0; j < this->rowCapacities.getElement( gi ); j++ ) this->matrix.setElement( gi, j, gi + j ); } for( int i = 0; i < this->matrix.getLocalMatrix().getRows(); i++ ) { const auto gi = this->matrix.getLocalRowRange().getGlobalIndex( i ); - for( int j = 0; j < this->rowLengths.getElement( gi ); j++ ) { + for( int j = 0; j < this->rowCapacities.getElement( gi ); j++ ) { EXPECT_EQ( this->matrix.getElement( gi, j ), gi + j ); EXPECT_EQ( this->matrix.getLocalMatrix().getElement( i, j ), gi + j ); } @@ -213,34 +213,34 @@ TYPED_TEST( DistributedMatrixTest, vectorProduct_globalInput ) using GlobalVector = typename TestFixture::GlobalVector; using DistributedVector = typename TestFixture::DistributedVector; - this->matrix.setCompressedRowLengths( this->rowLengths ); - setMatrix( this->matrix, this->rowLengths ); + this->matrix.setRowCapacities( this->rowCapacities ); + setMatrix( this->matrix, this->rowCapacities ); GlobalVector inVector( this->globalSize ); inVector.setValue( 1 ); DistributedVector outVector( this->matrix.getLocalRowRange(), this->globalSize, this->matrix.getCommunicationGroup() ); this->matrix.vectorProduct( inVector, outVector ); - EXPECT_EQ( outVector, this->rowLengths ) + EXPECT_EQ( outVector, this->rowCapacities ) << "outVector.getLocalView() = " << outVector.getLocalView() - << ",\nthis->rowLengths.getLocalView() = " << this->rowLengths.getLocalView(); + << ",\nthis->rowCapacities.getLocalView() = " << this->rowCapacities.getLocalView(); } TYPED_TEST( DistributedMatrixTest, vectorProduct_distributedInput ) { using DistributedVector = typename TestFixture::DistributedVector; - this->matrix.setCompressedRowLengths( this->rowLengths ); - setMatrix( this->matrix, this->rowLengths ); + this->matrix.setRowCapacities( this->rowCapacities ); + setMatrix( this->matrix, this->rowCapacities ); DistributedVector inVector( this->matrix.getLocalRowRange(), this->globalSize, this->matrix.getCommunicationGroup() ); inVector.setValue( 1 ); DistributedVector outVector( this->matrix.getLocalRowRange(), this->globalSize, this->matrix.getCommunicationGroup() ); this->matrix.vectorProduct( inVector, outVector ); - EXPECT_EQ( outVector, this->rowLengths ) + EXPECT_EQ( outVector, this->rowCapacities ) << "outVector.getLocalView() = " << outVector.getLocalView() - << ",\nthis->rowLengths.getLocalView() = " << this->rowLengths.getLocalView(); + << ",\nthis->rowCapacities.getLocalView() = " << this->rowCapacities.getLocalView(); } #endif // HAVE_GTEST diff --git a/src/UnitTests/Matrices/MultidiagonalMatrixTest.h b/src/UnitTests/Matrices/MultidiagonalMatrixTest.h index 75aeda8245afb49744fc24fe63273993fdd50795..d73e98318d1885650d86c7b22652b000f48a830d 100644 --- a/src/UnitTests/Matrices/MultidiagonalMatrixTest.h +++ b/src/UnitTests/Matrices/MultidiagonalMatrixTest.h @@ -194,8 +194,8 @@ void test_GetAllocatedElementsCount() using IndexType = typename Matrix::IndexType; using DiagonalsOffsetsType = typename Matrix::DiagonalsOffsetsType; - const IndexType rows = 7; - const IndexType cols = 6; + //const IndexType rows = 7; + //const IndexType cols = 6; Matrix m1( 7, 6, DiagonalsOffsetsType( { -2, 0, 3, 5 } ) ); EXPECT_EQ( m1.getAllocatedElementsCount(), 28 ); diff --git a/src/UnitTests/Matrices/SymmetricSparseMatrixTest.hpp b/src/UnitTests/Matrices/SymmetricSparseMatrixTest.hpp index c316440d1719e67e0a3e612963df4e7e93caeb48..e27257609d4846ca184c7290a6f1a408192ca606 100644 --- a/src/UnitTests/Matrices/SymmetricSparseMatrixTest.hpp +++ b/src/UnitTests/Matrices/SymmetricSparseMatrixTest.hpp @@ -261,7 +261,6 @@ void test_GetRow() auto matrixView = m.getView(); auto f = [=] __cuda_callable__ ( const IndexType rowIdx ) mutable { auto row = matrixView.getRow( rowIdx ); - RealType val; switch( rowIdx ) { case 0: row.setElement( 0, 0, 1 ); break; @@ -1011,8 +1010,8 @@ void test_SaveAndLoad( const char* filename ) * \ 0 0 0 0 10 / */ - const IndexType rows = 6; - const IndexType cols = 5; + //const IndexType rows = 6; + //const IndexType cols = 5; Matrix savedMatrix( 6, 5, { { 0, 0, 1 }, diff --git a/src/UnitTests/Meshes/MeshTraverserTest.h b/src/UnitTests/Meshes/MeshTraverserTest.h index b6c8208ad9e48731c45b2a6875fe722594a6ffe7..b5b45f8e5558c2c7ee0944a492761fc9f9ac07c5 100644 --- a/src/UnitTests/Meshes/MeshTraverserTest.h +++ b/src/UnitTests/Meshes/MeshTraverserTest.h @@ -20,8 +20,6 @@ using RealType = double; using Device = Devices::Host; using IndexType = int; -static const char* TEST_FILE_NAME = "test_MeshTest.tnl"; - // FIXME: Traverser does not work with Id = void //class TestQuadrilateralMeshConfig : public DefaultConfig< Topologies::Quadrilateral > class TestQuadrilateralMeshConfig : public DefaultConfig< Topologies::Quadrilateral, 2, double, int, int, int >