Hi,
I am trying to call a C function in defined in a cuda file through a function in C file.
----------------------------------------------C FILE ----------------------
foo.c file
/* The declaration of the cuda function */
void my_cuda_foo(some structure a);
foo(some structure a) {
my_cuda_foo(a);
}
-----------------------------------------------CUDA FILE ---------------------
foo1.cu file
extern “C” void my_cuda_foo(some_structure a) {
/* The contents of the structure are changed */
}
command lines used to build the files.
gcc -c foo.c
nvcc -c foo1.cu
They are later used to build a large executable. I had two questions. The executable is being build with nvcc.
- Is this the correct way to call functions from a C file to a cuda file. Is this approach suitable.
- Why are the contents in the structure getting modiffied when i make the call to the cuda function from the c function.
thanks
shankha