diff --git a/apps/tutorials/cuda/01_GameOfLife_cuda.cpp b/apps/tutorials/cuda/01_GameOfLife_cuda.cpp index a261e0c07398462c4c8687ad653a552bad993b15..1f6ef10f8375c1f48ee9b27e479e4c1f09550a73 100644 --- a/apps/tutorials/cuda/01_GameOfLife_cuda.cpp +++ b/apps/tutorials/cuda/01_GameOfLife_cuda.cpp @@ -32,7 +32,7 @@ #include "cuda/Kernel.h" #include "cuda/AddGPUFieldToStorage.h" #include "cuda/communication/GPUPackInfo.h" - +#include "cuda/FieldIndexing.h" #include "field/AddToStorage.h" #include "field/communication/UniformMPIDatatypeInfo.h" diff --git a/tests/cuda/CudaTestCommon.h b/tests/cuda/CudaTestCommon.h deleted file mode 100644 index 8de39016e60dc88ba0b5a2c26632e43b4c12ccbd..0000000000000000000000000000000000000000 --- a/tests/cuda/CudaTestCommon.h +++ /dev/null @@ -1,88 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file -//! \author Paulo Carvalho <prcjunior@inf.ufpr.br> -// -//====================================================================================================================== - -#pragma once - -#include "core/DataTypes.h" -#include "core/debug/CheckFunctions.h" - -#include "field/GhostLayerField.h" - - -#ifdef DBG_PRINT_ON -#define DBG_PRINT_FIELD( f ) printField( f ) -#define DBG_PRINT( fmt, ... ) printf( fmt, ##__VA_ARGS__ ) -#else -#define DBG_PRINT_FIELD( f ) -#define DBG_PRINT(fmt, ...) -#endif - -template<typename Field_T> -void printField( Field_T& field ) -{ - using namespace walberla; - cell_idx_t fs = 0; - cell_idx_t zs = -(cell_idx_t)field.nrOfGhostLayers(); - cell_idx_t ys = -(cell_idx_t)field.nrOfGhostLayers(); - cell_idx_t xs = -(cell_idx_t)field.nrOfGhostLayers(); - cell_idx_t nf = (cell_idx_t)field.fSize(); - cell_idx_t nz = (cell_idx_t)(field.zSize() + field.nrOfGhostLayers()); - cell_idx_t ny = (cell_idx_t)(field.ySize() + field.nrOfGhostLayers()); - cell_idx_t nx = (cell_idx_t)(field.xSize() + field.nrOfGhostLayers()); - for ( cell_idx_t f = fs; f < nf; ++f ) { - std::cout << "{"; - for ( cell_idx_t z = zs; z < nz; ++z ) { - std::cout << ( z == zs ? "[" : " [" ); - for ( cell_idx_t y = ys; y < ny; ++y ) { - std::cout << "("; - for ( cell_idx_t x = xs; x < nx; ++x ) { - std::cout << field( x, y, z, f ) << ( x == nx-1 ? "" : " " ); - } - std::cout << ( y == ny-1 ? ")" : ") " ); - } - std::cout << "]\n"; - } - std::cout << "}\n"; - } -} - - -#define CHECK_FIELD_EQUAL( f1, f2 ) WALBERLA_CHECK( checkFieldEqual( f1, f2 ), "Field differ" ) - -template< typename Field_T > -bool checkFieldEqual( Field_T& field1, Field_T& field2 ) -{ - using namespace walberla; - WALBERLA_ASSERT( field1.xSize() == field2.xSize() && - field1.ySize() == field2.ySize() && - field1.zSize() == field2.zSize() && - field1.fSize() == field2.fSize() ); - - WALBERLA_FOR_ALL_CELLS_XYZ( &field2, - for ( uint_t f = 0; f < field1.fSize(); ++f ) - { - if ( field1.get( x, y, z, f ) != field2.get( x, y, z, f ) ) - { - return false; - } - } - ) - return true; -} diff --git a/tests/cuda/FieldIndexing3DTest.cpp b/tests/cuda/FieldIndexing3DTest.cpp index e1044d08a01ef22ebfc9d4e162dd89e5742e8adc..4ad2622bc3fb112c6ac960840f2af33af79f65c0 100644 --- a/tests/cuda/FieldIndexing3DTest.cpp +++ b/tests/cuda/FieldIndexing3DTest.cpp @@ -31,9 +31,6 @@ #include "cuda/Kernel.h" #include "cuda/FieldIndexing3D.h" -//#define DBG_PRINT_ON -#include "CudaTestCommon.h" - #include "FieldIndexing3DTest.h" using namespace walberla; @@ -66,8 +63,7 @@ void xyzTest() } ) - DBG_PRINT_FIELD( resultField ); - CHECK_FIELD_EQUAL( resultField, expectedField ); + WALBERLA_ASSERT( resultField == expectedField ); } @@ -93,8 +89,7 @@ void sliceBeforeGhostLayerXYZTest() expectedField.get( x, y, z, f ) = IDX4D( x - ci.xMin(), y - ci.yMin(), z - ci.zMin(), f ); } ) - DBG_PRINT_FIELD( resultField ); - CHECK_FIELD_EQUAL( resultField, expectedField ); + WALBERLA_ASSERT( resultField == expectedField ); } diff --git a/tests/cuda/communication/GPUPackInfoTest.cpp b/tests/cuda/communication/GPUPackInfoTest.cpp index b3f4af3e96a7f2e62ccbbbd9e1ba3ada881f08c3..28d3def70cd23dd3a69c6b3758a3e58f260684cf 100644 --- a/tests/cuda/communication/GPUPackInfoTest.cpp +++ b/tests/cuda/communication/GPUPackInfoTest.cpp @@ -35,9 +35,6 @@ #include <cstring> -//#define DBG_PRINT_ON -#include "../CudaTestCommon.h" - #define F_SIZE 19 @@ -90,8 +87,6 @@ public: communicate( gpuPackInfo, dir ); cuda::fieldCpy( cpuField, gpuField ); - DBG_PRINT_FIELD( cpuField ); - val = 0; for ( auto it = cpuField.beginGhostLayerOnly( stencil::inverseDir[dir] ); it != cpuField.end(); ++it ) { @@ -118,10 +113,6 @@ public: protected: void communicate( GPUPackInfoType& gpuPackInfo, stencil::Direction dir ) { - DBG_PRINT( "REMOTE %s -> %s\n", - stencil::dirToString[dir].c_str(), - stencil::dirToString[stencil::inverseDir[dir]].c_str() ); - mpi::GenericSendBuffer<> sendBuf; sendBuf.addDebugMarker( "Be" ); gpuPackInfo.packData( block_, dir, sendBuf ); @@ -148,10 +139,6 @@ public: protected: void communicate( GPUPackInfoType& gpuPackInfo, stencil::Direction dir ) { - DBG_PRINT( "LOCAL %s -> %s\n", - stencil::dirToString[dir].c_str(), - stencil::dirToString[stencil::inverseDir[dir]].c_str() ); - gpuPackInfo.communicateLocal( block_, block_, dir ); } };