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

Function xmalloc

cpp/4_CUDA_Libraries/simpleCUBLAS_LU/simpleCUBLAS_LU.cpp:86–95  ·  view source on GitHub ↗

wrapper around malloc clears the allocated memory to 0 terminates the program if malloc fails

Source from the content-addressed store, hash-verified

84// clears the allocated memory to 0
85// terminates the program if malloc fails
86void *xmalloc(size_t size)
87{
88 void *ptr = malloc(size);
89 if (ptr == NULL) {
90 printf("> ERROR: malloc for size %zu failed..\n", size);
91 exit(EXIT_FAILURE);
92 }
93 memset(ptr, 0, size);
94 return ptr;
95}
96
97// initalize identity matrix
98void initIdentityMatrix(DATA_TYPE *mat)

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected