Skip to content

How to reimplement malloc realloc and free to use managed memory

License

Notifications You must be signed in to change notification settings

fduguet-nv/malloc-realloc-free

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

malloc-realloc-free

How to reimplement malloc realloc and free to use managed memory

Usage

In code using malloc/realloc/free functions, #include <cuda_managed_mem.h>, and replace with

  • malloc with cuda_managed_mem_malloc
  • free with cuda_managed_mem_free
  • realloc with cuda_managed_mem_realloc

Then, compile cuda_managed_mem.cu and link it with main binary.

When compiling with -DUSEREALLOC=1, regular system calls are used. When compiling with -DUSERALLOC=0 or undefined, then cuda managed memory is used.

Logging troubleshooting information can be done defining -DLOGGING=1 when compiling cuda_managed_mem.cu.

About

How to reimplement malloc realloc and free to use managed memory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published