:orphan:
# PetscSharedWorkingDirectory
Determines if all processors in a communicator share a working directory or have different ones. 
## Synopsis
```
PetscErrorCode PetscSharedWorkingDirectory(MPI_Comm comm, PetscBool *shared)
```
Collective


## Input Parameter

- ***comm -*** MPI_Communicator that may share working directory



## Output Parameter

- ***shared -*** `PETSC_TRUE` or `PETSC_FALSE`



## Options Database Keys

- ***-shared_working_directory -*** indicates the directory is known to be shared among the MPI processes
- ***-not_shared_working_directory -*** indicates the directory is known to be not shared among the MPI processes



## Environmental Variables

- ***`PETSC_SHARED_WORKING_DIRECTORY` -*** indicates the directory is known to be shared among the MPI processes
- ***`PETSC_NOT_SHARED_WORKING_DIRECTORY` -*** indicates the directory is known to be not shared among the MPI processes





## Notes
Stores the status as a MPI attribute so it does not have to be redetermined each time.

Assumes that all processors in a communicator either
```none
   1) have a common working directory or
   2) each has a separate working directory
```

eventually we can write a fancier one that determines which processors share a common working directory.

This will be very slow on runs with a large number of processors since it requires O(p*p) file opens.


## See Also
 `PetscGetTmp()`, `PetscSharedTmp()`, `PetscGetWorkingDirectory()`, `PetscGetHomeDirectory()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/fileio/fretrieve.c.html#PetscSharedWorkingDirectory">src/sys/fileio/fretrieve.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/fileio/fretrieve.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
