Next: Common Errors in Calling Up: Troubleshooting Previous: Installation Debugging Hints

# Application Debugging Hints

We highly recommend the following as a list of debugging hints (and tools) for writing parallel application programs that call ScaLAPACK:

- Look at the ScaLAPACK example programs as a good starting point.

  > `http://www.netlib.org/scalapack/examples/`

- Always check the value of INFO on exit from a ScaLAPACK routine.
- All routines in ScaLAPACK that require workspace also require the length of that workspace to be specified in the calling sequence. If in doubt about the amount of workspace to supply to a ScaLAPACK routine, supply LWORK=-1, and use the returned value in WORK(1) as the correct value for LWORK. Refer to section 4.6.5 for further details on determining workspace requirements .
- If you are calling a ScaLAPACK routine that has an LAPACK equivalent, write a serial code calling LAPACK first. Code can be converted in pieces from LAPACK to ScaLAPACK by debugging on a one-process grid. When all of the LAPACK codes have been removed and the code has been fully parallelized, execute it on a multiple process grid.
- When writing a parallel program, first debug the code to work on one process, and then expand to more processes.
- When writing a parallel program, debug with small matrices.
- Use the TOOLS routine PxLAPRNT to print out each process's portion of a distributed matrix. A variety of utility routines are provided in the TOOLS directory and are commonly used as debugging aids in the development of the ScaLAPACK library.
- Sprinkle synchronization points via `BLACS_BARRIER` near suspected error.
- Link to the debug level 1 BLACS (specified by `BLACSDBGLVL=1` in `Bmake.inc`) until the program is completely debugged.
- Specify the``Repeatability'' flag in `BLACS_SET`.
- If running a heterogeneous application, please ensure that all executables are linked with the same debug level of the BLACS. Otherwise, unpredictable results will occur because the debug level 1 BLACS perform error-checking and thus send more messages than the performance debug level 0 BLACS.
- Always run the BLACS, BLAS, and PBLAS test suites to ensure that these libraries have been properly installed. (If PVM is the underlying message-passing layer, please also run the PVM test suite.) If a problem is detected in the BLAS or BLACS libraries, try linking to the reference implementations in the respective blas or blacs directory on netlib.
- Consult the `errata.scalapack` file in the scalapack directory on netlib, and/or the `errata.blacs` file in the blacs directory on netlib. These files contain a list of known difficulties that have been diagnosed and corrected (or will be corrected in the next release), or reported to the vendor as in the case of message-passing libraries or optimized BLAS .
- Refer to section 4.6.7 and the leading comments of the source code for the alignment restrictions currently needed in some of the ScaLAPACK routines.

Next: Common Errors in Calling Up: Troubleshooting Previous: Installation Debugging Hints