NVIDIA OpenCL实现C++ API问题

ErrorErro 2014-05-24 09:03:45
NVIDIA CUDA Toolkit 6.0中没有提供C+ API(cl.hpp),所以我从khronos下载了一个OpenCL 1.1的cl.hpp
然后,如下代码
#include <iostream>
#include <CL\cl.hpp>
#include <vector>
#include <string>


using namespace std;

int main()
{
std::vector<cl::Platform> platformList;
cl::Platform::get(&platformList);
for (int i = 0; i < platformList.size(); ++i)
{
std::string cppname;
std::string cppversion;
std::string cppverndor;
std::string cppprofile;
platformList[i].getInfo(CL_PLATFORM_NAME, &cppname);
platformList[i].getInfo(CL_PLATFORM_VERSION, &cppversion);
platformList[i].getInfo(CL_PLATFORM_VENDOR, &cppverndor);
platformList[i].getInfo(CL_PLATFORM_PROFILE, &cppprofile);
cout << "OpenCL平台:" << cppname << "\n"
<< "OpenCL版本:" << cppversion << "\n"
<< "OpenCL开发商:" << cppverndor << "\n"
<< "OpenCL简档:" << cppprofile << "\n" << "\n" << endl;
}
cin.get();
return 0;
}

编译错误:错误 1 error C2664: “cl_int clEnqueueNativeKernel(cl_command_queue,void (__stdcall *)(void *),void *,size_t,cl_uint,const cl_mem *,const void **,cl_uint,const cl_event *,cl_event *)”: 无法将参数 2 从“void (__cdecl *)(void *)”转换为“void (__stdcall *)(void *)” c:\program files\nvidia gpu computing toolkit\cuda\v6.0\include\cl\cl.hpp 2996 1 OpenCLExample
错误指向的是cl.hpp中的一个函数,这是么情况?NVIDIA 的OpenCL事先到底支持不支持C++ API?如何解决
...全文
427 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
Using the new OpenCL (Open Computing Language) standard, you can write applications that access all available programming resources: CPUs, GPUs, and other processors such as DSPs and the Cell/B.E. processor. Already implemented by Apple, AMD, Intel, IBM, NVIDIA, and other leaders, OpenCL has outstanding potential for PCs, servers, handheld/embedded devices, high performance computing, and even cloud systems. This is the first comprehensive, authoritative, and practical guide to OpenCL 1.1 specifically for working developers and software architects. Written by five leading OpenCL authorities, OpenCL Programming Guide covers the entire specification. It reviews key use cases, shows how OpenCL can express a wide range of parallel algorithms, and offers complete reference material on both the API and OpenCL C programming language. Through complete case studies and downloadable code examples, the authors show how to write complex parallel programs that decompose workloads across many different devices. They also present all the essentials of OpenCL software performance optimization, including probing and adapting to hardware. Coverage includes Understanding OpenCL’s architecture, concepts, terminology, goals, and rationale Programming with OpenCL C and the runtime API Using buffers, sub-buffers, images, samplers, and events Sharing and synchronizing data with OpenGL and Microsoft’s Direct3D Simplifying development with the C++ Wrapper API Using OpenCL Embedded Profiles to support devices ranging from cellphones to supercomputer nodes Case studies dealing with physics simulation; image and signal processing, such as image histograms, edge detection filters, Fast Fourier Transforms, and optical flow; math libraries, such as matrix multiplication and high-performance sparse matrix multiplication; and more Source code for this book is available at https://code.google.com/p/opencl-book-samples/

603

社区成员

发帖
与我相关
我的任务
社区描述
异构开发技术
社区管理员
  • OpenCL和异构编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧