1

By using the adb tools, we can force Renderscript code to run on CPU before the program launches, as mentioned in Forcing Renderscript to run on CPU or GPU (Atleast for performance tuning purposes). I'm wondering if there's a switch to programmatically force code to run on CPU in code? Thank you!

Community
  • 1
  • 1
Jimmy Ren
  • 397
  • 3
  • 14
  • What result are you looking to achieve by forcing to the CPU? Latency, power, leave GPU for graphics, other ? – R. Jason Sams Nov 22 '13 at 18:26
  • @R.JasonSams Thanks a lot for the reply. There are certain situations I might need to do this. The situations are listed but not limited as follows. 1. leave GPU for graphics; 2. certain algorithms are more suitable to run on multi-core CPU than on GPU, if can't be satisfactorily optimized for GPU, I'd like to let it to run on CPU for speed; 3. There are certain renderscript functions are very slow in some GPU, e.g. I tried the pow() function and its variants on a Qualcomm Adreno 330 GPU (in Nexus 5), and turned this function is extremely slow in the current implementation. – Jimmy Ren Nov 27 '13 at 15:56
  • cont. Once such issue can't be avoided (in pow() case, I can avoid it by using other functions, it may not be the case for others), I tend to manually switch the code to CPU. Is there any way to do this programmatically? – Jimmy Ren Nov 27 '13 at 15:57
  • Actually I'm also interested in enforcing CPU execution instead of GPU. The reason is explained here: https://stackoverflow.com/q/50548979/15139. Is there a way to programmatically enforce it similar to enabling `debug.rs.default-CPU-driver` flag? – rpattabi May 28 '18 at 08:20

0 Answers0