Skip to content
Snippets Groups Projects
Commit 74ce83d0 authored by Lukas Cejka's avatar Lukas Cejka Committed by Tomáš Oberhuber
Browse files

Added exception handling for allocation on CPU

parent e6474371
No related branches found
No related tags found
1 merge request!45Matrices revision
......@@ -101,17 +101,22 @@ benchmarkSpMV( Benchmark & benchmark,
// FIXME: Adds the message to the log file, HOWEVER, it does so with
// incorrect formatting: The "!" marks are not at the same line
// as the message and sometimes they're omitted altogether.
// benchmark.addErrorMessage( "Failed to read matrix!", 1 );
return false;
// benchmark.addErrorMessage( "Failed to read matrix!", 1 );
// CORRECT? MatrixReader can fail for other reasons than Host Allocation issues, is this throw ok?
throw Exceptions::HostBadAlloc();
return false;
}
}
catch( std::bad_alloc )
// HOW? How does this work if the "if" statement above fails.
catch( Exceptions::HostBadAlloc e )
{
// FIXME: Adds the message to the log file, HOWEVER, it does so with
// incorrect formatting: The "!" marks are not at the same line
// as the message and sometimes they're omitted altogether.
// benchmark.addErrorMessage( "Failed to allocate memory for matrix!", 1 );
return false;
e.what();
return false;
}
// cuSPARSE handle setup
......@@ -149,17 +154,22 @@ benchmarkSpMV( Benchmark & benchmark,
// FIXME: Adds the message to the log file, HOWEVER, it does so with
// incorrect formatting: The "!" marks are not at the same line
// as the message and sometimes they're omitted altogether.
// benchmark.addErrorMessage( "Failed to read matrix!", 1 );
return false;
// benchmark.addErrorMessage( "Failed to read matrix!", 1 );
// CORRECT? MatrixReader can fail for other reasons than Host Allocation issues, is this throw ok?
throw Exceptions::HostBadAlloc();
return false;
}
}
catch( std::bad_alloc )
// HOW? How does this work if the "if" statement above fails.
catch( Exceptions::HostBadAlloc e )
{
// FIXME: Adds the message to the log file, HOWEVER, it does so with
// incorrect formatting: The "!" marks are not at the same line
// as the message and sometimes they're omitted altogether.
// benchmark.addErrorMessage( "Failed to allocate memory for matrix!", 1 );
return false;
e.what();
return false;
}
#ifdef HAVE_CUDA
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment