Thursday, October 15, 2009

GPUSVM-0.1 and invalid memory accesses

GPUSVM is a CUDA implementation of SVM which uses the SMO algorithm. This library supports two primary functionalities: training and classification.

The code is written in C++, and the source tar-ball contains an example of how to call performTraining() function once. My woe started when calling performTraining() more than once. This gave me a crash:

*** glibc detected *** bin/linux/release/svmTrain: double free or corruption (out): 0x000000000b6e4820 ***

This was apparently triggered by the second performTraining(). After some (ok, ok, 2 days including CUDA crash course actually) huntings, it turned out that there really are two invalid memory accesses:

  • one is during memcpy-ing from device to host memory (occur in the second-order heuristic function);
  • another is due to the absence of boundary check in a cache object, which leads to accessing a non-existing object;

in addition to a memory leak (alpha array in performTraining()).

2 comments:

Unknown said...

Could you release a patch for gpusvm?
I'm very interest in it.

Cincai Patron said...

Sure. As soon as I get my hand on it again, since it's been a while..