next up previous contents
Next: Testing a kernel Up: General comments for Level Previous: General index file description   Contents

Things you can assume, and/or need to know when writing kernels

First, ATLAS will ensure that N > 0 for all routines. Vector strides will never be zero, and for those routines taking only one vector, the vector stride will always be positive.

For routines taking more than one vector, this is not so simple. The first thing that needs to be clear is that internally, ATLAS does not use the pointer conventions that the BLAS do when it comes to handling vectors with negative increments. In the BLAS, if you want to operate on a vector with a negative increment, you pass in the end of the negatively incremented vector (i.e, you always pass the part of the vector closest to 0 in memory, regardless of the increment). ATLAS will instead pass the beginning of the vector regardless of sign, so that the following sample code would correctly step through a vector regardless of the sign:

   for (i=0; i < N; i++, X += incX, Y += incY) ...
.

ATLAS also fiddles with the vector increments so that:

  1. Both increments are never negative
  2. incY will be negative only if $\Vert$incX$\Vert$ == 1 and $\Vert$incY$\Vert$ != 1.

There may be additional constraints, on an individual routine basis.


next up previous contents
Next: Testing a kernel Up: General comments for Level Previous: General index file description   Contents
R. Clint Whaley 2001-08-04