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
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -102,15 +102,20 @@ benchmarkSpMV( Benchmark & benchmark,
            //  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 ); 
             
             // 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 );
          e.what();
          return false;
      }
    
@@ -150,15 +155,20 @@ benchmarkSpMV( Benchmark & benchmark,
            //  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 );
             
             // 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 );
          e.what();
          return false;
      }