[Insight-developers] How to generate complex dependencies (CMake)
Richard Beare
richard.beare at gmail.com
Mon Jan 10 17:36:52 EST 2011
Yep,
We're doing pretty much the same thing:
for example:
CUDA_ADD_EXECUTABLE(ITK-GPU-OPEN
GrayscaleDilateImageFilter/CudaGrayscaleDilateImageFilterKernel.cu
GrayscaleErodeImageFilter/CudaGrayscaleErodeImageFilterKernel.cu
itk-gpu-open.cxx
)
The problem is that you need to know which cuda files are being used.
In this example itk-gpu-open looks like a standard itk program,
containing lines like this:
typedef
itk::CudaGrayscaleMorphologicalOpeningImageFilter<InputImageType,
OutputImageType, StructuringElementType> FilterType;
the itk::CudaGrayscaleDilateImageFilter includes
CudaGrayscaleDilateImageFilterKernel.h, which defines
float * CudaGrayscaleDilateImageFilterKernelFunction(const float* input,
const unsigned long * imageDim, const
unsigned long * radius,
const float * kernel, const unsigned
long * kernelDim, const float zero,
unsigned long D, unsigned long N);
which is implemented in CudaGrayscaleDilateImageFilterKernel.cu.
The library option Karthik mentioned does seem like the simplest way
to go, but I was hoping to be able to retain some of the template
structure. As the use of cuda grows the compile time for the library
could become annoyingly large.
On Tue, Jan 11, 2011 at 12:47 AM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> Hi Richard,
>
> I'm wondering if you have taken a look at
> http://svn.na-mic.org/NAMICSandBox/trunk/CUDA-ITK/Source/
>
> particularly to:
> http://svn.na-mic.org/NAMICSandBox/trunk/CUDA-ITK/Source/CMakeLists.txt
>
> INCLUDE_DIRECTORIES(
> ${CUDA_TOOLKIT_INCLUDE}
> ${CUDA_CUT_INCLUDE_DIR}
> )
>
> CUDA_ADD_EXECUTABLE(Example1 Example1.cu)
>
> CUDA_ADD_EXECUTABLE(Example2
> Example2.cu
> Example2.cxx
> )
>
> TARGET_LINK_LIBRARIES(Example2
> ITKIO
> )
>
>
> Is that similar to what you are doing now ?
>
>
> Luis
>
> --------------------------------------------------------------------------
> On Sun, Jan 9, 2011 at 11:36 PM, Richard Beare <richard.beare at gmail.com> wrote:
>> Hi,
>>
>> I'm trying to develop a method for nicely integrating the compilation
>> process some prototype cuda code. We are already using FindCUDA.cmake
>> developed by James Bigler. The issue I'm trying to solve is how to
>> derive the correct .cu file from the source c++. At present it is
>> necessary to know which cuda enabled classes are being used and
>> explicitly include them as dependencies in the ADD_EXECUTABLE line,
>> which doesn't fit with the normal ITK way of doing things. Ideally I'd
>> like to be able to generate these dependencies automatically, possibly
>> based on a naming convention or some other information that would be
>> included in the c++ file that references the cuda kernel functions.
>>
>> Any thoughts?
>>
>> Thanks
>> _______________________________________________
>> 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://kitware.com/products/protraining.html
>>
>> 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-developers
>>
>
More information about the Insight-developers
mailing list