[Insight-users] [insight] - Using ITK on a non c/ cpp/ cxx extensions

Gabriel Santiago santiago.eletrica at gmail.com
Thu Oct 18 15:23:17 EDT 2012


Yes, and that's the problem. The main file must be .cu extension or it
won't work with Cuda...

---------- Forwarded message ----------
From: Octavian Soldea <octaviansoldea at gmail.com>
Date: 18 October 2012 16:17
Subject: Re: [Insight-users] [insight] - Using ITK on a non c/ cpp/ cxx
extensions
To: Gabriel Santiago <santiago.eletrica at gmail.com>


HI Gabriel

The main should be added indeed to the project via CMakeLists.txt.

Best regards,
  Octavian

On Thu, Oct 18, 2012 at 11:44 AM, Gabriel Santiago
<santiago.eletrica at gmail.com> wrote:
> Actually, I tried that... But ITK won't work if I don't put the main file
> inside the CMakeLists.txt.
>
> As in this example:
>
> PROJECT( PROJECT_NAME )
> FIND_PACKAGE ( ITK REQUIRED )
> IF ( ITK_FOUND )
> INCLUDE( ${ITK_USE_FILE} )
> ENDIF( ITK_FOUND )
> ADD_EXECUTABLE( PROJECT_NAME main.cpp )
> TARGET_LINK_LIBRARIES ( PROJECT_NAME ITKCommon ITKIO)
>
> I tried another cpp (and h) files but didn't work...
>
> ---------- Forwarded message ----------
> From: Octavian Soldea <octaviansoldea at gmail.com>
> Date: 18 October 2012 12:05
> Subject: Re: [Insight-users] [insight] - Using ITK on a non c/ cpp/ cxx
> extensions
> To: Gabriel Santiago <santiago.eletrica at gmail.com>
>
>
> Hi Gabriel
>
> I begin to understand the configuration in which you operate. Is the
> following an option? Let the "main" control calls to CUDA and ITK.
> Pack CUDA related code in a library which exposes h files only. Then
> the "main" control decides when/if to access CUDA and based on
> decisions from CUDA outputs you call ITK.
> There should be some data data that is passed between the "main" (that
> uses ITK) and the CUDA library and vice-versa. Please note that the
> code in .cu and .h which is pure C/C++ can be called from "main". What
> is not possible to call from c/cxx/cpp/"main" files are CUDA proper
> calls, such as kernel calls.
>
> Please let me know if this solves your problem or you need more
information.
>
> Good luck,
>    Octavian
>
> On Thu, Oct 18, 2012 at 10:30 AM, Gabriel Santiago
> <santiago.eletrica at gmail.com> wrote:
>> Hello Octavian, thank you for your reply!
>>
>> My problem is that I must use ITK inside a Cuda file (extension .cu)
since
>> I
>> need to use some Cuda functions and they won't work in a cpp or c file.
>> I tried to proceed as usual, just by changing main.CPP to main.CU on
>> CMakeLists.txt file, but it didn't work.
>>
>> Do you think that, if I specify the toolchain I am using, it could work?
>>
>> I also tried to create a .h file, but for an unknown reason, ITK doesn't
>> work if I put a non ITK header file in my project. (Does anyone here know
>> why?)
>>
>> Thanks again,
>>
>> On 18 October 2012 11:23, Octavian Soldea <octaviansoldea at gmail.com>
>> wrote:
>>>
>>> Hi Gabriel
>>>
>>> Could you please be a bit more specific? I do not understand "use ITK
>>> on a .cu (CUDA) file". I believe your problem is that some functions
>>> are not recognized in the cpp/c/cxx files.
>>> Sometimes, it helps to move functions to .h files. Please note that
>>> itk comes with some OpenCL support.
>>>
>>> Best regards,
>>>     Octavian
>>>
>>> On Thu, Oct 18, 2012 at 10:08 AM, Gabriel Santiago
>>> <santiago.eletrica at gmail.com> wrote:
>>> > Hi guys!
>>> >
>>> > I need to use ITK on a .cu (CUDA) file.
>>> > I tried to use CMake, and change the main file extension to .cu, but
>>> > obviously didn't work. Also tried to specify the toolchain that it
>>> > should
>>> > use, but no good.
>>> >
>>> > Can anyone here help me, please?
>>> >
>>> > Regards,
>>> >
>>> > --
>>> > Gabriel Santiago
>>> >
>>> > ~"As long as I live so long do I learn"~
>>> > Ramakhrishna
>>> >
>>> >
>>> > _____________________________________
>>> > 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://www.itk.org/mailman/listinfo/insight-users
>>> >
>>
>>
>>
>>
>> --
>> Gabriel Santiago
>>
>> ~"As long as I live so long do I learn"~
>> Ramakhrishna
>>
>
>
>
> --
> Gabriel Santiago
>
> ~"As long as I live so long do I learn"~
> Ramakhrishna
>
>
> _____________________________________
> 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://www.itk.org/mailman/listinfo/insight-users
>



-- 
Gabriel Santiago

~"As long as I live so long do I learn"~
Ramakhrishna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121018/a808a605/attachment.htm>


More information about the Insight-users mailing list