I added cutil timers to my multi-gpu code - each GPU thread creates a couple timers, uses them independently, then destroys them. I occasionally get a segmentation fault when starting or stopping the timer:
Core was generated by `./test'. Program terminated with signal 11, Segmentation fault. Cannot access memory at address 0xb7f14000 #0 0x0816947e in StopWatchLinux::getDiffTime (this=0x0) at /usr/local/cudasdk/common/inc/stopwatch_linux.h:178 178 return (float) (1000.0 * ( t_time.tv_sec - start_time.tv_sec) (gdb) bt #0 0x0816947e in StopWatchLinux::getDiffTime (this=0x0) at /usr/local/cudasdk/common/inc/stopwatch_linux.h:178 #1 0x08169439 in StopWatchLinux::stop (this=0x0) at /usr/local/cudasdk/common/inc/stopwatch_linux.h:117 #2 0x0816941f in StopWatchBase<StopWatchLinux>::stop (this=0x0) at /usr/local/cudasdk/common/inc/stopwatch_base.inl:63 #3 0x081664e0 in cutStopTimer (name=39) at src/cutil.cpp:1406 #4 0x080a97a8 in _Z10jachthreadPv (voidparams=0x8af6078) at host_multigpu.cu:1077 #5 0x001703cc in ?? () #6 0x08af6078 in ?? () #7 0x0237aba0 in ?? () #8 0x0237aba0 in ?? () #9 0x0237aba0 in ?? () #10 0x0237a3e0 in ?? () #11 0x00000000 in ?? ()
This would seem to indicate the “StopWatchLinux” object has been destroyed, presumably from a call to cutDeleteTimer in a different thread. Are cutil timers thread safe?