<div dir="ltr"><div>Thanks to every answer!<br><br></div>My CMakeLists.txt is the following. For VTK, I only use vtkUnstructuredGridReader. If I use include(${VKT_USE_FILE}), "make" will cause an nvcc fatal error: A single input file is required for a non-link phase when an output file is specified. If I use include_directories(${VTK_INCLUDE_DIRS}) instead, my code can compile. However, for those rendering functions of VTK, it seems include_directories(${VTK_INCLUDE_DIRS}) is not enough.<br>
<br>cmake_minimum_required(VERSION 2.8)<br>project(Fastvection)<br><br>find_package(VTK)<br>if (VTK_FOUND)<br>        include (${VTK_USE_FILE})<br>        #include_directories(${VTK_INCLUDE_DIRS})<br>        message("VTK found")<br>
else()<br>        message(ERROR "VTK not found")<br>endif()<br><br>find_package(CUDA)<br>if (CUDA_FOUND)<br>        include(FindCUDA)<br>        set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}; -gencode arch=compute_35,code=sm_35)<br>
        message("CUDA found")<br>else()<br>        message("CUDA not found")<br>endif()<br><br>cuda_add_executable(fastvection<br>        lcsBigBlockInitializationForPositions.cu<br>        lcsBigBlockInitializationForVelocities.cu<br>
        lcsBlockedTracingOfRK4.cu<br>        lcsCollectActiveParticlesForNewInterval.cu<br>        lcsCollectActiveParticlesForNewRun.cu<br>        lcsExclusiveScanForInt.cu<br>        lcsGetGroupsForBlocks.cu<br>        lcsGetStartOffsetInParticles.cu<br>
        lcsInitialCellLocation.cu<br>        lcsRedistributeParticles.cu<br>        lcsTetrahedronBlockIntersection.cu<br>        lcs.cpp lcsGeometry.cpp lcsUnitTest.cpp lcsUtility.cpp main.cpp<br>)<br><br><br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Apr 30, 2013 at 9:03 AM, Robert Maynard <span dir="ltr"><<a href="mailto:robert.maynard@kitware.com" target="_blank">robert.maynard@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Here is an example CMakeLists.txt that combines VTK file reading and cuda.<br>
<br>
project(Example)<br>
<br>
#you should only need a couple vtk libraries<br>
find_package(VTK 6.0<br>
  COMPONENTS<br>
  vtkCommonCore<br>
  vtkCommonDataModel<br>
  vtkCommonExecutionModel<br>
  vtkIOLegacy<br>
  REQUIRED)<br>
<br>
find_package(CUDA REQUIRED)<br>
<br>
#since we don't have any vtk factories this will work.<br>
include(${VTK_USE_FILE})<br>
<br>
#list your cuda and c++ source files<br>
set(sources<br>
  main.cpp<br>
  <a href="http://cuda_example.cu" target="_blank">cuda_example.cu</a><br>
  )<br>
<br>
cuda_add_executable(example ${sources})<br>
target_link_libraries(example<br>
  vtkCommonCore<br>
  vtkCommonDataModel<br>
  vtkCommonExecutionModel<br>
  vtkIOLegacy)<br>
<div class="HOEnZb"><div class="h5"><br>
On Tue, Apr 30, 2013 at 9:51 AM, Joachim Pouderoux<br>
<<a href="mailto:joachim.pouderoux@kitware.com">joachim.pouderoux@kitware.com</a>> wrote:<br>
> Mingcheng,<br>
><br>
> I guess you will have a lot of difficulties to compile VTK with CUDA.<br>
> You should better isolate your cuda code (no vtk dependency/header) in a<br>
> cuda library that you will link together with VTK library against your C++<br>
> code.<br>
><br>
> Joachim Pouderoux<br>
><br>
> PhD, R&D Engineer<br>
> Kitware SAS<br>
><br>
><br>
><br>
> 2013/4/30 Mingcheng Chen <<a href="mailto:linyufly@gmail.com">linyufly@gmail.com</a>><br>
>><br>
>> Hi Jean-Christophe,<br>
>><br>
>> Thank you!<br>
>><br>
>> I use VTK 6.0 and CUDA 5.0. I just need vtkUnstructuredGridReader to read<br>
>> something in main.cpp and then everything is CUDA.<br>
>><br>
>> Thanks again!<br>
>><br>
>> Best regards,<br>
>> Mingcheng Chen<br>
>> April 29th, 2013<br>
>><br>
>><br>
>> On Mon, Apr 29, 2013 at 6:54 PM, Jean-Christophe Fillion-Robin<br>
>> <<a href="mailto:jchris.fillionr@kitware.com">jchris.fillionr@kitware.com</a>> wrote:<br>
>>><br>
>>> Hi Mingcheng,<br>
>>><br>
>>> To help identify the issue, could you specify which version of VTK you<br>
>>> are building against. Providing a small example using either gist or github<br>
>>> would be helpful.<br>
>>><br>
>>> Hth<br>
>>> Jc<br>
>>><br>
>>><br>
>>> On Mon, Apr 29, 2013 at 6:16 PM, Mingcheng Chen <<a href="mailto:linyufly@gmail.com">linyufly@gmail.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>> Hi everyone,<br>
>>>><br>
>>>> My code contains a main.cpp and several *.cu files. The main.cpp uses<br>
>>>> some VTK functions.<br>
>>>><br>
>>>> How can I make it compiled in ubuntu? In Windows I can use Visual<br>
>>>> Studio.<br>
>>>><br>
>>>> Is cmake able to do that? I failed...<br>
>>>><br>
>>>> Thanks!<br>
>>>><br>
>>>> Best regards,<br>
>>>> Mingcheng Chen<br>
>>>> April 29th, 2013<br>
>>>><br>
>>>> --<br>
>>>> Research Assistant in Graphics Group<br>
>>>> University of Illinois at Urbana-Champaign<br>
>>>> <a href="http://mingchengchen.org" target="_blank">http://mingchengchen.org</a><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>
>>>> Follow this link to subscribe/unsubscribe:<br>
>>>> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
>>>><br>
>>>><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> <a href="tel:%2B1%20919%20869%208849" value="+19198698849">+1 919 869 8849</a><br>
>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Research Assistant in Graphics Group<br>
>> University of Illinois at Urbana-Champaign<br>
>> <a href="http://mingchengchen.org" target="_blank">http://mingchengchen.org</a><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>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
>><br>
>><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>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div>Research Assistant in Graphics Group<br></div>
<div>University of Illinois at Urbana-Champaign</div><div><a href="http://mingchengchen.org" target="_blank">http://mingchengchen.org</a></div></div>
</div>