|
|
@ -292,7 +292,7 @@ int Hardware_Caster::acquire_platform_and_device() {
|
|
|
|
|
|
|
|
|
|
|
|
// Check to see if we even have OpenCL on this machine
|
|
|
|
// Check to see if we even have OpenCL on this machine
|
|
|
|
if (deviceIdCount == 0) {
|
|
|
|
if (deviceIdCount == 0) {
|
|
|
|
std::cout << "There appears to be no platforms supporting OpenCL" << std::endl;
|
|
|
|
std::cout << "There appears to be no devices, or none at least supporting OpenCL" << std::endl;
|
|
|
|
return OPENCL_NOT_SUPPORTED;
|
|
|
|
return OPENCL_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -372,6 +372,10 @@ int Hardware_Caster::acquire_platform_and_device() {
|
|
|
|
|
|
|
|
|
|
|
|
// Upon success of a condition, set the current best device values
|
|
|
|
// Upon success of a condition, set the current best device values
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (strcmp(device.version, "OpenCL 1.2 ") == 0 && strcmp(device.version, current_best_device.version) != 0) {
|
|
|
|
|
|
|
|
// current_best_device = device;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
// If the current device is not a GPU and we are comparing it to a GPU
|
|
|
|
// If the current device is not a GPU and we are comparing it to a GPU
|
|
|
|
if (device.type == CL_DEVICE_TYPE_GPU && current_best_device.type != CL_DEVICE_TYPE_GPU) {
|
|
|
|
if (device.type == CL_DEVICE_TYPE_GPU && current_best_device.type != CL_DEVICE_TYPE_GPU) {
|
|
|
|
current_best_device = device;
|
|
|
|
current_best_device = device;
|
|
|
@ -453,6 +457,8 @@ int Hardware_Caster::create_shared_context() {
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create our shared context
|
|
|
|
// Create our shared context
|
|
|
|
context = clCreateContext(
|
|
|
|
context = clCreateContext(
|
|
|
|
context_properties,
|
|
|
|
context_properties,
|
|
|
@ -518,7 +524,8 @@ int Hardware_Caster::compile_kernel(std::string kernel_source, bool is_path, std
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Try and build the program
|
|
|
|
// Try and build the program
|
|
|
|
error = clBuildProgram(program, 1, &device_id, "-cl-finite-math-only -cl-fast-relaxed-math -cl-unsafe-math-optimizations", NULL, NULL);
|
|
|
|
// "-cl-finite-math-only -cl-fast-relaxed-math -cl-unsafe-math-optimizations"
|
|
|
|
|
|
|
|
error = clBuildProgram(program, 1, &device_id, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
// Check to see if it errored out
|
|
|
|
// Check to see if it errored out
|
|
|
|
if (vr_assert(error, "clBuildProgram")) {
|
|
|
|
if (vr_assert(error, "clBuildProgram")) {
|
|
|
@ -901,6 +908,12 @@ bool Hardware_Caster::vr_assert(int error_code, std::string function_name) {
|
|
|
|
case CL_INVALID_DEVICE_PARTITION_COUNT:
|
|
|
|
case CL_INVALID_DEVICE_PARTITION_COUNT:
|
|
|
|
err_msg = "CL_INVALID_DEVICE_PARTITION_COUNT";
|
|
|
|
err_msg = "CL_INVALID_DEVICE_PARTITION_COUNT";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR :
|
|
|
|
|
|
|
|
err_msg = "CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CL_PLATFORM_NOT_FOUND_KHR :
|
|
|
|
|
|
|
|
err_msg = "CL_PLATFORM_NOT_FOUND_KHR";
|
|
|
|
|
|
|
|
break;
|
|
|
|
case RayCaster::SHARING_NOT_SUPPORTED:
|
|
|
|
case RayCaster::SHARING_NOT_SUPPORTED:
|
|
|
|
err_msg = "SHARING_NOT_SUPPORTED";
|
|
|
|
err_msg = "SHARING_NOT_SUPPORTED";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|