Commit 31cb1fc5 authored by Oliver Bock's avatar Oliver Bock
Browse files

Fixed device enumeration

parent 52a34664
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
#include <float.h> #include <float.h>
#define eps_avg 10.0 #define eps_avg 10.0
#define MAX_DEVICES 16
#define MAX( _a, _b) ((_a)>(_b)?(_a) : (_b)) #define MAX( _a, _b) ((_a)>(_b)?(_a) : (_b))
typedef enum { typedef enum {
...@@ -719,7 +719,7 @@ int main (int argc, char * const argv[]) { ...@@ -719,7 +719,7 @@ int main (int argc, char * const argv[]) {
clFFT_DataFormat dataFormat = clFFT_SplitComplexFormat; clFFT_DataFormat dataFormat = clFFT_SplitComplexFormat;
clFFT_Dimension dim = clFFT_1D; clFFT_Dimension dim = clFFT_1D;
clFFT_TestType testType = clFFT_OUT_OF_PLACE; clFFT_TestType testType = clFFT_OUT_OF_PLACE;
cl_device_id device_ids[16]; cl_device_id device_ids[MAX_DEVICES];
FILE *paramFile; FILE *paramFile;
...@@ -741,6 +741,7 @@ int main (int argc, char * const argv[]) { ...@@ -741,6 +741,7 @@ int main (int argc, char * const argv[]) {
printf("ERROR: clGetPlatformIDs failed with error: %d\n", status); printf("ERROR: clGetPlatformIDs failed with error: %d\n", status);
return -1; return -1;
} }
if (0 < numPlatforms) { if (0 < numPlatforms) {
cl_platform_id* platforms = new cl_platform_id[numPlatforms]; cl_platform_id* platforms = new cl_platform_id[numPlatforms];
status = clGetPlatformIDs(numPlatforms, platforms, NULL); status = clGetPlatformIDs(numPlatforms, platforms, NULL);
...@@ -789,7 +790,7 @@ int main (int argc, char * const argv[]) { ...@@ -789,7 +790,7 @@ int main (int argc, char * const argv[]) {
printf("INFO: Using OpenCL platform provided by: %s\n", vendor); printf("INFO: Using OpenCL platform provided by: %s\n", vendor);
} }
err = clGetDeviceIDs(platform, device_type, sizeof(device_ids), device_ids, &num_devices); err = clGetDeviceIDs(platform, device_type, MAX_DEVICES, device_ids, &num_devices);
if(err) if(err)
{ {
printf("ERROR: clGetDeviceIDs failed with error: %d\n", err); printf("ERROR: clGetDeviceIDs failed with error: %d\n", err);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment