CUDA plugin dlopen -
i've written cuda plugin (dynamic library), , have program written in c uses dlopen() load plugin. using dlsym() functions plugin. application important time of loading plugin program gets new handle dlopen() calling (the library file may modified subsequently). therefore after using of functions plugin invoke dlclose(). invocations dlopen() - dlsym() - dlclose() occur during program execution (in loop).
if working on computer nvidia driver 256.35 (cuda 3.0 or 3.1) have memory leak (i use in plugin cudamemgetinfo() calling diagnostics). if working on computer nvidia driver 195.36.15 (cuda 3.0) have error after time of program execution: “nvidia: not open device file /dev/nvidia0 (too many open files).”
if don't use dlclose() invocation program working fine, in case can't replace plugin on new one's during program execution.
anyone encountered problem? thanks.
nobody wrote plugins on cuda?
i've found similar example on cuda sdk: matrixmuldynlinkjit
. i've done small correction in code. in particular, in file cuda_drvapi_dynlink.c
i've corrected cuinit()
function:
cudadriver cudadrvlib = null; curesult cudaapi cuinit(unsigned int flags) { //cudadriver cudadrvlib; curesult result; int driverver; if (cudadrvlib != null) { dlclose (cudadrvlib); cudadrvlib = null; } ....... }
and in file matrixmuldynlinkjit.cpp
i've added loop in main()
function:
int main(int argc, char** argv) { printf("[ %s ]\n", ssdksample); while (1) { // initialize cuda cufunction matrixmul = null; cutildrvsafecallnosync(initcuda(&matrixmul, argc, argv)); ..... }//while (1) cutilexit(); }
so, have same problem in program (after time execution): “nvidia: not open device file /dev/nvidia0 (too many open files).” when comment out dlclose()
in cuda_drvapi_dynlink.c
file – works fine
i can't understand behavior... ideas?
Comments
Post a Comment