I guess the titles isn’t that explicit…
But I’m wondering if I can use my .cu file and compiles them for .cpp usage…
I’ll explain :
I’m codding a program in CUDA C/C++ and if wanted the project to be used as well in C++. So I made a #define that check if the architecture is CUDACC or not. So if it is I chose one way and if not I chose an other way.
For host device function I defined it like this :
#ifdef __CUDACC__ # define __CUDA__ __host__ __device__ #else # define __CUDA__
And for the main function I made 2 differents main (more understandable) with their own initialisation (functions)
But (I know it’s wrong) I code all of my program in ONE .cu file.
Before you ask, I’m on Windows using CUDA7.5 on VisualStudio2013
Can I compile .cu file like if it was a .cpp file ?
Thanks ! =)
Edit : Yeah I want to add something. I want (if it’s possible) to have something that work without having the CUDA toolkit. Like if I take my code to a computer that did not have NVIDIA graphic card, I’d like it to work too