Skip to content
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

glm 0.9.5.2 CUDA compilation errors #169

Closed
andrewcorrigan opened this issue Feb 13, 2014 · 1 comment
Closed

glm 0.9.5.2 CUDA compilation errors #169

andrewcorrigan opened this issue Feb 13, 2014 · 1 comment
Assignees
Labels
Milestone

Comments

@andrewcorrigan
Copy link

I am unable to compile a simple code using glm 0.9.5.2 with CUDA 5.5 on Mac 10.9 (using Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)) or CUDA 6.0 (CUDA 5.0 also) on Ubuntu 13.10 (g++ Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1.

Note: I am not even trying to call glm from device code, I am simply compiling host code with the nvcc compiler.

Compilation command:

nvcc -I${GLM_INCLUDE_PATH} test.cu

Simple reproducer:

#ifdef __CUDACC__
#  include <cuda.h>
#  define GLM_FORCE_CUDA
#endif
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/transform.hpp>

typedef float GLfloat;

int main(int argc, char** argv)
{
    GLfloat angle_x = 0.0f;
    GLfloat angle_y = 0.0f;
    GLfloat distance = 50.0f;
    glm::vec3 position (0.0f,  0.0f, distance);

    const GLfloat degrees_to_radians_f = 3.14159265359f / 180.0f;

    glm::mat4 view;
    {
        glm::vec3 direction(0.0f,  0.0f, -1.0f);
        glm::vec3 right    (1.0f,  0.0f,  0.0f);

        view = glm::lookAt(position, position+direction, glm::cross(right, direction));
    }

    glm::mat4 model;
    {
        model =   glm::rotate(glm::mat4(1.0f), angle_x * degrees_to_radians_f, glm::vec3(1.0f, 0.0f, 0.0f))
        /**/    * glm::rotate(glm::mat4(1.0f), angle_y * degrees_to_radians_f, glm::vec3(0.0f, 1.0f, 0.0f));
    }

    return 0;
}

The warnings are of the form:

glm/glm/detail/type_mat2x3.inl(375): warning: a __host__ function("glm::detail::operator+") redeclared with __host__ __device__, hence treated as a __host__ __device__ function

These warnings have existed for many versions of glm, but now that I have upgraded to glm 0.9.5.2, errors have begun to appear:

glm/glm/gtc/matrix_transform.inl(431): error: expected a field name
glm/glm/gtc/matrix_transform.inl(432): error: expected a field name
glm/glm/gtc/matrix_transform.inl(85): error: expected a field name
Groovounet pushed a commit that referenced this issue Mar 16, 2014
@Groovounet Groovounet added the bug label Mar 16, 2014
@Groovounet Groovounet added this to the GLM 0.9.5 milestone Mar 16, 2014
@Groovounet Groovounet self-assigned this Mar 16, 2014
@Groovounet
Copy link
Member

I found some issues and I removed all errors and warnings from GLM 0.9.5 branch when using CUDA (tessted with 6rc).

This will be available with GLM 0.9.5.3 release.

By the way with your code sample you probably don't need:
"#ifdef CUDACC

include <cuda.h>

define GLM_FORCE_CUDA

#endif"

Just including GLM should be enough.

Thanks,
Christophe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants