Skip to content

Instantly share code, notes, and snippets.

@dlwh
Forked from piotrMocz/problematic.scala
Created June 7, 2014 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlwh/c572fdde70fec7c27fbe to your computer and use it in GitHub Desktop.
Save dlwh/c572fdde70fec7c27fbe to your computer and use it in GitHub Desktop.
import breeze.linalg._
import gust.linalg.cuda._
import jcuda.jcublas._
implicit val handle = new cublasHandle()
JCublas2.cublasCreate(handle)
// an extract from a REPL session
val A = CuMatrix.fromDense(DenseMatrix((1.0f, 1.0f, 2.0f, 1.0f), (1.0f, 2.0f, 1.0f, -2.0f), (3.0f, -1.0f, 3.0f, -2.0f), (-2.0f, 3.0f, -1.0f, 1.0f)))
val N = 4
val Aarray = jcuda.Pointer.to(A.offsetPointer) // this is the one I'm most uncertain about
val P = CuMatrix.create[Int](N, 1) // but I'm not sure about those 2 either
val info = CuMatrix.create[Int](N,1)
JCublas2.cublasSgetrfBatched(handle, N, Aarray, N, P.offsetPointer, info.offsetPointer, 1) // this call returns success (0),
// but A is zeroed-out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment