Trying to debug a threading problem in PDL
can be tedious because the error messages
don't give all the relevant information for the
threading problem. For example, this code for
showing a bug the the inv routine for PDL-2.4.7:
$a = floor(5*random(3,3)-2);
print $a->info . "\n";
$ainv = $a->inv;
print $a->(,,*1)->info . "\n";
$ainvx1 = $a->(,,*1)->inv;
print $a->(,,*2)->info . "\n";
$ainvx2 = $a->(,,*2)->inv;
Yields the following output (due to
a threading bug in the inv method:
PDL: Double D [3,3]
PDL: Double D [3,3,1]
PDL: Double D [3,3,2]
lu_decomp: no longer calling lu_decomp2 at /cygdrive/f/perl/usr_lib/i686-cygwin-thread-multi-64int/PDL/MatrixOps.pm line 808.
PDL: PDL::Slices::index(a,ind,c): Parameter 'ind'
PDL: Mismatched implicit thread dimension 1: should be 3, is 2
Caught at file threaddiag.pl, line 10, pkg main
Not very helpful since the actual threading
problem is from the lu_backsub routine. In
addition to not giving the actual location of
the problem in the error, we're not even
given the pdls involved, their shapes, and
the attempted threading shape so that
a fix could be found.
As is, I usually have to use the debugger
and/or add print statements to output the
needed shapes/dimensions to understand
and resolve a problem.