【发布时间】:2017-04-28 08:54:26
【问题描述】:
我有一个 EC2 实例。它的规格是:
g2.2xlarge Instance.
Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz
NVIDIA GRID GPU (Kepler GK104) with
Ubuntu 14.04 - 64 bit.
在此之后: https://stackoverflow.com/a/41103241/1900929,我从 https://developer.nvidia.com/cuda-downloads 安装了 CUDA 工具包 8.0。我还安装了 "clinfo"。
然后我运行 clinfo 来检查 OpenCL 的状态 - 它正在使用以下输出:
clinfo: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libOpenCL.so.1: no version information available (required by clinfo)
Platform Version: OpenCL 1.2 CUDA 8.0.46
Platform Name: NVIDIA CUDA
Platform Vendor: NVIDIA Corporation
Number of devices: 1
Device Type: CL_DEVICE_TYPE_GPU
Name: GRID K520
Vendor: NVIDIA Corporation
Device OpenCL C version: OpenCL C 1.2
Driver version: 367.57
Profile: FULL_PROFILE
Version: OpenCL 1.2 CUDA
//with other info too which I can paste if required.
此时我认为,由于 OpenCL 正在运行,所以我的程序也可以运行。所以我移动了使用 OpenCL(c++ 包装器)的程序。但后来它给了我以下错误:
clGetDeviceIDs(-32)
这个错误是指CL_INVALID_PLATFORM - 如果给出了一个无效的平台
现在我不知道是不是 GPU 的问题 - NVIDIA GRID GPU (Kepler GK104)。或者,如果它试图将 CPU - Intel(R) Xeon(R) CPU 作为第一个和/或唯一的平台。
这是给我错误的代码 sn-p:
try {
// Create a "platforms" vector.
std::vector<cl::Platform> platforms;
// Get all the platforms
cl::Platform::get(&platforms);
// Create an array of platforms to save the platforms in.
cl::Platform * platform = new cl::Platform[platforms.size()];
// Create a "devices" vector.
std::vector<cl::Device> devices;
// Get all the "devices" for each "platform"
for (int platformCounter = 0; platformCounter < platforms.size(); platformCounter++) {
platform[platformCounter].getDevices(CL_DEVICE_TYPE_GPU, &devices);
}
}
错误的可能原因是什么?
【问题讨论】:
标签: amazon-ec2 opencl gpu nvidia platform