I ported the Haskell application to CUDA to speed it up. Now I have a file .cuthat I want to use from Haskell as an API. I was able to easily get the FFI C files after the tutorials, but I'm not sure how this relates to CUDA / nvcc. How to do it?
To complete, this is what I am trying to process .cuas a regular file .c:
vh:CUDA apple1$ nvcc hello.cu -c -o hello.o
vh:CUDA apple1$ ghc test.hs -o test hello.o
Linking test ...
Undefined symbols for architecture x86_64:
"___cudaRegisterFatBinary", referenced from:
__sti____cudaRegisterAll_40_tmpxft_00002168_00000000_7_hello_cpp1_ii_f33df8d2() in hello.o
"___cudaRegisterFunction", referenced from:
__nv_cudaEntityRegisterCallback(void**) in hello.o
"___cudaUnregisterFatBinary", referenced from:
__cudaUnregisterBinaryUtil() in hello.o
"_cudaConfigureCall", referenced from:
render(Renderer_*) in hello.o
"_cudaFree", referenced from:
renderer_free(Renderer_*) in hello.o
"_cudaLaunch", referenced from:
cudaError cudaLaunch<char>(char*) in hello.o
"_cudaMalloc", referenced from:
renderer_init(Renderer_*, float, float, float, float, float) in hello.o
"_cudaMemcpy", referenced from:
renderer_init(Renderer_*, float, float, float, float, float) in hello.o
render(Renderer_*) in hello.o
"_cudaSetupArgument", referenced from:
__device_stub__Z4walk6float3PiS_S_S_S_S0_(float3&, int*, float3&, float3&, float3&, float3&, int*) in hello.o
"_hello", referenced from:
_r3yw_info in test.o
_c3Ib_info in test.o
_c3Il_info in test.o
(maybe you meant: _Main_hello_closure, _Main_hello_info )
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And this is my Haskell file:
{-
module Main where
import Foreign.C
import Foreign.Ptr (Ptr,nullPtr)
foreign import ccall "hello" hello :: IO ()
main = hello
source
share