umask (077);
+ /**
+ * There's some buggy OpenCL runtime that do not support -I.
+ * A workaround is to chdir() to the OpenCL folder,
+ * then compile the kernels,
+ * then chdir() back to where we came from so we need to save it first
+ */
+
+ char cwd[1024];
+
+ if (getcwd (cwd, sizeof (cwd) - 1) == NULL)
+ {
+ log_error ("ERROR: getcwd(): %s", strerror (errno));
+
+ return -1;
+ }
+
/**
* Real init
*/
if (CL_err != CL_SUCCESS)
{
- log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
+ //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
- return -1;
+ //return -1;
+
+ // Silently ignore at this point, it will be reused later and create a note for the user at that point
+
+ continue;
}
for (uint platform_devices_id = 0; platform_devices_id < platform_devices_cnt; platform_devices_id++)
cl_platform_id platform = platforms[platform_id];
- CL_err = hc_clGetDeviceIDs (data.ocl, platform, CL_DEVICE_TYPE_ALL, DEVICES_MAX, platform_devices, &platform_devices_cnt);
-
- if (CL_err != CL_SUCCESS)
- {
- log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
-
- return -1;
- }
-
char platform_vendor[INFOSZ] = { 0 };
CL_err = hc_clGetPlatformInfo (data.ocl, platform, CL_PLATFORM_VENDOR, sizeof (platform_vendor), platform_vendor, NULL);
platform_vendor_id = VENDOR_ID_GENERIC;
}
- const uint platform_skipped = ((opencl_platforms_filter & (1 << platform_id)) == 0);
+ uint platform_skipped = ((opencl_platforms_filter & (1 << platform_id)) == 0);
+
+ CL_err = hc_clGetDeviceIDs (data.ocl, platform, CL_DEVICE_TYPE_ALL, DEVICES_MAX, platform_devices, &platform_devices_cnt);
+
+ if (CL_err != CL_SUCCESS)
+ {
+ //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
+
+ //return -1;
+
+ platform_skipped = 2;
+ }
if ((benchmark == 1 || quiet == 0) && (algorithm_pos == 0))
{
log_info (line);
}
- else
+ else if (platform_skipped == 1)
{
log_info ("OpenCL Platform #%u: %s, skipped", platform_id + 1, platform_vendor);
log_info ("");
}
+ else if (platform_skipped == 2)
+ {
+ log_info ("OpenCL Platform #%u: %s, skipped! No OpenCL compatible devices found", platform_id + 1, platform_vendor);
+ log_info ("");
+ }
}
}
"inc_vendor.cl",
};
- for (int i = 0; i < files_cnt; i++)
+ if (chdir (cpath_real) == -1)
{
- char path[1024] = { 0 };
+ log_error ("ERROR: %s: %s", cpath_real, strerror (errno));
- snprintf (path, sizeof (path) - 1, "%s/%s", cpath_real, files_names[i]);
+ return -1;
+ }
- FILE *fd = fopen (path, "r");
+ for (int i = 0; i < files_cnt; i++)
+ {
+ FILE *fd = fopen (files_names[i], "r");
if (fd == NULL)
{
- log_error ("ERROR: %s: fopen(): %s", path, strerror (errno));
+ log_error ("ERROR: %s: fopen(): %s", files_names[i], strerror (errno));
return -1;
}
if (n != 1)
{
- log_error ("ERROR: %s: fread(): %s", path, strerror (errno));
+ log_error ("ERROR: %s: fread(): %s", files_names[i], strerror (errno));
return -1;
}
local_free (kernel_sources);
}
+ // return back to the folder we came from initially (workaround)
+
+ if (chdir (cwd) == -1)
+ {
+ log_error ("ERROR: %s: %s", cwd, strerror (errno));
+
+ return -1;
+ }
+
// some algorithm collide too fast, make that impossible
if (benchmark == 1)