Hi favour888,

here is an example of one of my modules that uses CUDA. It is probably
not the nicest way but it works like this:


--- CMakeLists.txt of module ---

project(ModuleName)

#define source files
set(SOURCE_FILES CUDAFILE.cu)
set(HEADER_FILES CUDAFILE.h)

#create library
cuda_add_library(ModuleName_CUDA STATIC ${SOURCE_FILES} ${HEADER_FILES})

#mark some variables as advanced to hide them in the gui (these are
generated by CUDA)
MARK_AS_ADVANCED(CUDA_BUILD_CUBIN)
MARK_AS_ADVANCED(CUDA_BUILD_EMULATION)
MARK_AS_ADVANCED(CUDA_HOST_COMPILER)
MARK_AS_ADVANCED(CUDA_SDK_ROOT_DIR)
MARK_AS_ADVANCED(CUDA_VERBOSE_BUILD)
MARK_AS_ADVANCED(CUDA_SEPARABLE_COMPILATION)

#module
set(COMPILER_VERSION "VC12")
MITK_CREATE_MODULE(${PROJECT_NAME}
    DEPENDS MitkCore
    PACKAGE_DEPENDS Qt5|Core
    ADDITIONAL_LIBS ModuleName_CUDA glew
)

# group in subfolders
set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "modules")


--- CMakeLists.txt of project ---

# Find CUDA package (for module ModuleName[_CUDA])
set(CUDA_TOOLKIT_ROOT_DIR C:/repo/cuda/7.0 CACHE PATH "Toolkit location")
find_package(CUDA REQUIRED)



Best

Martin


On 10.10.2017 09:28, favour888 wrote:
> The MITK (ver: 2014) do not support CUDA feature; however, it should be
> possible to add "cuda_add_executable" or "cuda_add_library" to the source of
> Cmake file for any cuda  .cu file to be compiled inside MITK.  Anyone can
> help how to do it?
> any example ? 
> 
> Thanks  
> 
> 
> 
> --
> Sent from: http://mitk-users.1123740.n5.nabble.com/
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> mitk-users mailing list
> mitk-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mitk-users
> 

-- 


Martin Klemm
Hochschule Offenburg
Badstraße 24
77652 Offenburg
Tel. +49 781 / 205 - 4681
Fax. +49 781 / 205 - 45 4681

<<attachment: martin_klemm.vcf>>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to