Programming, Debugging, Bug Reporting


General programming guidelines



Simple templates for magpar functions:

Initialization function (called during serial or parallel initialization):

int MagparFunctionInit(GridData *gdata,Vec vec1,PetscReal *real1)
  /* First executable line of each PETSc function used for error handling. */
  /* macros defined in griddata.h, see also PetscFunctionBegin */
  /* print log information on stdout (source file, function name) */

  [do stuff]

  /* print timing information */

Solver function (called many times during solution):

int MagparFunction(GridData *gdata,Vec vec1,PetscReal *real1)
  /* by default do not print any information on stdout */
  /* if "-info" option is active: print log information on stdout */

  [do stuff]

  /* by default do not print any information on stdout */
  /* if "-info" option is active: print timing information on stdout */


The following suggestions might be helpful for debugging:

In addition, it is often useful to ensure that all parallel processes are synchronized at a certain position in the program. This is easily accomplished by using the PETSc function "PetscBarrier", which blocks until this routine is executed by all processors owning a certain PETSc object, e.g. the global magnetization vector "gdata->M".

  PetscPrintf(PETSC_COMM_WORLD,"deb03: barrier\n");

Guidelines for bug reports

Required information:

The more information you provide, the easier it is to track down the problem.

Bug reports may be sent to: magpar(at)

magpar - Parallel Finite Element Micromagnetics Package
Copyright (C) 2002-2009 Werner Scholz