我在论坛Are either the IPad or IPhone capable of OpenCL?上发现了这个帖子,但是它是不是很老了?此外,我可以收集到的是,OpenCL可用于iOS的系统库,但不能用于公共库。在这方面有更多的信息或任何更新吗?
发布于 2015-02-02 14:40:13
即使使用OpenCL作为私有框架,基于iOS的也不会给你带来GPU (或者其他像DSP/FPGA,如果存在)的好处。它只是在arm处理器上提供了多个可用内核。我运行了以下代码来验证在iOS和OS中可以访问的OpenCL设备。
iOS上的输出
ARM处理器设备
OS X上的输出
Radeon HD 4670
英特尔(R)酷睿(TM) i3处理器540 @3.07 540
排除了错误检查的源。使用可用的OpenCL标头()和从(/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/PrivateFrameworks)链接OpenCL
#include "OpenCL/cl.h"
#include <iostream>
cl_context_properties prop[] = { CL_CONTEXT_PLATFORM, 0, 0 };
//get num of platforms
cl_uint num;
cl_int err = clGetPlatformIDs(0, 0, &num);
//get each platform
cl_platform_id *platforms = new cl_platform_id[num];
err = clGetPlatformIDs(num, platforms, &num);
//create context for platform
prop[1] = (cl_context_properties) platforms[0];
cl_context context = clCreateContextFromType(prop, CL_DEVICE_TYPE_ALL, NULL, NULL, &err);
//get num devices
size_t numDevices=0;
clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &numDevices);
cl_device_id *devices = new cl_device_id[ numDevices ];
//get every device
clGetContextInfo(context, CL_CONTEXT_DEVICES, numDevices, devices, 0);
//get info of every device
for( int idx=0; idx < numDevices; ++idx) {
size_t bufSize=0;
clGetDeviceInfo(devices[idx], CL_DEVICE_NAME, 0, NULL, &bufSize);
if( bufSize > 0 ) {
char* devName = new char[ bufSize ];
clGetDeviceInfo(devices[idx], CL_DEVICE_NAME, bufSize, devName, 0);
std::cout << "Device Name: " << devName << '\n';
}
}建议:到目前为止,我们需要使用OpenGL(2)或加速框架(3)。仍然不确定,出于什么原因/目的,在iPhone上复制OpenCL作为私有框架。
发布于 2013-09-17 18:48:19
只能通过内网接口获取。
https://stackoverflow.com/questions/18847255
复制相似问题