Skip to content

Commit

Permalink
Support span creation only for BP4 engine
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Mar 2, 2021
1 parent 21b89e4 commit f8d2366
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/IO/ADIOS/ADIOS2IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,11 @@ ADIOS2IOHandlerImpl::getBufferView(
Parameter< Operation::GET_BUFFER_VIEW > & parameters )
{
// @todo check access mode
if( m_engineType != "bp4" )
{
parameters.out->taskSupportedByBackend = false;
return;
}
setAndGetFilePosition( writable );
auto file = refreshFileFromParent( writable );
detail::BufferedActions &ba = getFileData( file );
Expand Down
21 changes: 20 additions & 1 deletion test/SerialIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3313,7 +3313,26 @@ iterate_nonstreaming_series( std::string const & file )
openPMD::Dataset( openPMD::Datatype::INT, { 2, extent } ) );
std::vector< int > data( extent, i );
E_x.storeChunk( data, { 0, 0 }, { 1, extent } );
Span< int > span = E_x.storeChunk< int >( { 1, 0 }, { 1, extent } );
bool taskSupportedByBackend = true;
Span< int > span = E_x.storeChunk< int >(
{ 1, 0 },
{ 1, extent },
/*
* Hijack the functor that is called for buffer creation if the
* backend doesn't support the task to see whether the backend
* did support it or not.
*/
[ &taskSupportedByBackend ]( size_t size )
{
taskSupportedByBackend = false;
return std::shared_ptr< int >{
new int[ size ], []( auto * ptr ) { delete[] ptr; } };
} );
if( writeSeries.backend() == "ADIOS2" )
{
// that backend must support span creation
REQUIRE( taskSupportedByBackend );
}
for( size_t j = 0; j < span.size(); ++j )
{
span[ j ] = j;
Expand Down

0 comments on commit f8d2366

Please sign in to comment.