-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling Standard Library functions from __device__ code #547
Comments
Shouldn't it just be an error to include this file in CUDA? ostream stuff in Cuda kernel? |
This issue should be fixed in GLM 0.9.8 and master branches. This said, I expect that std io function calls will not play nice with CUDA kernels. Thanks, |
Sure, it's an error to call these functions from device code. But to call them from host code (even compiled with NVCC) should be just fine. Thanks for the fixes. The amount of warnings has dropped down, though I still get a few of this form:
|
Unfortunately, this is still not fixed in master. Here is a simple way to reproduce. In the root of "glm" repository paste the following into a "test.cu" file: #include <iostream>
#include "glm/gtx/io.hpp"
int main(int argc, const char** argv)
{
glm::vec3 v;
std::cout << v;
return 0;
} Then compile:
|
This is similar to #546.
After including the "gtx/io.hpp" header into NVCC-compiled code I got another handful of warnings. For example:
The offending code fragment is:
Indeed, functions from the Standard Library are
__host__
only. And anyway, I guess functions from the IO module are not supposed to be run on the GPU. Should we remove theGLM_FUNC_QUALIFIER
from them?EDIT Actually, the functions still need to be inlined, so rather replace
GLM_FUNC_QUALIFIER
withGLM_INLINE
.The text was updated successfully, but these errors were encountered: