Hello everybody,
It’s the first time that I use CUDA and I’ve some problems with program compilation. First, I want to explain my program structure : I’ve two files octree.hpp and octree.cpp that contains several methods in order to create octree and manipulate its. precision : I define octree with the basic struct not a class.
I’ve a function that transforms my octree into a 1D array (In this function I use certain types of CUDA like float4).
My goal is to load my octree ( octree after transformation into a float4* ) and create octree manipulation functions.
I think I must create a file octree_kernel.cu contain my different octree manipulation functions but when I call the kernel in my main.cpp, I’ve a message :
/home/nicolas/Programmation/ter/src/main.cpp: In function ?int main()?:
/home/nicolas/Programmation/ter/src/main.cpp:27: erreur: ?display? was not declared in
this scope
/home/nicolas/Programmation/ter/src/main.cpp:27: erreur: expected primary-expression
before ?<? token
/home/nicolas/Programmation/ter/src/main.cpp:27: erreur: expected primary-expression
before ?>? token
/home/nicolas/Programmation/ter/src/main.cpp:27: attention : left-hand operand of comma
n'a pas d'effet
display is a little kernel in my octree_kernel.cu file.
I used CMake in order to compile my project :
cmake_minimum_required( VERSION 2.8 )
project( Octree )
set(EXECUTABLE_OUTPUT_PATH bin/)
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package( CUDA REQUIRED )
set( CUDA_NVCC_FLAGS "--compiler-options")
set( CUDA_VERBOSE_BUILD ON )
set( CUDA_PROPAGATE_HOST_FLAGS OFF )
CUDA_BUILD_CLEAN_TARGET()
ADD_DEFINITIONS("-O2 -Wall -ansi -pedantic")
include_directories (
headers
)
file (
GLOB_RECURSE
source_files
./src/*.cpp
./kernels/*.cu
)
CUDA_ADD_EXECUTABLE (
Octree
${source_files}
)
My project is divided into several folders containing my files :
bin : binary
headers : octree.hpp
kernels : octree_kernel.cu
src : octree.cpp ; main.cpp
So my question is : How to include my C++ code with my different kernel CUDA and my function that transform octree (vector) into a 1D array (float4*) => this function is a host cuda function.
I hope to be clear because I’m very beginners with CUDA and sorry for my English I’m a French and my English is rather approximative.
PS : If it’s not clear, I do my best to answer your questions.
Thanks.