强制Renderscript到CPU或GPU运行(ATLEAST性能优化的目的) [英] Forcing Renderscript to run on CPU or GPU (Atleast for performance tuning purposes)

查看:610
本文介绍了强制Renderscript到CPU或GPU运行(ATLEAST性能优化的目的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个基本算法(DCT / IDCT和其他一些)移植和工作(如预期ATLEAST功能)在Nexus 10。由于这些算法是第一个实现,它们的执行时间是目前运行到秒,这是可以理解的。

不过,鉴于Renderscript的架构,我看到这些算法的CPU或GPU取决于其他并行应用程序的活动运行任。例如,在我的申请,有一个滚动视图的图像和在此视图中的任何活动,基本上推renderscript执行给CPU。如果没有活动的算法在GPU上运行。我看到通过ARM-DS5马里/ A15痕迹此居住。

这情况是presenting本身作为调试/调整噩梦,因为在算法的CPU(双核)与GPU(马里)运行性能增量是2秒的顺序,使得它非常困难的计性能改进,我做我的算法code。

有没有办法来解决这个问题呢?一个可能的解决方案是ATLEAST有一个调试的可配置选项来选择适合renderscript code中的目标类型(ARM,GPU)?

解决方案

 亚行外壳setprop debug.rs.default-CPU驱动1
 

这将强制执行在基准CPU实现运行。没有等同于强制的东西给GPU尽可能多的条件能有这样无法在运行时。

另外有用的是:

 亚行外壳setprop debug.rs.max线程1
 

哪些限制CPU内核的数量被使用到1(或在设置于装置的CPU计数的任何其它值)

I have a few basic algorithms (DCT/IDCT and a few others) ported and working (as expected atleast functionally) on Nexus 10. Since these algorithms are first implementations, their execution time is currently running into secs, which is understandable.

However, given the architecture of Renderscript, I see that these algorithms run either on CPU or GPU depending on other parallel application activities. For instance, in my application, there is a scrollview for images and any activity on this view, essentially pushes the renderscript execution to CPU. If there is no activity the algorithm runs on GPU. I see this live via ARM-DS5 Mali/A15 traces.

This situation is presenting itself as debug/tuning nightmare, since the performance delta when the algorithm runs on CPU (dual core) versus GPU (Mali) is of the order of 2 secs, making it very difficult to gauge the performance improvements that I am doing on my algorithm code.

is there a way to get around this problem? One possible solution is to atleast have a debug configurability option to choose the target type (ARM, GPU) for renderscript code?

解决方案

adb shell setprop debug.rs.default-CPU-driver 1

This will force execution to run on the reference CPU implementation. There is no equivalent to force things to the GPU as many conditions could make that impossible at runtime.

Also useful is:

adb shell setprop debug.rs.max-threads 1

Which limits the number of CPU cores to be used to 1 (or any other value you set up to the CPU count of the device)

这篇关于强制Renderscript到CPU或GPU运行(ATLEAST性能优化的目的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆