MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

CUDADot bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115670] CUDADot bug?
  • From: Ulrich Arndt <ulrich.arndt at data2knowledge.de>
  • Date: Tue, 18 Jan 2011 05:47:58 -0500 (EST)
  • References: <201101171036.FAA19818@smc.vnet.net>

Hi,

I tested CUDADot as I need to do some bigger matrix multiplications.

But I found a not so nice feature.
I generated two random matrices
Then I calculate the Dot and CUDADot of the two matrixes.
For dim = 5000 the results are not the same but CUDADot does not report any error messages...
For dim = 3000 the result are the same and CUDADot needs only 1/3 of the time.

Not very nice...
Is this HW / SW related? Or a general bug?

Ulrich


In[1]:= Needs["CUDALink`"]

In[2]:= CUDAQ[]
CUDAInformation[1, "Name"]
$Version

Out[2]= True

Out[3]= "GeForce GT 330M"

Out[4]= "8.0 for Mac OS X x86 (64-bit) (November 6, 2010)"

In[5]:= Clear[r1Mat, r2Mat, aMat, bMat];
dim = 5000;
aMat = RandomInteger[1, {dim, dim}];
bMat = RandomInteger[1, {dim, dim}];

In[9]:= AbsoluteTiming[r1Mat = aMat.bMat;]
AbsoluteTiming[r2Mat = CUDADot[aMat, bMat];]
r1Mat == r2Mat

Out[9]= {87.180122, Null}

Out[10]= {1.193608, Null}

Out[11]= False

In[12]:= r1Mat[[1 ;; 10, 1 ;; 10]]
r2Mat[[1 ;; 10, 1 ;; 10]]

Out[12]= {{1318, 1282, 1236, 1256, 1258, 1256, 1242, 1287, 1268,
  1258}, {1233, 1204, 1218, 1211, 1185, 1173, 1163, 1209, 1221,
  1179}, {1287, 1248, 1249, 1289, 1259, 1246, 1261, 1304, 1296,
  1267}, {1331, 1254, 1266, 1246, 1284, 1225, 1264, 1300, 1314,
  1299}, {1279, 1223, 1247, 1263, 1226, 1231, 1150, 1238, 1251,
  1240}, {1332, 1288, 1268, 1282, 1285, 1284, 1286, 1331, 1293,
  1272}, {1293, 1246, 1269, 1266, 1262, 1237, 1234, 1276, 1297,
  1255}, {1261, 1268, 1230, 1243, 1228, 1228, 1198, 1238, 1260,
  1227}, {1299, 1240, 1231, 1237, 1239, 1269, 1193, 1236, 1282,
  1251}, {1256, 1250, 1247, 1259, 1252, 1167, 1214, 1233, 1254, 1231}}

Out[13]= {{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}, {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}, {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}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}

In[14]:= Clear[r1Mat, r2Mat, aMat, bMat];
dim = 3000;
aMat = RandomInteger[1, {dim, dim}];
bMat = RandomInteger[1, {dim, dim}];

In[18]:= AbsoluteTiming[r1Mat = aMat.bMat;]
AbsoluteTiming[r2Mat = CUDADot[aMat, bMat];]
r1Mat == r2Mat

Out[18]= {19.341160, Null}

Out[19]= {6.500759, Null}

Out[20]= True

In[21]:= r1Mat[[1 ;; 10, 1 ;; 10]]
r2Mat[[1 ;; 10, 1 ;; 10]]

Out[21]= {{762, 707, 721, 719, 741, 753, 728, 742, 715, 685}, {761,
  727, 743, 744, 766, 743, 755, 747, 755, 723}, {739, 708, 733, 722,
  727, 737, 721, 747, 747, 711}, {766, 711, 748, 751, 751, 761, 752,
  733, 761, 705}, {761, 746, 759, 771, 769, 783, 750, 743, 808,
  721}, {789, 783, 775, 800, 808, 779, 771, 769, 801, 730}, {742, 706,
   748, 754, 720, 736, 750, 737, 743, 736}, {741, 718, 710, 740, 712,
  739, 757, 727, 719, 732}, {783, 721, 733, 722, 749, 759, 750, 743,
  748, 748}, {752, 737, 719, 713, 753, 768, 733, 716, 760, 728}}

Out[22]= {{762, 707, 721, 719, 741, 753, 728, 742, 715, 685}, {761,
  727, 743, 744, 766, 743, 755, 747, 755, 723}, {739, 708, 733, 722,
  727, 737, 721, 747, 747, 711}, {766, 711, 748, 751, 751, 761, 752,
  733, 761, 705}, {761, 746, 759, 771, 769, 783, 750, 743, 808,
  721}, {789, 783, 775, 800, 808, 779, 771, 769, 801, 730}, {742, 706,
   748, 754, 720, 736, 750, 737, 743, 736}, {741, 718, 710, 740, 712,
  739, 757, 727, 719, 732}, {783, 721, 733, 722, 749, 759, 750, 743,
  748, 748}, {752, 737, 719, 713, 753, 768, 733, 716, 760, 728}}=


  • Prev by Date: Re: question about CUDA
  • Next by Date: Re: fill in harberger triangle
  • Previous by thread: Re: Help on compiling a function
  • Next by thread: Re: CUDADot bug?