renderscript

Determining whether Renderscript is running on CPU/GPU & Number of Threads


I can't seem to find any documentation on how to check if RenderScript is actually parallelizing code. I'd like to know whether the CPU or GPU is being utilized and the number of threads dispatched.

The only thing I've found is this bug report: http://code.google.com/p/android/issues/detail?id=28662

The author mentions that putting rsForEach in the script resulted it it being serialized by pointing to the following debug output:

01-02 00:21:59.960: D/RenderScript(1256): = 0  0x0
01-02 00:21:59.976: D/RenderScript(1256): = 1  0x1

I tried searching for a similar string in LogCat, but I haven't been able to find a match.

Any thoughts?

Update: Actually I seem to have figured it out. It just seems that my LogCat foo isn't as good as it should be. I filtered the debug output by my application information and found a line like this:

02-26 22:30:05.657: V/RenderScript(26113): rsContextCreate dev=0x5cec0458
02-26 22:30:05.735: V/RenderScript(26113): 0x5d9f63b8 Launching thread(s), CPUs 2

Solution

  • This will only tell you how many CPUs could be used. This will not indicate how many threads or which processor is being used. By design RS avoid exposing this information

    In general RS will use all the available CPU cores unless you call a "serial" function such as the rsg* or time functions. As to what criteria will result in a script being punted from the GPU to CPU, this will vary depending on the abilities of each vendors GPU.

    The bug you referenced has been fixed in 4.1