I am using SDK opencl. but when debuging code belw, error is occured(error:fatal error LNK1207: there is the type of PDB which is not compatible. after removing, retry it)
i don’t konw why this is occured, could you give the solution to me?
<CODE>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <CL/opencl.h>
void DisplayPlatformInfo(
cl_platform_id id,
cl_platform_info name,
char *str);
int main(){
printf("
------------ Platform & Device Information ------------
");
cl_int err,i,j;
size_t size;
cl_uint numPlatforms, numDevices;
cl_platform_id *platformIDs;
cl_device_id *deviceIDs;
cl_context context =NULL;
char dev_name[100];
char dev_vendor_name[100];
cl_int dev_max_wg;
cl_int dev_max_cu;
size_t dev_max_wi[3];
//플랫폼의 수를 질의한다
err=clGetPlatformIDs(0,NULL,&numPlatforms);
if(err != CL_SUCCESS) {
printf("##Error: clGetPlatformIDs
“);
printf(”##Failed to find any OpenCL platforms
“);
exit(1);
}else{
printf(” (1) Number of OpenCL plarforms : %d
",numPlatforms);
}
//플랫폼 목록들을 할당하고 ID를 질의한다.
platformIDs=(cl_platform_id *)malloc(sizeof(cl_platform_id)*numPlatforms);
err=clGetPlatformIDs(numPlatforms,platformIDs,NULL);
if(err != CL_SUCCESS) {
printf("##Error: clGetPlatformIDs
“);
printf(”##Failed to find any OpenCL platforms
“);
exit(1);
}else{
printf(” (2) Infomation of each plarform
“);
for(i=0;i<numPlatforms; i++){
printf(” ------------------------
“);
printf(” OpenCL platform[%d]
“,i);
printf(” ------------------------
");
DisplayPlatformInfo(platformIDs[i],CL_PLATFORM_PROFILE,“CL_PLATFORM_PROFILE”);
DisplayPlatformInfo(platformIDs[i],CL_PLATFORM_VERSION,"CL_PLATFORM_VERSION");
DisplayPlatformInfo(platformIDs[i],CL_PLATFORM_VENDOR,"CL_PLATFORM_VENDOR");
}
}
printf(" ------------------------
");
//각 플랫폼 내부의 GPU 디바이스 수를 질의한다.
for(i=0;i<numPlatforms; i++){
err=clGetDeviceIDs(platformIDs[i],
CL_DEVICE_TYPE_GPU,
0,
NULL,
&numDevices);
if(err != CL_SUCCESS||numDevices<1) {
printf("##Error: clGetDeviceIDs%d
“,i);
printf(”##Failed to find GPU devices
“);
exit(1);
}else{
printf(” (3) Number of OpenCL devices in platform[%d] : %d
",i, numPlatforms);
deviceIDs=(cl_device_id *)malloc(sizeof(cl_device_id)*numDevices);
for(j=0;j<numDevices;j++){
printf(" ------------------------
“);
printf(” OpenCL device[%d]
“,i);
printf(” ------------------------
“);
err=clGetDeviceIDs(
platformIDs[i],
CL_DEVICE_TYPE_GPU,
numDevices,
deviceIDs,
NULL);
if(err != CL_SUCCESS) {
printf(”##Error: clGetDeviceIDs%d
“,i);
printf(”##Failed to find GPU devices
");
exit(1);
}
err=clGetDeviceInfo(
deviceIDs[j],
CL_DEVICE_NAME,
sizeof(dev_name),
dev_name,
NULL);
if(err != CL_SUCCESS) {
printf("##Error: clGetDeviceInfo
“);
exit(1);
}else{
printf(” DEVICE NAME: [%s]
",dev_name);
}
err=clGetDeviceInfo(
deviceIDs[j],
CL_DEVICE_VENDOR,
sizeof(dev_vendor_name),
dev_vendor_name,
NULL);
if(err != CL_SUCCESS) {
printf("##Error: clGetDeviceInfo
“);
exit(1);
}else{
printf(” DEVICE NAME: [%s]
",dev_vendor_name);
}
err=clGetDeviceInfo(
deviceIDs[j],
CL_DEVICE_MAX_WORK_GROUP_SIZE,
sizeof(dev_max_wg),
&dev_max_wg,
NULL);
if(err != CL_SUCCESS) {
printf("##Error: clGetDeviceInfo
“);
exit(1);
}else{
printf(” DEVICE MAX WORK GPOUP SIZE: [%d]
“,dev_max_wg);
}
err=clGetDeviceInfo(
deviceIDs[j],
CL_DEVICE_MAX_COMPUTE_UNITS,
sizeof( dev_max_cu),
& dev_max_cu,
NULL);
if(err != CL_SUCCESS) {
printf(”##Error: clGetDeviceInfo
“);
exit(1);
}else{
printf(” DEVICE MAX WORK COMPUTE UNITS: [%d]
“,dev_max_cu);
}
err=clGetDeviceInfo(
deviceIDs[j],
CL_DEVICE_MAX_WORK_ITEM_SIZES,
sizeof( dev_max_wi),
dev_max_wi,
NULL);
if(err != CL_SUCCESS) {
printf(”##Error: clGetDeviceInfo
“);
exit(1);
}else{
printf(” DEVICE MAX WORK ITEM SIZES: [%d,%d,%d]
", dev_max_wi[0], dev_max_wi[1], dev_max_wi[2]);
}
}
}
}
free(platformIDs);
free(deviceIDs);
}
void DisplayPlatformInfo(
cl_platform_id id,
cl_platform_info name,
char *str){
cl_int err;
size_t val_size;
char *info;
err=clGetPlatformInfo(
id,
name,
0,
NULL,
&val_size);
if(err != CL_SUCCESS) {
printf("##Error: DisplayPlatformInfo
");
exit(1);
}
info=(char *)malloc(sizeof(char)*val_size);
err=clGetPlatformInfo(
id,
name,
val_size,
info,
NULL);
if(err != CL_SUCCESS) {
printf("##Error: DisplayPlatformInfo
“);
exit(1);
}else{
printf(” %s: [%s]
",str,info);
}
free(info);
}