14.1.1. The Options Database

Up: Contents Next: User-Defined Options Previous: Runtime Options

Each PETSc process maintains a database of option names and values (stored as text strings). This database is generated with the command PETScInitialize(), which is listed below in its C/C++ and Fortran variants, respectively:

   ierr = PetscInitialize(int *argc,char ***args,char *file_name,char *help_message); 
   call PetscInitialize(character file_name,integer ierr) 
The arguments argc and args (in the C/C++ version only) are the usual command line arguments, while the file_name is a name of a file that can contain additional options. By default this file is called .petscrc in the user's home directory. The user can also specify options via the environmental variable PETSC_OPTIONS. The options are processed in the following order:
Thus, the command line options supersede the environmental variable options, which in turn supersede the options file.

The file format for specifying options is

   -optionname possible_value 
   -anotheroptionname possible_value 
   ... 
All of the option names must begin with a dash (-) and have no intervening spaces. Note that the option values cannot have intervening spaces either, and tab characters cannot be used between the option names and values. The user can employ any naming convention. For uniformity throughout PETSc, we employ the format -package_option (for instance, -ksp_type and -mat_view_info).

Users can specify an alias for any option name (to avoid typing the sometimes lengthy default name) by adding an alias to the .petscrc file in the format

   alias -newname -oldname 
For example,
   alias -kspt -ksp_type 
   alias -sd -start_in_debugger 
Comments can be placed in the .petscrc file by using one of the following symbols in the first column of a line: #, %, or !.


Up: Contents Next: User-Defined Options Previous: Runtime Options