PetscOptionsGetenv#

Gets an environmental variable, broadcasts to all processors in communicator from MPI rank zero

Synopsis#

PetscErrorCode PetscOptionsGetenv(MPI_Comm comm, const char name[], char env[], size_t len, PetscBool *flag)

Collective

Input Parameters#

  • comm - communicator to share variable

  • name - name of environmental variable

  • len - amount of space allocated to hold variable

Output Parameters#

  • flag - if not NULL indicates if the variable was found

  • env - value of variable

Notes#

You can also “set” the environmental variable by setting the options database value -name “stringvalue” (with name in lower case). If name begins with PETSC_ this is discarded before checking the database. For example, PETSC_VIEWER_SOCKET_PORT would be given as -viewer_socket_port 9000

If comm does not contain the 0th process in the MPI_COMM_WORLD it is likely on many systems that the environmental variable will not be set unless you put it in a universal location like a .chsrc file

See Also#

PetscOptionsHasName()

Level#

advanced

Location#

src/sys/utils/pdisplay.c


Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages