44 this->
V.
width =
static_cast<unsigned int>(num_points);
85 this->kd_tree_values->elements, 0,
NULL,
NULL);
88 this->kd_tree_splits->elements, 0,
NULL,
NULL);
90 if(
m_ret != CL_SUCCESS)
97 unsigned int warpSize = 32;
102 size_t local_item_size =
static_cast<size_t>(warpSize);
103 size_t global_item_size =
static_cast<size_t>(threadsPerBlock);
126 if(
m_ret != CL_SUCCESS)
134 &global_item_size, &local_item_size, 0,
NULL,
NULL);
137 if(
m_ret != CL_SUCCESS)
160 if(
m_ret != CL_SUCCESS)
164 &global_item_size, &local_item_size, 0,
NULL,
NULL);
171 this->Result_Normals.elements, 0,
NULL,
NULL);
173 if(
m_ret != CL_SUCCESS)
209 if( strcmp( method.c_str(),
"PCA") == 0 ){
211 }
else if( strcmp( method.c_str(),
"RANSAC") == 0){
214 printf(
"WARNING: Normal Calculation Method is not implemented\n");
244 this->
m_vx = 1000000.0;
245 this->
m_vy = 1000000.0;
246 this->
m_vz = 1000000.0;
265 if(
m_ret != CL_SUCCESS)
269 if(
m_ret != CL_SUCCESS)
303 if(
m_ret != CL_SUCCESS)
305 std::cerr <<
"ClSurface::loadKernel() - Create Program " <<
getErrorString(
m_ret) << std::endl;
310 printf(
"Error: Failed to create compute program!\n");
317 if (
m_ret != CL_SUCCESS)
322 printf(
"Error: Failed to build program executable!\n");
325 printf(
"%s\n", buffer);
331 if(
m_ret != CL_SUCCESS)
333 std::cerr <<
"ClSurface::loadKernel() - Estimation " <<
getErrorString(
m_ret) << std::endl;
346 if(
m_ret != CL_SUCCESS)
348 std::cerr <<
"ClSurface::loadInterpolationKernel() - Create Program "
354 printf(
"Error: Failed to create compute program!\n");
361 if (
m_ret != CL_SUCCESS)
366 printf(
"Error: Failed to build program executable!\n");
369 printf(
"%s\n", buffer);
375 if(
m_ret != CL_SUCCESS)
377 std::cerr <<
"ClSurface::loadInterpolationKernel() " <<
getErrorString(
m_ret) << std::endl;
386 case 0:
return "CL_SUCCESS";
387 case -1:
return "CL_DEVICE_NOT_FOUND";
388 case -2:
return "CL_DEVICE_NOT_AVAILABLE";
389 case -3:
return "CL_COMPILER_NOT_AVAILABLE";
390 case -4:
return "CL_MEM_OBJECT_ALLOCATION_FAILURE";
391 case -5:
return "CL_OUT_OF_RESOURCES";
392 case -6:
return "CL_OUT_OF_HOST_MEMORY";
393 case -7:
return "CL_PROFILING_INFO_NOT_AVAILABLE";
394 case -8:
return "CL_MEM_COPY_OVERLAP";
395 case -9:
return "CL_IMAGE_FORMAT_MISMATCH";
396 case -10:
return "CL_IMAGE_FORMAT_NOT_SUPPORTED";
397 case -11:
return "CL_BUILD_PROGRAM_FAILURE";
398 case -12:
return "CL_MAP_FAILURE";
399 case -13:
return "CL_MISALIGNED_SUB_BUFFER_OFFSET";
400 case -14:
return "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST";
401 case -15:
return "CL_COMPILE_PROGRAM_FAILURE";
402 case -16:
return "CL_LINKER_NOT_AVAILABLE";
403 case -17:
return "CL_LINK_PROGRAM_FAILURE";
404 case -18:
return "CL_DEVICE_PARTITION_FAILED";
405 case -19:
return "CL_KERNEL_ARG_INFO_NOT_AVAILABLE";
408 case -30:
return "CL_INVALID_VALUE";
409 case -31:
return "CL_INVALID_DEVICE_TYPE";
410 case -32:
return "CL_INVALID_PLATFORM";
411 case -33:
return "CL_INVALID_DEVICE";
412 case -34:
return "CL_INVALID_CONTEXT";
413 case -35:
return "CL_INVALID_QUEUE_PROPERTIES";
414 case -36:
return "CL_INVALID_COMMAND_QUEUE";
415 case -37:
return "CL_INVALID_HOST_PTR";
416 case -38:
return "CL_INVALID_MEM_OBJECT";
417 case -39:
return "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR";
418 case -40:
return "CL_INVALID_IMAGE_SIZE";
419 case -41:
return "CL_INVALID_SAMPLER";
420 case -42:
return "CL_INVALID_BINARY";
421 case -43:
return "CL_INVALID_BUILD_OPTIONS";
422 case -44:
return "CL_INVALID_PROGRAM";
423 case -45:
return "CL_INVALID_PROGRAM_EXECUTABLE";
424 case -46:
return "CL_INVALID_KERNEL_NAME";
425 case -47:
return "CL_INVALID_KERNEL_DEFINITION";
426 case -48:
return "CL_INVALID_KERNEL";
427 case -49:
return "CL_INVALID_ARG_INDEX";
428 case -50:
return "CL_INVALID_ARG_VALUE";
429 case -51:
return "CL_INVALID_ARG_SIZE";
430 case -52:
return "CL_INVALID_KERNEL_ARGS";
431 case -53:
return "CL_INVALID_WORK_DIMENSION";
432 case -54:
return "CL_INVALID_WORK_GROUP_SIZE";
433 case -55:
return "CL_INVALID_WORK_ITEM_SIZE";
434 case -56:
return "CL_INVALID_GLOBAL_OFFSET";
435 case -57:
return "CL_INVALID_EVENT_WAIT_LIST";
436 case -58:
return "CL_INVALID_EVENT";
437 case -59:
return "CL_INVALID_OPERATION";
438 case -60:
return "CL_INVALID_GL_OBJECT";
439 case -61:
return "CL_INVALID_BUFFER_SIZE";
440 case -62:
return "CL_INVALID_MIP_LEVEL";
441 case -63:
return "CL_INVALID_GLOBAL_WORK_SIZE";
442 case -64:
return "CL_INVALID_PROPERTY";
443 case -65:
return "CL_INVALID_IMAGE_DESCRIPTOR";
444 case -66:
return "CL_INVALID_COMPILER_OPTIONS";
445 case -67:
return "CL_INVALID_LINKER_OPTIONS";
446 case -68:
return "CL_INVALID_DEVICE_PARTITION_COUNT";
449 case -1000:
return "CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR";
450 case -1001:
return "CL_PLATFORM_NOT_FOUND_KHR";
451 case -1002:
return "CL_INVALID_D3D10_DEVICE_KHR";
452 case -1003:
return "CL_INVALID_D3D10_RESOURCE_KHR";
453 case -1004:
return "CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR";
454 case -1005:
return "CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR";
455 default:
return "Unknown OpenCL error";
465 cl_uint num_platforms;
468 if(platform_id >= num_platforms)
470 std::cerr <<
"Wrong platform id " << std::endl;
474 cl_platform_id* platforms = (cl_platform_id*)malloc(
sizeof(cl_platform_id) * num_platforms);
477 cl_platform_id platform = platforms[platform_id];
480 checkOclErrors(clGetPlatformInfo(platform, CL_PLATFORM_NAME,
sizeof(buffer), buffer,
NULL));
482 checkOclErrors(clGetPlatformInfo(platform, CL_PLATFORM_VENDOR,
sizeof(buffer), buffer,
NULL));
484 checkOclErrors(clGetPlatformInfo(platform, CL_PLATFORM_VERSION,
sizeof(buffer), buffer,
NULL));
486 checkOclErrors(clGetPlatformInfo(platform, CL_PLATFORM_PROFILE,
sizeof(buffer), buffer,
NULL));
488 checkOclErrors(clGetPlatformInfo(platform, CL_PLATFORM_EXTENSIONS,
sizeof(buffer), buffer,
NULL));
495 if(device_id >= num_devices)
497 std::cerr <<
"Wrong device id " << std::endl;
501 cl_device_id* devices = (cl_device_id*)malloc(
sizeof(cl_device_id) * num_devices);
502 checkOclErrors(clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, num_devices, devices,
NULL));
504 cl_device_id device = devices[device_id];
514 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_NAME,
sizeof(buffer), buffer,
NULL));
518 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_VENDOR,
sizeof(buffer), buffer,
NULL));
521 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_VENDOR_ID,
sizeof(vendor_id), &vendor_id,
NULL));
523 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_VERSION,
sizeof(buffer), buffer,
NULL));
525 checkOclErrors(clGetDeviceInfo(device, CL_DRIVER_VERSION,
sizeof(buffer), buffer,
NULL));
527 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_VERSION,
sizeof(buffer), buffer,
NULL));
529 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_PROFILE,
sizeof(buffer), buffer,
NULL));
531 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_EXTENSIONS,
sizeof(buffer), buffer,
NULL));
533 cl_uint max_compute_units;
534 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_MAX_COMPUTE_UNITS,
535 sizeof(max_compute_units), &max_compute_units,
NULL));
536 this->
m_mps = max_compute_units;
539 cl_uint max_work_item_dimensions;
540 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS,
541 sizeof(max_work_item_dimensions), &max_work_item_dimensions,
NULL));
543 size_t* max_work_item_sizes = (
size_t*)malloc(
sizeof(
size_t) * max_work_item_dimensions);
544 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_SIZES,
545 sizeof(
size_t) * max_work_item_dimensions, max_work_item_sizes,
NULL));
547 free(max_work_item_sizes);
548 size_t max_work_group_size;
549 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_GROUP_SIZE,
550 sizeof(max_work_group_size), &max_work_group_size,
NULL));
557 cl_uint preferred_vector_width_char;
558 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR,
559 sizeof(preferred_vector_width_char), &preferred_vector_width_char,
NULL));
561 cl_uint preferred_vector_width_short;
562 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT,
563 sizeof(preferred_vector_width_short), &preferred_vector_width_short,
NULL));
565 cl_uint preferred_vector_width_int;
566 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT,
567 sizeof(preferred_vector_width_int), &preferred_vector_width_int,
NULL));
569 cl_uint preferred_vector_width_long;
570 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG,
571 sizeof(preferred_vector_width_long), &preferred_vector_width_long,
NULL));
573 cl_uint preferred_vector_width_float;
574 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT,
575 sizeof(preferred_vector_width_float), &preferred_vector_width_float,
NULL));
577 cl_uint preferred_vector_width_double;
578 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE,
579 sizeof(preferred_vector_width_double), &preferred_vector_width_double,
NULL));
581 cl_uint preferred_vector_width_half;
582 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF,
583 sizeof(preferred_vector_width_half), &preferred_vector_width_half,
NULL));
585 cl_uint native_vector_width_char;
586 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR,
587 sizeof(native_vector_width_char), &native_vector_width_char,
NULL));
589 cl_uint native_vector_width_short;
590 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT,
591 sizeof(native_vector_width_short), &native_vector_width_short,
NULL));
593 cl_uint native_vector_width_int;
594 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT,
595 sizeof(native_vector_width_int), &native_vector_width_int,
NULL));
597 cl_uint native_vector_width_long;
598 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG,
599 sizeof(native_vector_width_long), &native_vector_width_long,
NULL));
601 cl_uint native_vector_width_float;
602 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT,
603 sizeof(native_vector_width_float), &native_vector_width_float,
NULL));
605 cl_uint native_vector_width_double;
606 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE,
607 sizeof(native_vector_width_double), &native_vector_width_double,
NULL));
609 cl_uint native_vector_width_half;
610 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF,
611 sizeof(native_vector_width_half), &native_vector_width_half,
NULL));
613 cl_uint max_clock_frequency;
614 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_MAX_CLOCK_FREQUENCY,
615 sizeof(max_clock_frequency), &max_clock_frequency,
NULL));
617 cl_uint address_bits;
619 sizeof(address_bits), &address_bits,
NULL));
621 cl_ulong max_mem_alloc_size;
622 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE,
623 sizeof(max_mem_alloc_size), &max_mem_alloc_size,
NULL));
624 cl_bool image_support;
625 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT,
sizeof(image_support),
626 &image_support,
NULL));
628 size_t max_parameter_size;
629 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_MAX_PARAMETER_SIZE,
630 sizeof(max_parameter_size), &max_parameter_size,
NULL));
632 cl_device_mem_cache_type global_mem_cache_type;
633 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE,
634 sizeof(global_mem_cache_type), &global_mem_cache_type,
NULL));
635 cl_uint global_mem_cacheline_size;
636 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE,
637 sizeof(global_mem_cacheline_size), &global_mem_cacheline_size,
NULL));
638 cl_ulong global_mem_cache_size;
639 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE,
640 sizeof(global_mem_cache_size), &global_mem_cache_size,
NULL));
641 cl_ulong global_mem_size;
643 sizeof(global_mem_size), &global_mem_size,
NULL));
646 cl_ulong max_constant_buffer_size;
647 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE,
648 sizeof(max_constant_buffer_size), &max_constant_buffer_size,
NULL));
649 cl_uint max_constant_args;
650 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_MAX_CONSTANT_ARGS,
sizeof(max_constant_args),
651 &max_constant_args,
NULL));
653 cl_device_local_mem_type local_mem_type;
654 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_LOCAL_MEM_TYPE,
sizeof(local_mem_type),
655 &local_mem_type,
NULL));
659 cl_ulong local_mem_size;
660 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_LOCAL_MEM_SIZE,
sizeof(local_mem_size),
661 &local_mem_size,
NULL));
663 cl_bool error_correction_support;
664 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_ERROR_CORRECTION_SUPPORT,
665 sizeof(error_correction_support), &error_correction_support,
NULL));
667 cl_bool host_unified_memory;
668 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_HOST_UNIFIED_MEMORY,
669 sizeof(host_unified_memory), &host_unified_memory,
NULL));
671 size_t profiling_timer_resolution;
672 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_PROFILING_TIMER_RESOLUTION,
673 sizeof(profiling_timer_resolution), &profiling_timer_resolution,
NULL));
675 cl_bool endian_little;
676 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_ENDIAN_LITTLE,
sizeof(endian_little),
677 &endian_little,
NULL));
680 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_AVAILABLE,
sizeof(available), &available,
NULL));
682 cl_bool compier_available;
683 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_COMPILER_AVAILABLE,
684 sizeof(compier_available), &compier_available,
NULL));
686 cl_bool linker_available;
687 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_LINKER_AVAILABLE,
sizeof(linker_available),
688 &linker_available,
NULL));
690 cl_device_exec_capabilities exec_capabilities;
691 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_EXECUTION_CAPABILITIES,
692 sizeof(exec_capabilities), &exec_capabilities,
NULL));
693 cl_command_queue_properties queue_properties;
694 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_QUEUE_PROPERTIES,
sizeof(queue_properties),
695 &queue_properties,
NULL));
696 size_t printf_buffer_size;
697 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_PRINTF_BUFFER_SIZE,
698 sizeof(printf_buffer_size), &printf_buffer_size,
NULL));
699 cl_bool preferred_interop_user_sync;
700 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_PREFERRED_INTEROP_USER_SYNC,
701 sizeof(preferred_interop_user_sync), &preferred_interop_user_sync,
NULL));
705 cl_uint reference_count;
706 checkOclErrors(clGetDeviceInfo(device, CL_DEVICE_REFERENCE_COUNT,
sizeof(reference_count),
707 &reference_count,
NULL));