Research Article
Exploiting GPUs in Virtual Machine for BioCloud
Algorithm 1
An example implementation of the WrapCUDA library function.
(1) cudaError_t cudaGetDeviceCount(int *count) { | (2) static cudaError_t (*ofuncp)(int *count); | (3) char *error; | (4) cudaError_t rs; | (5) | (6) checkgpuon(); // Checks having GPU. Request a GPU, if not. | (7) | (8) if (!ofuncp) { | (9) ofuncp = dlsym(RTLD_NEXT, “cudaGetDeviceCount”); | (10) if ((error = dlerror()) != NULL) { | (11) fputs(error, stderr); | (12) exit(1); | (13) } | (14) } | (15) rs = ofuncp(count); | (16) return rs; | (17) } |
|