# PetscDeviceCreate
Get a new handle for a particular device (often a GPU) type 
## Synopsis
```
#include <petscdevice.h> 
PetscErrorCode PetscDeviceCreate(PetscDeviceType type, PetscInt devid, PetscDevice *device)
```
Not Collective


## Input Parameters

- ***type  -*** The type of `PetscDevice`
- ***devid -*** The numeric ID# of the device (pass `PETSC_DECIDE` to assign automatically)



## Output Parameter

- ***device -*** The `PetscDevice`



## Notes
This routine may initialize `PetscDevice`. If this is the case, it may cause some sort of
device synchronization.

`devid` is what you might pass to `cudaSetDevice()` for example.




## See Also
 `PetscDevice`, `PetscDeviceInitType`,
`PetscDeviceInitialize()`, `PetscDeviceInitialized()`, `PetscDeviceConfigure()`,
`PetscDeviceView()`, `PetscDeviceDestroy()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/device/interface/device.cxx.html#PetscDeviceCreate">src/sys/objects/device/interface/device.cxx</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/device/interface/device.cxx)


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