return (-1);
}
- uint CL_platform_sel = 0;
+ uint CL_platform_sel = 1;
+
+ if (opencl_platform != NULL)
+ {
+ CL_platform_sel = atoi (opencl_platform);
+ }
if (CL_platforms_cnt > 1)
{
}
else
{
- CL_platform_sel = atoi (opencl_platform);
-
if (CL_platform_sel > CL_platforms_cnt)
{
log_error ("ERROR: invalid OpenCL platforms selected");
return (-1);
}
+ }
+ }
+ else
+ {
+ if (CL_platform_sel != 1)
+ {
+ log_error ("ERROR: OpenCL platform number %d not available", CL_platform_sel);
- // user does not count with zero
-
- CL_platform_sel -= 1;
+ return (-1);
}
}
+ // zero-indexed: not starting to count at 1, as user does
+
+ CL_platform_sel -= 1;
+
+
cl_platform_id CL_platform = CL_platforms[CL_platform_sel];
char CL_platform_vendor[INFOSZ];