Skip to content
Snippets Groups Projects
Commit 7951df7f authored by Martin Bauer's avatar Martin Bauer
Browse files

Adapted gpu communication tests to changes in GPU communication

parent 330c43f6
No related merge requests found
...@@ -101,14 +101,6 @@ int main( int argc, char ** argv ) ...@@ -101,14 +101,6 @@ int main( int argc, char ** argv )
debug::enterTestMode(); debug::enterTestMode();
mpi::Environment mpiEnv( argc, argv ); mpi::Environment mpiEnv( argc, argv );
std::vector< cudaStream_t > streams;
for( uint_t i = 0; i < StencilType::Size; ++i )
{
cudaStream_t stream(nullptr);
WALBERLA_CUDA_CHECK( cudaStreamCreate(&stream) );
streams.push_back( stream );
}
const Vector3< uint_t > cells = Vector3< uint_t >( 4, 4, 4 ); const Vector3< uint_t > cells = Vector3< uint_t >( 4, 4, 4 );
...@@ -153,7 +145,7 @@ int main( int argc, char ** argv ) ...@@ -153,7 +145,7 @@ int main( int argc, char ** argv )
// Setup communication scheme for asynchronous GPUPackInfo, which uses CUDA streams // Setup communication scheme for asynchronous GPUPackInfo, which uses CUDA streams
CommSchemeType asyncCommScheme(blocks); CommSchemeType asyncCommScheme(blocks);
asyncCommScheme.addPackInfo( make_shared< GPUPackInfoType >( asyncGPUFieldId, streams ) ); asyncCommScheme.addPackInfo( make_shared< GPUPackInfoType >( asyncGPUFieldId ) );
// Perform one communication step for each scheme // Perform one communication step for each scheme
syncCommScheme(); syncCommScheme();
...@@ -180,8 +172,6 @@ int main( int argc, char ** argv ) ...@@ -180,8 +172,6 @@ int main( int argc, char ** argv )
} }
} }
for( uint_t i = 0; i < StencilType::Size; ++i )
WALBERLA_CUDA_CHECK( cudaStreamDestroy(streams[i]) );
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
...@@ -62,8 +62,8 @@ public: ...@@ -62,8 +62,8 @@ public:
typedef cuda::communication::GPUPackInfo< cuda::GPUField<int> > GPUPackInfoType; typedef cuda::communication::GPUPackInfo< cuda::GPUField<int> > GPUPackInfoType;
GPUPackInfoTester( IBlock* block, BlockDataID fieldId, std::vector< cudaStream_t > & streams ) : GPUPackInfoTester( IBlock* block, BlockDataID fieldId ) :
block_( block ), fieldId_( fieldId ), streams_(streams) {} block_( block ), fieldId_( fieldId ) {}
virtual ~GPUPackInfoTester() {} virtual ~GPUPackInfoTester() {}
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
} }
cuda::fieldCpy( gpuField, cpuField ); cuda::fieldCpy( gpuField, cpuField );
GPUPackInfoType gpuPackInfo( fieldId_, streams_ ); GPUPackInfoType gpuPackInfo( fieldId_ );
communicate( gpuPackInfo, dir ); communicate( gpuPackInfo, dir );
cuda::fieldCpy( cpuField, gpuField ); cuda::fieldCpy( cpuField, gpuField );
...@@ -106,7 +106,6 @@ protected: ...@@ -106,7 +106,6 @@ protected:
IBlock* block_; IBlock* block_;
BlockDataID fieldId_; BlockDataID fieldId_;
std::vector< cudaStream_t > streams_;
}; };
...@@ -114,7 +113,7 @@ protected: ...@@ -114,7 +113,7 @@ protected:
class GPUPackInfoBufferTester: public GPUPackInfoTester class GPUPackInfoBufferTester: public GPUPackInfoTester
{ {
public: public:
GPUPackInfoBufferTester( IBlock* block, BlockDataID fieldId, std::vector< cudaStream_t > & streams): GPUPackInfoTester( block, fieldId, streams ) {} GPUPackInfoBufferTester( IBlock* block, BlockDataID fieldId): GPUPackInfoTester( block, fieldId ) {}
protected: protected:
void communicate( GPUPackInfoType& gpuPackInfo, stencil::Direction dir ) void communicate( GPUPackInfoType& gpuPackInfo, stencil::Direction dir )
...@@ -140,7 +139,7 @@ protected: ...@@ -140,7 +139,7 @@ protected:
class GPUPackInfoLocalTester: public GPUPackInfoTester class GPUPackInfoLocalTester: public GPUPackInfoTester
{ {
public: public:
GPUPackInfoLocalTester( IBlock* block, BlockDataID fieldId, std::vector< cudaStream_t > & streams ): GPUPackInfoTester( block, fieldId, streams ) {} GPUPackInfoLocalTester( IBlock* block, BlockDataID fieldId ): GPUPackInfoTester( block, fieldId ) {}
protected: protected:
void communicate( GPUPackInfoType& gpuPackInfo, stencil::Direction dir ) void communicate( GPUPackInfoType& gpuPackInfo, stencil::Direction dir )
...@@ -159,13 +158,6 @@ int main(int argc, char **argv) ...@@ -159,13 +158,6 @@ int main(int argc, char **argv)
for(; fieldLayoutIndex < fieldLayouts.size(); ++fieldLayoutIndex ) for(; fieldLayoutIndex < fieldLayouts.size(); ++fieldLayoutIndex )
{ {
std::vector< cudaStream_t > streams;
for( uint_t s = 0; s < stencil::D3Q27::Size; ++s )
{
cudaStream_t stream(nullptr);
WALBERLA_CUDA_CHECK( cudaStreamCreate( &stream ) );
streams.push_back( stream );
}
// Create BlockForest // Create BlockForest
uint_t processes = uint_c( MPIManager::instance()->numProcesses() ); uint_t processes = uint_c( MPIManager::instance()->numProcesses() );
auto blocks = createUniformBlockGrid(processes,1,1, //blocks auto blocks = createUniformBlockGrid(processes,1,1, //blocks
...@@ -179,8 +171,8 @@ int main(int argc, char **argv) ...@@ -179,8 +171,8 @@ int main(int argc, char **argv)
for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt )
{ {
GPUPackInfoBufferTester bufferTester( &(*blockIt), scalarGPUFieldId, streams ); GPUPackInfoBufferTester bufferTester( &(*blockIt), scalarGPUFieldId );
GPUPackInfoLocalTester localTester( &(*blockIt), scalarGPUFieldId, streams ); GPUPackInfoLocalTester localTester( &(*blockIt), scalarGPUFieldId );
for( auto dir = stencil::D3Q27::beginNoCenter(); dir != stencil::D3Q27::end(); ++dir ) for( auto dir = stencil::D3Q27::beginNoCenter(); dir != stencil::D3Q27::end(); ++dir )
{ {
...@@ -188,12 +180,6 @@ int main(int argc, char **argv) ...@@ -188,12 +180,6 @@ int main(int argc, char **argv)
bufferTester.test( *dir ); bufferTester.test( *dir );
} }
} }
for( auto streamIt = streams.begin(); streamIt != streams.end(); ++streamIt )
{
cudaStream_t & stream = *streamIt;
WALBERLA_CUDA_CHECK( cudaStreamDestroy( stream ) );
}
} }
return 0; return 0;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment