[Insight-users] ITK4 and GPU with OpenCL. How to compile?

Denis Shamonin dshamoni at gmail.com
Tue May 17 09:42:30 EDT 2011


Dear All,

We are very interested to try the current  ITK4 GPU implementation with OpenCL.
But unfortunately the CMake files ITK4\Modules\GPU are not finished
and have status To Be Done ( itk-module-TBD.cmake )
After spending some time to compile and fixing Cmake files for this
module. I've decided to ask here.

Could you point me to exact steps I have to follow to add
ITK-GPUCommon module? So, That I could start playing.
I've almost made it with some hacks all around.
Does anyone have working solution to share with tests included? That
would be great.

BTW: I've spotted error in GPUMeanImageFilter.cl

    for(int z = max(0, (int)(giz-radiusz)); z <= min((int)(depth-1),
(int)giz+radiusz)); z++)  line : 81 <- wrong
    for(int z = max(0, (int)(giz-radiusz)); z <= min((int)(depth-1),
(int)(giz+radiusz)); z++) line : 81 <- correct

Thank you,
-Denis

-------------------------------------------------------------------------------------------------------------------------------------------
My current CMakeList.txt for this module look like this:

project(ITK-GPUCommon)

IF (ITK_USE_GPU)
	FIND_PACKAGE( OpenCL REQUIRED )

  FILE(GLOB itkGPUSRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src *.cl)
  FILE(GLOB itkGPUHDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/include *.h)
  FILE(GLOB itkTxxSRC  RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/include *.txx)

  SOURCE_GROUP("OpenCL Source Files" FILES ${itkGPUSRC})

  FILE(COPY ${itkGPUSRC} DESTINATION ${ITK_BINARY_DIR}/GPU/Common)
  MESSAGE( "OpenCL files to copy " ${itkGPUSRC} )

	INCLUDE_DIRECTORIES(
	${OPENCL_INCLUDE_DIRS}
	)

ENDIF(ITK_USE_GPU)

set(ITK-GPUCommon_LIBRARIES ITK-GPUCommon)
configure_file(src/pathToOpenCLSourceCode.h.in pathToOpenCLSourceCode.h)

itk_module_impl()

#install(FILES
#  pathToOpenCLSourceCode.h	
#  DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}
#  )


More information about the Insight-users mailing list