unstable cuda visual profiler failures due to file write permission file write permission of unknown

cuda visual profile failed with the following error:
File write operation failed

Failed while flushing trace record buffers

File write operation failed

Failed while flushing trace record buffers

The even log reads like this:

Faulting application name: apps.exe, version: 2.20.2214.0, time stamp: 0x4eb1b50a
Faulting module name: cudaapitrace64.dll, version:, time stamp: 0x4d554080
Exception code: 0xc0000005
Fault offset: 0x000000000001207f
Faulting process id: 0x28c4
Faulting application start time: 0x01cc9b08d4d1a429
Faulting application path: …\apps.exe
Faulting module path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\computeprof\bin\cudaapitrace64.dll
Report Id: 1d488b19-06fc-11e1-b5f4-00259027a06d

the application runs fine without visual profiler.

It could work again after shutdowning/startup a few times of cuda visual profile, and changed visual profiler’s temp working folder permissions.

I don’t have a clue of which file and folder would cause the problem.

This is an error related to collecting CUDA API trace data. Note that the trace data is written to “profilerapitrace_%d.trc” - one file per context where “%d” is replaced by the context id. These files are created in the “Working directory” which is selected in the “Session settings” dialog.

This issue may be caused if the working directory is not writable or if the there is a file with the same name (“profilerapitrace_%d.trc”) already existing & the file permissions are such that it cannot be overwritten.