BIDData / BIDMat

A CPU and GPU-accelerated matrix library for data mining
BSD 3-Clause "New" or "Revised" License
265 stars 73 forks source link

cummaxByKey for GPU matrices? #35

Closed DanielTakeshi closed 9 years ago

DanielTakeshi commented 9 years ago

I can't tell if cummaxByKey is implemented for GPU matrices. If it's not, then I think that it's just missing a few methods in one of the .cu files that are in BIDMat's GPU code directory? (It was recently refactored according to this commit https://github.com/BIDData/BIDMat/commit/f9f5720f9355a4def55e1596afab09a5227f597a)

Example on my Mac 10.9 laptop:

I do git pull, then do cd BIDMat/jni/src; make clean; ./configure; make; make install to get the cuda libraries. Then I do ./sbt package. The following code shows an example of the GPU version not working (but the CPU version working):

scala> val a = rand(3,10)
a: BIDMat.FMat =
    0.17454    0.72285    0.33957    0.23828    0.47790    0.41824    0.37690   0.083308    0.39092    0.91638
    0.91813    0.83321    0.55037    0.63189    0.80421    0.76176    0.66493    0.75904  0.0053793    0.65965
    0.16096    0.34379   0.048064    0.23330    0.32797    0.86558    0.81054    0.53446    0.91294    0.60398

scala> val ga = grand(3,10)
ga: BIDMat.GMat =
   0.78258  0.081876   0.44771   0.53182   0.63474   0.78777   0.73650   0.69435   0.39765   0.44639
   0.53618  0.083131  0.098099   0.34346  0.027273   0.90388   0.29731   0.14853   0.83988  0.091234
   0.14477   0.36829   0.64452   0.77051   0.31326   0.89641   0.67069   0.90067   0.67521   0.99995

scala> val keys = zeros(3,10)
keys: BIDMat.FMat =
   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0   0

scala> val gkeys = gzeros(3,10)
gkeys: BIDMat.GMat =
   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0   0

scala> cummaxByKey(a,keys)
res9: BIDMat.FMat =
   0.17454   0.72285   0.33957   0.23828   0.47790   0.41824   0.37690  0.083308   0.39092   0.91638
   0.91813   0.83321   0.55037   0.63189   0.80421   0.76176   0.66493   0.75904   0.39092   0.91638
   0.91813   0.83321   0.55037   0.63189   0.80421   0.86558   0.81054   0.75904   0.91294   0.91638

scala> cummaxByKey(ga,gkeys)
java.lang.UnsatisfiedLinkError: edu.berkeley.bid.CUMAT.cummaxByKeyFL(Ljcuda/Pointer;Ljcuda/Pointer;Ljcuda/Pointer;J)I
  at edu.berkeley.bid.CUMAT.cummaxByKeyFL(Native Method)
  at BIDMat.GMat.cummaxByKey(GMat.scala:974)
  at BIDMat.GMat.cummaxByKey(GMat.scala:1004)
  at BIDMat.SciFunctions$.cummaxByKey(SciFunctions.scala:1070)
  ... 33 elided

Thanks.

DanielTakeshi commented 9 years ago

This issue has been fixed in the latest commit: e19f9269941f3474b0baa5317b13c48c80d5205b