NVlabs / NVBit

199 stars 18 forks source link

Could nvbit instrument once and launch for many times? #29

Closed leiwen83 closed 3 years ago

leiwen83 commented 3 years ago

The instrument is time cost process, so whether the tool could support modify code once, then it is left in memory and loaded for running for thereafter while holding the change?

ovilla commented 3 years ago

You should be instrumenting only once, at the first launch of given kernel. Subsequent calls to the same kernel do not need to be instrumented.

To accomplish that you can use a set

std::unordered_set<CUfunction> already_instrumented;

where you put the CUfunction after it is already instrumented, so the next time you encounter the same CUfunction you will not instrument it again.

All the example tools do that, but see the tool instr_count.cu for a small example.

leiwen83 commented 3 years ago

got it. thx