How does Cuda Visual Profiler works? (text mode)

Good day.

I’m building a C++ program which works this way:

Receives two input files, and a Cuda program. The input files are this way:

data…
data…
/////
some more data…
/////

So, it collects the data between the separators, then creates a file with them, and passes it to the cuda program, which is expecting it as an argument. This way, I can run the same program, various times, with different types of data.

But my problem is, I want cuda profiler to do a output file for each of the program runs, let’s say, logrun1.txt, logrun2.txt, logrun3.txt…

My program sets the environment variables needed by the cuda profiler, then it runs the cuda program, the first log gets generated, the second doesn’t, the third does, the fourth doens’t! And so on…

I’ve solved the problem with: System::Threading::Thread::CurrentThread->Sleep(1000); so my program waits a second before launching the program again, and all the logs are generated correctly. But this isn’t a good solution…

Can anyone tell me how Cuda Profiler works? It’s just the environment variables? There isn’t a process who runs when a cuda program is running, so I can wait for it to finish?

I’ve read all the documentation, but didn’t find anything…

Thanks in advance.