I am trying to write a routine that can be used by both the host and the device… but the compiler throws up an error. So, is there a way out? There must be a way out as I can call math functions.
I am a newbie, so sorry if this sounds very trivial.
you can declare a function as
__device__ __host__ float myfun();
and it will be available in both host and device code within the scope it is declared in.
Now, I have another question.
Can I call some library routines such as Lapack from the device?
Put simply, no you can’t.