MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / setProp

Function setProp

cpp/3_CUDA_Features/cudaCompressibleMemory/compMalloc.cpp:34–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32#include <string.h>
33
34cudaError_t setProp(CUmemAllocationProp *prop, bool UseCompressibleMemory)
35{
36 CUdevice currentDevice;
37 if (cuCtxGetDevice(&currentDevice) != CUDA_SUCCESS)
38 return cudaErrorMemoryAllocation;
39
40 memset(prop, 0, sizeof(CUmemAllocationProp));
41 prop->type = CU_MEM_ALLOCATION_TYPE_PINNED;
42 prop->location.type = CU_MEM_LOCATION_TYPE_DEVICE;
43 prop->location.id = currentDevice;
44
45 if (UseCompressibleMemory)
46 prop->allocFlags.compressionType = CU_MEM_ALLOCATION_COMP_GENERIC;
47
48 return cudaSuccess;
49}
50
51cudaError_t allocateCompressible(void **adr, size_t size, bool UseCompressibleMemory)
52{

Callers 2

allocateCompressibleFunction · 0.85
freeCompressibleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected