Algebraic-Programming / ALP

Home of ALP/GraphBLAS and ALP/Pregel, featuring shared- and distributed-memory auto-parallelisation of linear algebraic and vertex-centric programs. Soon with more to come!
Apache License 2.0
25 stars 4 forks source link

Missing assertions for threaded execution #278

Open byjtew opened 8 months ago

byjtew commented 8 months ago

As an example, this program compiles, and crashes during its execution for a very misleading reason:

void grb_program( ... ) {
  // Using 1 openMP thread
  omp_set_num_threads( 1 ); 

  // User stuff ...

  grb::Vector<int> x(...);
  grb::Vector<int> y(...);
  grb::Matrix<int> A(...);
  // Build the vectors and the matrix ...

  // NOW using 2 openMP thread
  omp_set_num_threads( 2 ); 

  // Triggers the assertion trigger in include/coordinates.hpp:1343  "assert( _buf % T == 0 );"
  // Reason: The vectors have been allocated for computations with 
  // 1 thread only, but grb::vxm will be executed using 2 threads.
  grb::vxm( y, x, A, ... ); 
}
anyzelman commented 8 months ago

The suggestion here is to add a mechanism that more clearly reports when the number of threads have been modified. A fix has been suggested.