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

Function CleanupNoFailure

cpp/0_Introduction/vectorAddMMAP/vectorAddMMAP.cpp:230–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230int CleanupNoFailure()
231{
232 // Free device memory
233 checkCudaErrors(simpleFreeMultiDeviceMmap(d_A, allocationSize));
234 checkCudaErrors(simpleFreeMultiDeviceMmap(d_B, allocationSize));
235 checkCudaErrors(simpleFreeMultiDeviceMmap(d_C, allocationSize));
236
237 // Free host memory
238 if (h_A) {
239 free(h_A);
240 }
241
242 if (h_B) {
243 free(h_B);
244 }
245
246 if (h_C) {
247 free(h_C);
248 }
249
250 checkCudaErrors(cuModuleUnload(cuModule));
251 checkCudaErrors(cuCtxDestroy(cuContext));
252
253 return EXIT_SUCCESS;
254}
255// Allocates an array with random float entries.
256void RandomInit(float *data, int n)
257{

Callers 1

mainFunction · 0.70

Calls 1

Tested by

no test coverage detected