Skip to content

Bad matrix-vector multiplication performance in Cuda #257

@adam-ce

Description

@adam-ce

During development I noticed that glm slowed down my project quite a bit. So I made some simple tests with cuda + glm.

I basically do

result[i] = matrix * vectors[i];

several times in a cuda kernel. Once using glm and once cuda's float4 + a very simple custom mat4.

time for cuda glm (matrix): 859 milliseconds
time for cuda helper math (matrix): 225 milliseconds

interestingly dot and cross product are faster with glm in a similar test:

time for cuda glm (dot and cross): 175 milliseconds
time for cuda helper math (dot and cross): 248 milliseconds

I used a GForce GTX 550 Ti, CUDA 6.5 and GLM 0.9.5.4 on linux for the test.

i've put the full test onto bitbucket (https://bitbucket.org/adamce/cuda-glm-performance-test/src/).

  • the test is in src/main.cu
  • the custom mat4 and multiplication operator are in helper_math.h on the very bottom.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions