Determining if Renderscript works on CPU / GPU and number of threads

I cannot find documentation on how to check if RenderScript really parallelizes the code. I would like to know if a processor or GPU is being used, and the number of streams sent.

The only thing I found was an error report: http://code.google.com/p/android/issues/detail?id=28662

The author mentions that installing rsForEach in a script led to its serialization, 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 to find a similar line in LogCat, but I could not find a match.

Any thoughts?

Update: Actually, I seem to understand this. It seems to me that my LogCat foo is not as good as it should be. I filtered out the debug output according to my application information and found the following line:

 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 
+4
source share
2 answers

This will show you how many processors can be used. This will not indicate how many threads or which processor is being used. RS design do not expose this information

In general, RS will use all available CPU cores unless you call a "sequential" function, such as rsg * or time functions. As for which criteria will cause the script to be dropped from the GPU to the CPU, this will depend on the capabilities of each GPU-manufacturer.

The bug you referred to is fixed: 4.1

+2
source

I ran into the same problem when I was working with RS. I used Nexus 5 for testing. I found that the initial launch of RS uses a CPU instead of using a GPU, this is verified using the Trepn 5.0 application. Later, I discovered that the Nexus-5 GPU does not support double precision ( Link to Adreno 330 ), so by default it transfers it to the CPU. To overcome this, I used the #pragma rs_fp_relaxed top of my rs file along with the header declarations.

Therefore, if you strictly want to transfer it to a GPU, it is best to find out what characteristics of your mobile GPU are and try to use a trick and measure GPU usage using Trepn 5.0 or a similar application. At the moment, RS does not disclose information about the level of the stream, but during implementation we can use the x and y arguments of our root - Kernel as stream indices.

+2
source

All Articles