:orphan:
# PetscMallocSetCUDAHost
Set `PetscMalloc()` to use `CUDAHostMalloc()` Switch the current malloc and free routines to the CUDA malloc and free routines 
## Synopsis
```
#include "petscsys.h"   
PetscErrorCode PetscMallocSetCUDAHost(void)
```
Not Collective




## Note
This provides a way to use the CUDA malloc and free routines temporarily. One
can switch back to the previous choice by calling `PetscMallocResetCUDAHost()`.


## See Also
 `PetscCUDAHostMalloc()`, `PetscMallocResetCUDAHost()`, `PetscMallocSetHIPHost()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/memory/cuda/mcudahost.cu.html#PetscMallocSetCUDAHost">src/sys/memory/cuda/mcudahost.cu</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/memory/cuda/mcudahost.cu)


[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)  
