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