GMM_EXPORT cudaError_t cudaFree(void *devPtr) { cudaError_t ret; if (initialized) ret = gmm_cudaFree(devPtr); else { gprint(WARN, "cudaFree called outside GMM\n"); ret = nv_cudaFree(devPtr); } return ret; }
cudaError_t cudaFree(void *devPtr) { static cudaError_t (*nv_cudaFree)(void *) = NULL; cudaError_t ret; struct timeval t; if(!nv_cudaFree) { nv_cudaFree = dlsym(RTLD_NEXT, "cudaFree"); if(!nv_cudaFree) { fprintf(stderr, "failed to find symbol cudaFree: %s\n", dlerror()); return cudaErrorSharedObjectSymbolNotFound; } } gettimeofday(&t, NULL); printf("[gvm] %lf intercepting cudaFree\n", t.tv_sec + t.tv_usec / 1000000.0); ret = nv_cudaFree(devPtr); gettimeofday(&t, NULL); printf("[gvm] %lf intercepted cudaFree( %lx ) = %d\n", t.tv_sec + t.tv_usec / 1000000.0, (unsigned long)devPtr, (int)ret); return ret; }