Hey. These days I have been struggling with how to call functions (located in a static library) in the kernel. My solution includes two projects, one is built for the library, the other is the GPU main function. The GPU kernel would call some functions from that library project. My configurations are as follows:
- System: Windows XP SP3, Visual Studio 2008, Tesla C1060, Emulation mode.
- Static library: I use the default configurations, and it is compiled successfully. I can find the .lib and .obj files.
- GPU project: I add the lib directory to the Additional Library Dependency, and also add the include directory of the library.
Here are my problems:
- If I do not have any .cu files in the GPU project, just pure C project, I can compile and use the .lib very well. In other words, the .c file in GPU project can call functions in my library with no problem. But it does not work if I have some .cu file. For example, in my kernel, if I call the function in the library, the compile result comes out with “Link Error 2001: unresolved external symbol”. That function can not be found.
- What I want to do is to keep the library part unchanged and call the functions if necessary. I want to make the library portable to as many platforms as possible. So on GPU, I would make the kernel call those functions. But only emulation mode supports it, right? If I switch to Debug or Release mode, then I am not allowed to call the functions in the kernel. Any suggestions on this?
But first of all, is it feasible that I create my own library and use it inside the GPU kernel? My thought is that, the library is compiled by the host machine so it should be located on the host, not on GPU device. So the GPU kernel is not able to fetch the library while working. If that is the case, is there any way to put the library on the GPU? Thanks.