[prev in list] [next in list] [prev in thread] [next in thread] 

List:       insight-users
Subject:    Re: [ITK-users] Create ITK Project with CUDA from CMake
From:       "D'Isidoro  Fabio" <fisidoro () ethz ! ch>
Date:       2017-03-23 17:41:15
Message-ID: 50B858FB5F53124F9E32314E5C1B40944596525D () MBX212 ! d ! ethz ! ch
[Download RAW message or body]

[Attachment #2 (text/plain)]

Thank you very much Jose,

I can't make your example work, but I am not sure I have been doing the right things. \
If you can help me:

I am using Visual Studio, Windows 10. My directory looks like:

CUDAitk/
               src/
                     CUDAitk.cu
                     CMakeLists.txt
                     CUDApart/
                                        CUDApart.cu
                                        CMakeLists.txt
               bin/

where

----------- CUDAitk/CUDApart/CMakeLists.txt -----------

FIND_PACKAGE(CUDA REQUIRED)

set (CUDA_NVCC_FLAGS "-g -G -lineinfo" CACHE STRING "nvcc flags" FORCE)

SET (CUDA_VERBOSE_BUILD ON CACHE BOOL "nvcc verbose" FORCE)

SET(LIB_TYPE STATIC)    #set the lib type
CUDA_ADD_LIBRARY(CUDAPart ${LIB_TYPE} CUDApart.h CUDApart.cu )

-----------------------------------------------------------------------

----------- src/CMakeLists.txt -----------

project(CUDAitk)

find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

find_package(CUDA REQUIRED)

add_subdirectory(CUDApart )

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/CUDApart)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/CUDApart/Debug)

LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/CUDApart)

LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/CUDApart/Debug)

cuda_add_executable(CUDAitk CUDAitk.cu ${SOURCES}  )

ADD_DEPENDENCIES(CUDAitk CUDApart)

target_link_libraries( CUDAitk CUDApart ${ITK_LIBRARIES} )

-----------------------------------------------------------------------

CUDAitk.cu starts with

#include "CUDApart.h"
#include "itkImage.h"


My issues are:


1)     I understand I should NOT create the static library first (with Cmake) and \
then the main project (with another CMake run). Instead, add_subdirectory() should \
assure that the library is generated first with CUDAitk/CUDApart/CMakeLists.txt and \
then the src/CMakeLists.txt is generated after that. Is that correct?

2)     However at generation, Cmake does not find the CUDApart library (I need to \
build the created project with Visual Studio first).

3)     When I build the main project with Visual Studio (after running CMake), the \
itk library is not recognized (link error)

I would appreciate any feedback that could be useful to figure this whole thing out.

Thank you again!


From: jose alejandro matute flores [mailto:jmatuteflores@gmail.com]
Sent: Dienstag, 21. März 2017 23:40
To: D'Isidoro Fabio <fisidoro@ethz.ch>
Cc: insight-users@itk.org
Subject: Re: [ITK-users] Create ITK Project with CUDA from CMake

Hi,

I use cuda as well, I have a different directory for my cuda parts of the \
application. What I do is create a static library and link it to the application.
It might not be the best way, but it's been working so far.


 -------------------cuda/CMakeLists.txt ------------------------


FIND_PACKAGE(CUDA REQUIRED)



set (CUDA_NVCC_FLAGS "-g -G -lineinfo" CACHE STRING "nvcc flags" FORCE)



SET (CUDA_VERBOSE_BUILD ON CACHE BOOL "nvcc verbose" FORCE)



SET(LIB_TYPE STATIC)    #set the lib type

CUDA_ADD_LIBRARY(cudaLibName ${LIB_TYPE} visual.h visual.cu<http://visual.cu> )



--------------------------------------------------





and in the main project directory



------- CMakeLists.txt---------------------





find_package(CUDA REQUIRED)



add_subdirectory(cuda)



INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/cuda)



INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/cuda/lib)



LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/cuda)



LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/cuda/lib)



cuda_add_executable(CUDAitk ${SOURCES}  )



ADD_DEPENDENCIES(CUDAitk cudaLibName)



target_link_libraries( CUDAitk  cudaLibName ....  )



---------------------------------------------


Best,
José

On Tue, Mar 21, 2017 at 6:49 PM, D'Isidoro Fabio \
<fisidoro@ethz.ch<mailto:fisidoro@ethz.ch>> wrote: Hallo,

I have a .cu CUDA main code which makes use of itk to read and write images.

How can I create a new ITK project with Cmake that include CUDA? I could not find any \
tutorial/description on it. Since I am not familiar with Cmake, I would need an \
understandable and detailed description.

The most basic CmakeLists.txt I could find does not work:

------------------------------
project(CUDAitk)

find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

find_package(CUDA REQUIRED)

CUDA_INCLUDE_DIRECTORIES(${ITK_INCLUDE_DIRS})

cuda_add_executable(CUDAitk CUDAitk.cu)
target_link_libraries(CUDAitk ${ITK_LIBRARIES})

------------------------------

The compling errors I get are like:

error C2244: 'itk::FixedArray<TValue,VLength>::FixedArray': unable to match function \
definition to an existing declaration

CMake Error at CUDAitk_generated_CUDAitk.cu.obj.Debug.cmake:267 (message):
    Error generating file
    C:/Users/Fabio/Documents/CUDAitk_cpp2/bin/CMakeFiles/CUDAitk.dir//Debug/CUDAitk_generated_CUDAitk.cu.obj



Any help is highly appreciated.

Thank you!

Fabio





_____________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;}
pre
	{mso-style-priority:99;
	mso-style-link:"HTML Preformatted Char";
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:36.0pt;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;}
span.HTMLPreformattedChar
	{mso-style-name:"HTML Preformatted Char";
	mso-style-priority:99;
	mso-style-link:"HTML Preformatted";
	font-family:Consolas;
	mso-fareast-language:DE-CH;}
p.msonormal0, li.msonormal0, div.msonormal0
	{mso-style-name:msonormal;
	mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	font-size:12.0pt;
	font-family:"Times New Roman",serif;}
span.hoenzb
	{mso-style-name:hoenzb;}
span.EmailStyle23
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
	{page:WordSection1;}
/* List Definitions */
@list l0
	{mso-list-id:508718493;
	mso-list-type:hybrid;
	mso-list-template-ids:-1345151442 134676497 134676505 134676507 134676495 134676505 \
134676507 134676495 134676505 134676507;} @list l0:level1
	{mso-level-text:"%1\)";
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level4
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level7
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l0:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l1
	{mso-list-id:1601790390;
	mso-list-type:hybrid;
	mso-list-template-ids:-980899852 134676497 134676505 134676507 134676495 134676505 \
134676507 134676495 134676505 134676507;} @list l1:level1
	{mso-level-text:"%1\)";
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l1:level4
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l1:level7
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l1:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l2
	{mso-list-id:1772627753;
	mso-list-type:hybrid;
	mso-list-template-ids:-1174235480 134676497 134676505 134676507 134676495 134676505 \
134676507 134676495 134676505 134676507;} @list l2:level1
	{mso-level-text:"%1\)";
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l2:level4
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l2:level7
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE-CH" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">Thank \
you very much Jose,<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">I \
can't make your example work, but I am not sure I have been doing the right things. \
If you can help me:<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">I \
am using Visual Studio, Windows 10. My directory looks like:<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">CUDAitk/<o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
src/<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CUDAitk.cu<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CMakeLists.txt<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CUDApart/<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
CUDApart.cu<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb \
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
CMakeLists.txt<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
bin/<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">where
 <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">----------- \
CUDAitk/CUDApart/CMakeLists.txt -----------<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">FIND_PACKAGE(CUDA \
REQUIRED)<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">set \
(CUDA_NVCC_FLAGS &quot;-g -G -lineinfo&quot; CACHE STRING &quot;nvcc flags&quot; \
FORCE)<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">SET \
(CUDA_VERBOSE_BUILD ON CACHE BOOL &quot;nvcc verbose&quot; FORCE) \
<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">SET(LIB_TYPE \
STATIC)&nbsp;&nbsp; &nbsp;#set the lib type<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">CUDA_ADD_LIBRARY(CUDAPart \
${LIB_TYPE} CUDApart.h CUDApart.cu )<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">-----------------------------------------------------------------------<o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">----------- \
src/CMakeLists.txt -----------<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">project(CUDAitk)<o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">find_package(ITK \
REQUIRED)<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">include(${ITK_USE_FILE})<o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">find_package(CUDA \
REQUIRED)<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">add_subdirectory(CUDApart \
)<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/CUDApart)<o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/CUDApart/Debug)<o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/CUDApart)<o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/CUDApart/Debug)<o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">cuda_add_executable(CUDAitk \
CUDAitk.cu ${SOURCES}&nbsp; )<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">ADD_DEPENDENCIES(CUDAitk \
CUDApart)<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">target_link_libraries( \
CUDAitk CUDApart ${ITK_LIBRARIES} )<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-f \
areast-language:EN-US">-----------------------------------------------------------------------<o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">CUDAitk.cu \
starts with<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">#include \
&quot;CUDApart.h&quot;<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">#include \
&quot;itkImage.h&quot;<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">My \
issues are:<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 \
lfo4"><![if !supportLists]><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><span \
style="mso-list:Ignore">1)<span style="font:7.0pt &quot;Times New \
Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span \
lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">I \
understand I should NOT create the static library first (with Cmake) and then the \
main project (with another  CMake run). Instead, add_subdirectory() should assure \
that the library is generated first with CUDAitk/CUDApart/CMakeLists.txt and then the \
src/CMakeLists.txt is generated after that. Is that correct?<o:p></o:p></span></p> <p \
class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo4"><![if \
!supportLists]><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><span \
style="mso-list:Ignore">2)<span style="font:7.0pt &quot;Times New \
Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span \
lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">However \
at generation, Cmake does not find the CUDApart library (I need to build the created \
project with Visual  Studio first).<o:p></o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo4"><![if \
!supportLists]><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><span \
style="mso-list:Ignore">3)<span style="font:7.0pt &quot;Times New \
Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span \
lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">When \
I build the main project with Visual Studio (after running CMake), the itk library is \
not recognized (link  error)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">I \
would appreciate any feedback that could be useful to figure this whole thing \
out.<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US">Thank \
you again!<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoListParagraph"><b><span lang="EN-US" \
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span \
lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> \
jose alejandro matute flores [mailto:jmatuteflores@gmail.com] <br>
<b>Sent:</b> Dienstag, 21. März 2017 23:40<br>
<b>To:</b> D'Isidoro Fabio &lt;fisidoro@ethz.ch&gt;<br>
<b>Cc:</b> insight-users@itk.org<br>
<b>Subject:</b> Re: [ITK-users] Create ITK Project with CUDA from CMake</span><span \
lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">Hi,<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">I use cuda as well, I have a different \
directory for my cuda parts of the application.<o:p></o:p></span></p> </div>
<div>
<p class="MsoNormal"><span lang="EN-US">What I do is create a static library and link \
it to the application.&nbsp;<o:p></o:p></span></p> </div>
<div>
<p class="MsoNormal"><span lang="EN-US">It might not be the best way, but it's been \
working so far.<o:p></o:p></span></p> </div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">&nbsp;-------------------cuda/CMakeLists.txt \
------------------------<o:p></o:p></span></p> </div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<pre><span lang="EN-US" style="color:olive">FIND_PACKAGE</span><span \
lang="EN-US">(CUDA<span style="color:silver"> </span><span \
style="color:black">REQUIRED</span>)<o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US">set</span><span \
lang="EN-US" style="font-family:&quot;Arial&quot;,sans-serif;color:silver"> \
</span><span lang="EN-US" \
style="font-family:&quot;Arial&quot;,sans-serif">(CUDA_NVCC_FLAGS<span \
style="color:silver"> </span><span style="color:green">&quot;-g</span><span \
style="color:silver"> </span><span style="color:green">-G</span><span \
style="color:silver"> </span><span style="color:green">-lineinfo&quot;</span><span \
style="color:silver"> </span></span><span lang="EN-US" \
style="color:black">CACHE</span><span lang="EN-US" \
style="font-family:&quot;Arial&quot;,sans-serif;color:silver"> </span><span \
lang="EN-US" style="color:black">STRING</span><span lang="EN-US" \
style="font-family:&quot;Arial&quot;,sans-serif;color:silver"> </span><span \
lang="EN-US" style="font-family:&quot;Arial&quot;,sans-serif;color:green">&quot;nvcc</span><span \
lang="EN-US" style="font-family:&quot;Arial&quot;,sans-serif;color:silver"> \
</span><span lang="EN-US" \
style="font-family:&quot;Arial&quot;,sans-serif;color:green">flags&quot;</span><span \
lang="EN-US" style="font-family:&quot;Arial&quot;,sans-serif;color:silver"> \
</span><span lang="EN-US" style="color:black">FORCE</span><span lang="EN-US" \
style="font-family:&quot;Arial&quot;,sans-serif">)</span><span \
lang="EN-US"><o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US" \
style="color:olive">SET</span><span lang="EN-US" style="color:silver"> </span><span \
lang="EN-US">(CUDA_VERBOSE_BUILD<span style="color:silver"> </span>ON<span \
style="color:silver"> </span><span style="color:black">CACHE</span><span \
style="color:silver"> </span><span style="color:black">BOOL</span><span \
style="color:silver"> </span><span style="color:green">&quot;nvcc</span><span \
style="color:silver"> </span><span style="color:green">verbose&quot;</span><span \
style="color:silver"> </span><span style="color:black">FORCE</span>)<span \
style="color:silver"> </span><o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US" \
style="color:olive">SET</span><span lang="EN-US">(LIB_TYPE<span style="color:silver"> \
</span><span style="color:black">STATIC</span>)<span \
style="color:silver">&nbsp;&nbsp;&nbsp; </span><span \
style="color:green">#set</span><span style="color:silver"> </span><span \
style="color:green">the</span><span style="color:silver"> </span><span \
style="color:green">lib</span><span style="color:silver"> </span><span \
style="color:green">type</span><o:p></o:p></span></pre> <pre><span lang="EN-US" \
style="color:black">CUDA_ADD_LIBRARY</span><span lang="EN-US">(cudaLibName<span \
style="color:silver"> </span><span style="color:navy">${LIB_TYPE}</span><span \
style="color:silver"> </span>visual.h<span style="color:silver"> </span></span><a \
href="http://visual.cu"><span lang="EN-US">visual.cu</span></a><span \
style="color:silver"> </span><span lang="EN-US">)<o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span \
lang="EN-US">--------------------------------------------------<o:p></o:p></span></pre>
 <pre><span lang="EN-US"><o:p>&nbsp;</o:p></span></pre>
<p style="margin:0cm;margin-bottom:.0001pt"><span lang="EN-US" \
style="font-size:10.0pt;font-family:&quot;Courier \
New&quot;"><o:p>&nbsp;</o:p></span></p> <p \
style="margin:0cm;margin-bottom:.0001pt"><span lang="EN-US" \
style="font-size:10.0pt;font-family:&quot;Courier New&quot;">and in the main project \
directory <o:p></o:p></span></p>
<p style="margin:0cm;margin-bottom:.0001pt"><span lang="EN-US" \
style="font-size:10.0pt;font-family:&quot;Courier \
New&quot;"><o:p>&nbsp;</o:p></span></p> <p \
style="margin:0cm;margin-bottom:.0001pt"><span lang="EN-US" \
style="font-size:10.0pt;font-family:&quot;Courier New&quot;">------- \
CMakeLists.txt---------------------<o:p></o:p></span></p> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US" \
style="color:olive">find_package</span><span lang="EN-US">(CUDA<span \
style="color:silver"> </span><span \
style="color:black">REQUIRED</span>)<o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US" \
style="color:olive">add_subdirectory</span><span \
lang="EN-US">(cuda)<o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US" \
style="color:olive">INCLUDE_DIRECTORIES</span><span lang="EN-US">(<span \
style="color:navy">${</span><span style="color:#C09050">CMAKE_SOURCE_DIR</span><span \
style="color:navy">}</span>/cuda)<o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US" \
style="color:olive">INCLUDE_DIRECTORIES</span><span lang="EN-US">(<span \
style="color:navy">${</span><span style="color:#C09050">CMAKE_SOURCE_DIR</span><span \
style="color:navy">}</span>/cuda/lib)<o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US" \
style="color:olive">LINK_DIRECTORIES</span><span lang="EN-US">(<span \
style="color:navy">${</span><span style="color:#C09050">CMAKE_SOURCE_DIR</span><span \
style="color:navy">}</span>/cuda)<o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US" \
style="color:olive">LINK_DIRECTORIES</span><span lang="EN-US">(<span \
style="color:navy">${</span><span style="color:#C09050">CMAKE_SOURCE_DIR</span><span \
style="color:navy">}</span>/cuda/lib)<o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US" \
style="color:black">cuda_add_executable</span><span lang="EN-US">(CUDAitk<span \
style="color:silver"> </span><span style="color:navy">${SOURCES}</span><span \
style="color:silver">&nbsp; </span>)<o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US" \
style="color:olive">ADD_DEPENDENCIES</span><span lang="EN-US">(CUDAitk<span \
style="color:silver"> </span>cudaLibName)<o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span lang="EN-US" \
style="color:olive">target_link_libraries</span><span lang="EN-US">(<span \
style="color:silver"> </span>CUDAitk<span style="color:silver">&nbsp; \
</span>cudaLibName ....&nbsp; )<o:p></o:p></span></pre> <pre><span \
lang="EN-US"><o:p>&nbsp;</o:p></span></pre> <pre><span \
lang="EN-US">---------------------------------------------<o:p></o:p></span></pre> \
<pre><span lang="EN-US"><o:p>&nbsp;</o:p></span></pre> </div>
<div>
<p class="MsoNormal"><span lang="EN-US">Best,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">José<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">On Tue, Mar 21, 2017 at 6:49 PM, D'Isidoro \
Fabio &lt;</span><a href="mailto:fisidoro@ethz.ch" target="_blank"><span \
lang="EN-US">fisidoro@ethz.ch</span></a><span lang="EN-US">&gt; \
wrote:<o:p></o:p></span></p> <blockquote style="border:none;border-left:solid #CCCCCC \
1.0pt;padding:0cm 0cm 0cm \
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt"> <div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">Hallo,<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">I have \
a .cu CUDA main code which makes use of itk to read and write images. \
<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">How can \
I create a new ITK project with Cmake that include CUDA? I could not find any \
tutorial/description on it. Since I am not familiar with Cmake, I would  need an \
understandable and detailed description.<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">The \
most basic CmakeLists.txt I could find does not work:<o:p></o:p></span></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">------------------------------<o:p></o:p></span></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">project(CUDAitk)<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">find_package(ITK REQUIRED)<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">include(${ITK_USE_FILE})<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">find_package(CUDA REQUIRED)<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">CUDA_INCLUDE_DIRECTORIES(${ITK_INCLUDE_DIRS})<o:p></o:p></span></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">cuda_add_executable(CUDAitk CUDAitk.cu)<o:p></o:p></span></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">target_link_libraries(CUDAitk ${ITK_LIBRARIES})<o:p></o:p></span></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">------------------------------<o:p></o:p></span></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">The \
compling errors I get are like:<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" \
style="font-size:9.5pt;font-family:Consolas;color:black">error C2244: \
'itk::FixedArray&lt;TValue,VLength&gt;::FixedArray': unable to match function \
definition to an  existing declaration</span><span \
lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none"> <span \
lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">&nbsp;</span><span \
lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none"> <span \
lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">CMake Error at \
CUDAitk_generated_CUDAitk.cu.obj.Debug.cmake:267 (message):</span><span \
lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none"> <span \
lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">&nbsp;&nbsp;&nbsp; \
Error generating file</span><span lang="EN-US"><o:p></o:p></span></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US" style="font-size:9.5pt;font-family:Consolas;color:black">&nbsp;&nbsp;&nbsp; \
C:/Users/Fabio/Documents/CUDAitk_cpp2/bin/CMakeFiles/CUDAitk.dir//Debug/CUDAitk_generated_CUDAitk.cu.obj</span><span \
lang="EN-US"><o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Any \
help is highly appreciated.<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
lang="EN-US">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Thank \
you!<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" \
style="color:#888888">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" \
style="color:#888888">Fabio<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" \
style="color:#888888">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" \
style="color:#888888">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" \
style="color:#888888">&nbsp;<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US" \
style="color:#888888">&nbsp;<o:p></o:p></span></p> </div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US"><br>
_____________________________________<br>
Powered by </span><a href="http://www.kitware.com" target="_blank"><span \
lang="EN-US">www.kitware.com</span></a><span lang="EN-US"><br> <br>
Visit other Kitware open-source projects at<br>
</span><a href="http://www.kitware.com/opensource/opensource.html" \
target="_blank"><span \
lang="EN-US">http://www.kitware.com/opensource/opensource.html</span></a><span \
lang="EN-US"><br> <br>
Kitware offers ITK Training Courses, for more information visit:<br>
</span><a href="http://www.kitware.com/products/protraining.php" \
target="_blank"><span \
lang="EN-US">http://www.kitware.com/products/protraining.php</span></a><span \
lang="EN-US"><br> <br>
Please keep messages on-topic and check the ITK FAQ at:<br>
</span><a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank"><span \
lang="EN-US">http://www.itk.org/Wiki/ITK_FAQ</span></a><span lang="EN-US"><br> <br>
Follow this link to subscribe/unsubscribe:<br>
</span><a href="http://public.kitware.com/mailman/listinfo/insight-users" \
target="_blank"><span \
lang="EN-US">http://public.kitware.com/mailman/listinfo/insight-users</span></a><span \
lang="EN-US"><o:p></o:p></span></p> </blockquote>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
</div>
</body>
</html>



_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users

--===============0502218336==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic