Commit 93c0807d by liyinqiao

Optimize the unit test.

1. Use the _CheckData with tolerance in unit test to avoid the bug in "0.0F != -0.0F" case.
2, Clean the codes.
parent dcd3a86b
...@@ -67,7 +67,9 @@ bool TestAbsolute1() ...@@ -67,7 +67,9 @@ bool TestAbsolute1()
bUser = Absolute(*a); bUser = Absolute(*a);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) && _CheckData(aMe, answer, unitNum, 1e-4F) && _CheckData(&bUser, answer, unitNum, 1e-4F); cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -89,7 +91,9 @@ bool TestAbsolute1() ...@@ -89,7 +91,9 @@ bool TestAbsolute1()
bUserGPU = Absolute(*aGPU); bUserGPU = Absolute(*aGPU);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) && _CheckData(&bUserGPU, answer, unitNum, 1e-4F); gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -93,7 +93,8 @@ bool TestConcatenate1() ...@@ -93,7 +93,8 @@ bool TestConcatenate1()
tUser = Concatenate(*sList, 1); tUser = Concatenate(*sList, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -122,7 +123,8 @@ bool TestConcatenate1() ...@@ -122,7 +123,8 @@ bool TestConcatenate1()
tUserGPU = Concatenate(*sList, 1); tUserGPU = Concatenate(*sList, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete sList; delete sList;
...@@ -222,7 +224,8 @@ bool TestConcatenate2() ...@@ -222,7 +224,8 @@ bool TestConcatenate2()
tUser = Concatenate(*sList, 0); tUser = Concatenate(*sList, 0);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -251,7 +254,8 @@ bool TestConcatenate2() ...@@ -251,7 +254,8 @@ bool TestConcatenate2()
tUserGPU = Concatenate(*sList, 0); tUserGPU = Concatenate(*sList, 0);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete sList; delete sList;
...@@ -349,7 +353,8 @@ bool TestConcatenate3() ...@@ -349,7 +353,8 @@ bool TestConcatenate3()
tUser = Concatenate(*sList, 1); tUser = Concatenate(*sList, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -378,7 +383,8 @@ bool TestConcatenate3() ...@@ -378,7 +383,8 @@ bool TestConcatenate3()
tUserGPU = Concatenate(*sList, 1); tUserGPU = Concatenate(*sList, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete sList; delete sList;
...@@ -469,7 +475,8 @@ bool TestConcatenate4() ...@@ -469,7 +475,8 @@ bool TestConcatenate4()
tUser = Concatenate(*s1, *s2, 1); tUser = Concatenate(*s1, *s2, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -491,7 +498,8 @@ bool TestConcatenate4() ...@@ -491,7 +498,8 @@ bool TestConcatenate4()
tUserGPU = Concatenate(*sGPU1, *sGPU2, 1); tUserGPU = Concatenate(*sGPU1, *sGPU2, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
......
...@@ -92,7 +92,7 @@ bool TestConcatenateSolely1() ...@@ -92,7 +92,7 @@ bool TestConcatenateSolely1()
_ConcatenateSolely(sList, t, 1); _ConcatenateSolely(sList, t, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -119,7 +119,7 @@ bool TestConcatenateSolely1() ...@@ -119,7 +119,7 @@ bool TestConcatenateSolely1()
_ConcatenateSolely(sList, tGPU, 1); _ConcatenateSolely(sList, tGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete sList; delete sList;
...@@ -217,7 +217,7 @@ bool TestConcatenateSolely2() ...@@ -217,7 +217,7 @@ bool TestConcatenateSolely2()
_ConcatenateSolely(sList, t, 0); _ConcatenateSolely(sList, t, 0);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -244,7 +244,7 @@ bool TestConcatenateSolely2() ...@@ -244,7 +244,7 @@ bool TestConcatenateSolely2()
_ConcatenateSolely(sList, tGPU, 0); _ConcatenateSolely(sList, tGPU, 0);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete sList; delete sList;
...@@ -340,7 +340,7 @@ bool TestConcatenateSolely3() ...@@ -340,7 +340,7 @@ bool TestConcatenateSolely3()
_ConcatenateSolely(sList, t, 1); _ConcatenateSolely(sList, t, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -367,7 +367,7 @@ bool TestConcatenateSolely3() ...@@ -367,7 +367,7 @@ bool TestConcatenateSolely3()
_ConcatenateSolely(sList, tGPU, 1); _ConcatenateSolely(sList, tGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete sList; delete sList;
......
...@@ -64,7 +64,7 @@ bool TestConvertDataType1() ...@@ -64,7 +64,7 @@ bool TestConvertDataType1()
_ConvertDataType(a, b); _ConvertDataType(a, b);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, aUnitNum); cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -81,7 +81,7 @@ bool TestConvertDataType1() ...@@ -81,7 +81,7 @@ bool TestConvertDataType1()
_ConvertDataType(aGPU, bGPU); _ConvertDataType(aGPU, bGPU);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum); gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -105,9 +105,9 @@ bool TestCopyIndexed1() ...@@ -105,9 +105,9 @@ bool TestCopyIndexed1()
tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum); tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) && cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum) && _CheckData(t2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum); _CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -134,9 +134,9 @@ bool TestCopyIndexed1() ...@@ -134,9 +134,9 @@ bool TestCopyIndexed1()
tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum); tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) && gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum) && _CheckData(tGPU2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum); _CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -250,9 +250,9 @@ bool TestCopyIndexed2() ...@@ -250,9 +250,9 @@ bool TestCopyIndexed2()
tUser = CopyIndexed(*s, dim, *sIndex, *tIndex); tUser = CopyIndexed(*s, dim, *sIndex, *tIndex);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) && cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum) && _CheckData(t2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum); _CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -279,9 +279,9 @@ bool TestCopyIndexed2() ...@@ -279,9 +279,9 @@ bool TestCopyIndexed2()
tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum); tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) && gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum) && _CheckData(tGPU2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum); _CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -395,9 +395,9 @@ bool TestCopyIndexed3() ...@@ -395,9 +395,9 @@ bool TestCopyIndexed3()
tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum); tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) && cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum) && _CheckData(t2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum); _CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -424,9 +424,9 @@ bool TestCopyIndexed3() ...@@ -424,9 +424,9 @@ bool TestCopyIndexed3()
tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum); tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) && gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum) && _CheckData(tGPU2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum); _CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -540,9 +540,9 @@ bool TestCopyIndexed4() ...@@ -540,9 +540,9 @@ bool TestCopyIndexed4()
tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum); tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) && cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum) && _CheckData(t2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum); _CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -569,9 +569,9 @@ bool TestCopyIndexed4() ...@@ -569,9 +569,9 @@ bool TestCopyIndexed4()
tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum); tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) && gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum) && _CheckData(tGPU2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum); _CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -685,9 +685,9 @@ bool TestCopyIndexed5() ...@@ -685,9 +685,9 @@ bool TestCopyIndexed5()
tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum); tUser = CopyIndexed(*s, dim, *sIndex, *tIndex, copyNum);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) && cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum) && _CheckData(t2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum); _CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -714,9 +714,9 @@ bool TestCopyIndexed5() ...@@ -714,9 +714,9 @@ bool TestCopyIndexed5()
tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum); tUserGPU = CopyIndexed(*sGPU, dim, *sIndexGPU, *tIndexGPU, copyNum);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) && gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum) && _CheckData(tGPU2, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum); _CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -835,8 +835,8 @@ bool TestCopyIndexed6() ...@@ -835,8 +835,8 @@ bool TestCopyIndexed6()
_CopyIndexed(s, t2, dim, sIndex, tIndex, copyNum); _CopyIndexed(s, t2, dim, sIndex, tIndex, copyNum);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer, tUnitNum) && cpuTest = _CheckData(t1, answer, tUnitNum, 1e-4F) &&
_CheckData(t2, answer, tUnitNum); _CheckData(t2, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -861,8 +861,8 @@ bool TestCopyIndexed6() ...@@ -861,8 +861,8 @@ bool TestCopyIndexed6()
_CopyIndexed(sGPU, tGPU2, dim, sIndexGPU, tIndexGPU, copyNum); _CopyIndexed(sGPU, tGPU2, dim, sIndexGPU, tIndexGPU, copyNum);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer, tUnitNum) && gpuTest = _CheckData(tGPU1, answer, tUnitNum, 1e-4F) &&
_CheckData(tGPU2, answer, tUnitNum); _CheckData(tGPU2, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -58,7 +58,8 @@ bool TestCopyValues1() ...@@ -58,7 +58,8 @@ bool TestCopyValues1()
tUser = CopyValues(*s); tUser = CopyValues(*s);
/* check results */ /* check results */
cpuTest = _CheckData(t, sData, sUnitNum) && _CheckData(&tUser, sData, sUnitNum); cpuTest = _CheckData(t, sData, sUnitNum, 1e-4F) &&
_CheckData(&tUser, sData, sUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -78,7 +79,8 @@ bool TestCopyValues1() ...@@ -78,7 +79,8 @@ bool TestCopyValues1()
tUserGPU = CopyValues(*sGPU); tUserGPU = CopyValues(*sGPU);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, sData, sUnitNum) && _CheckData(&tUser, sData, sUnitNum); gpuTest = _CheckData(tGPU, sData, sUnitNum, 1e-4F) &&
_CheckData(&tUser, sData, sUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -67,7 +67,9 @@ bool TestCos1() ...@@ -67,7 +67,9 @@ bool TestCos1()
bUser = Cos(*a); bUser = Cos(*a);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) && _CheckData(aMe, answer, unitNum, 1e-4F) && _CheckData(&bUser, answer, unitNum, 1e-4F); cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -89,7 +91,9 @@ bool TestCos1() ...@@ -89,7 +91,9 @@ bool TestCos1()
bUserGPU = Cos(*aGPU); bUserGPU = Cos(*aGPU);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) && _CheckData(&bUserGPU, answer, unitNum, 1e-4F); gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -81,9 +81,9 @@ bool TestDivDim1() ...@@ -81,9 +81,9 @@ bool TestDivDim1()
cUser = DivDim(*a, *b, 0); cUser = DivDim(*a, *b, 0);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer, aUnitNum) && cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum) && _CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum); _CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -108,9 +108,9 @@ bool TestDivDim1() ...@@ -108,9 +108,9 @@ bool TestDivDim1()
cUserGPU = DivDim(*aGPU, *bGPU, 0); cUserGPU = DivDim(*aGPU, *bGPU, 0);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) && gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum) && _CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum); _CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -195,9 +195,9 @@ bool TestDivDim2() ...@@ -195,9 +195,9 @@ bool TestDivDim2()
cUser = DivDim(*a, *b, 1); cUser = DivDim(*a, *b, 1);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer, aUnitNum) && cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum) && _CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum); _CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -222,9 +222,9 @@ bool TestDivDim2() ...@@ -222,9 +222,9 @@ bool TestDivDim2()
cUserGPU = DivDim(*aGPU, *bGPU, 1); cUserGPU = DivDim(*aGPU, *bGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) && gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum) && _CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum); _CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -90,8 +90,8 @@ bool TestGather1() ...@@ -90,8 +90,8 @@ bool TestGather1()
tUser = Gather(*s, *index); tUser = Gather(*s, *index);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum); _CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -113,8 +113,8 @@ bool TestGather1() ...@@ -113,8 +113,8 @@ bool TestGather1()
tUserGPU = Gather(*sGPU, *indexGPU); tUserGPU = Gather(*sGPU, *indexGPU);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum); _CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -65,7 +65,8 @@ bool TestHardTanH1() ...@@ -65,7 +65,8 @@ bool TestHardTanH1()
yUser = HardTanH(*x); yUser = HardTanH(*x);
/* check results */ /* check results */
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) && _CheckData(&yUser, answer, unitNum, 1e-4F); cpuTest = _CheckData(y, answer, unitNum, 1e-4F) &&
_CheckData(&yUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -85,7 +86,8 @@ bool TestHardTanH1() ...@@ -85,7 +86,8 @@ bool TestHardTanH1()
yUserGPU = HardTanH(*xGPU); yUserGPU = HardTanH(*xGPU);
/* check results */ /* check results */
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) && _CheckData(&yUserGPU, answer, unitNum, 1e-4F); gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) &&
_CheckData(&yUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete x; delete x;
......
...@@ -63,7 +63,8 @@ bool TestIdentity1() ...@@ -63,7 +63,8 @@ bool TestIdentity1()
yUser = Identity(*x); yUser = Identity(*x);
/* check result */ /* check result */
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) && _CheckData(&yUser, answer, unitNum, 1e-4F); cpuTest = _CheckData(y, answer, unitNum, 1e-4F) &&
_CheckData(&yUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -83,7 +84,8 @@ bool TestIdentity1() ...@@ -83,7 +84,8 @@ bool TestIdentity1()
yUserGPU = Identity(*xGPU); yUserGPU = Identity(*xGPU);
/* check result */ /* check result */
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) && _CheckData(&yUserGPU, answer, unitNum, 1e-4F); gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) &&
_CheckData(&yUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete x; delete x;
......
...@@ -67,7 +67,9 @@ bool TestLog1() ...@@ -67,7 +67,9 @@ bool TestLog1()
bUser = Log(*a); bUser = Log(*a);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) && _CheckData(aMe, answer, unitNum, 1e-4F) && _CheckData(&bUser, answer, unitNum, 1e-4F); cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -89,7 +91,9 @@ bool TestLog1() ...@@ -89,7 +91,9 @@ bool TestLog1()
bUserGPU = Log(*aGPU); bUserGPU = Log(*aGPU);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) && _CheckData(&bUserGPU, answer, unitNum, 1e-4F); gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -63,7 +63,8 @@ bool TestLogSoftmax1() ...@@ -63,7 +63,8 @@ bool TestLogSoftmax1()
yUser = LogSoftmax(*x, 1); yUser = LogSoftmax(*x, 1);
/* check result */ /* check result */
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) && _CheckData(&yUser, answer, unitNum, 1e-4F); cpuTest = _CheckData(y, answer, unitNum, 1e-4F) &&
_CheckData(&yUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -83,7 +84,8 @@ bool TestLogSoftmax1() ...@@ -83,7 +84,8 @@ bool TestLogSoftmax1()
yUserGPU = LogSoftmax(*xGPU, 1); yUserGPU = LogSoftmax(*xGPU, 1);
/* check result */ /* check result */
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) && _CheckData(&yUserGPU, answer, unitNum, 1e-4F); gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) &&
_CheckData(&yUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete x; delete x;
...@@ -150,8 +152,8 @@ bool TestLogSoftmax2() ...@@ -150,8 +152,8 @@ bool TestLogSoftmax2()
_LogSoftmaxBackward(g, y, x, dedy, dedx, NULL, 1, CROSSENTROPY); _LogSoftmaxBackward(g, y, x, dedy, dedx, NULL, 1, CROSSENTROPY);
/* check result */ /* check result */
cpuTest = _CheckData(y, yAnswer, unitNum, 1e-4F) cpuTest = _CheckData(y, yAnswer, unitNum, 1e-4F) &&
&& _CheckData(dedx, dedxAnswer, unitNum, 1e-4F); _CheckData(dedx, dedxAnswer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -178,7 +180,8 @@ bool TestLogSoftmax2() ...@@ -178,7 +180,8 @@ bool TestLogSoftmax2()
_LogSoftmaxBackward(gGPU, yGPU, xGPU, dedyGPU, dedxGPU, NULL, 1, CROSSENTROPY); _LogSoftmaxBackward(gGPU, yGPU, xGPU, dedyGPU, dedxGPU, NULL, 1, CROSSENTROPY);
/* check result */ /* check result */
gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F) && _CheckData(dedxGPU, dedxAnswer, unitNum, 1e-4F); gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F) &&
_CheckData(dedxGPU, dedxAnswer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete x; delete x;
...@@ -282,8 +285,8 @@ bool TestLogSoftmax3() ...@@ -282,8 +285,8 @@ bool TestLogSoftmax3()
_LogSoftmaxBackward(gGPU, yGPU, xGPU, dedyGPU, dedxGPU, NULL, 1, SQUAREDERROR); _LogSoftmaxBackward(gGPU, yGPU, xGPU, dedyGPU, dedxGPU, NULL, 1, SQUAREDERROR);
/* check result */ /* check result */
gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F) gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F) &&
&& _CheckData(dedxGPU, dedxAnswer, unitNum, 1e-3F); _CheckData(dedxGPU, dedxAnswer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete x; delete x;
......
...@@ -88,7 +88,8 @@ bool TestMatrixMul1() ...@@ -88,7 +88,8 @@ bool TestMatrixMul1()
tUser = MatrixMul(*s1, X_NOTRANS, *s2, X_NOTRANS); tUser = MatrixMul(*s1, X_NOTRANS, *s2, X_NOTRANS);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -110,7 +111,8 @@ bool TestMatrixMul1() ...@@ -110,7 +111,8 @@ bool TestMatrixMul1()
tUserGPU = MatrixMul(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS); tUserGPU = MatrixMul(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
...@@ -202,7 +204,8 @@ bool TestMatrixMul2() ...@@ -202,7 +204,8 @@ bool TestMatrixMul2()
tUser = MatrixMul(*s1, X_TRANS, *s2, X_NOTRANS); tUser = MatrixMul(*s1, X_TRANS, *s2, X_NOTRANS);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -224,7 +227,8 @@ bool TestMatrixMul2() ...@@ -224,7 +227,8 @@ bool TestMatrixMul2()
tUserGPU = MatrixMul(*sGPU1, X_TRANS, *sGPU2, X_NOTRANS); tUserGPU = MatrixMul(*sGPU1, X_TRANS, *sGPU2, X_NOTRANS);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
...@@ -336,7 +340,8 @@ bool TestMatrixMul3() ...@@ -336,7 +340,8 @@ bool TestMatrixMul3()
tUser = MatrixMul(*s1, X_NOTRANS, *s2, X_NOTRANS); tUser = MatrixMul(*s1, X_NOTRANS, *s2, X_NOTRANS);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -358,7 +363,8 @@ bool TestMatrixMul3() ...@@ -358,7 +363,8 @@ bool TestMatrixMul3()
tUserGPU = MatrixMul(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS); tUserGPU = MatrixMul(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
...@@ -459,7 +465,8 @@ bool TestMatrixMul4() ...@@ -459,7 +465,8 @@ bool TestMatrixMul4()
tUser = MatrixMul(*s1, X_NOTRANS, *s2, X_NOTRANS); tUser = MatrixMul(*s1, X_NOTRANS, *s2, X_NOTRANS);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -481,7 +488,8 @@ bool TestMatrixMul4() ...@@ -481,7 +488,8 @@ bool TestMatrixMul4()
tUserGPU = MatrixMul(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS); tUserGPU = MatrixMul(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
......
...@@ -86,7 +86,7 @@ bool TestMatrixMul2D1() ...@@ -86,7 +86,7 @@ bool TestMatrixMul2D1()
_MatrixMul2D(s1, X_NOTRANS, s2, X_NOTRANS, t); _MatrixMul2D(s1, X_NOTRANS, s2, X_NOTRANS, t);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -106,7 +106,7 @@ bool TestMatrixMul2D1() ...@@ -106,7 +106,7 @@ bool TestMatrixMul2D1()
_MatrixMul2D(sGPU1, X_NOTRANS, sGPU2, X_NOTRANS, tGPU); _MatrixMul2D(sGPU1, X_NOTRANS, sGPU2, X_NOTRANS, tGPU);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
...@@ -196,7 +196,7 @@ bool TestMatrixMul2D2() ...@@ -196,7 +196,7 @@ bool TestMatrixMul2D2()
_MatrixMul2D(s1, X_TRANS, s2, X_NOTRANS, t); _MatrixMul2D(s1, X_TRANS, s2, X_NOTRANS, t);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -216,7 +216,7 @@ bool TestMatrixMul2D2() ...@@ -216,7 +216,7 @@ bool TestMatrixMul2D2()
_MatrixMul2D(sGPU1, X_TRANS, sGPU2, X_NOTRANS, tGPU); _MatrixMul2D(sGPU1, X_TRANS, sGPU2, X_NOTRANS, tGPU);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
......
...@@ -86,7 +86,7 @@ bool TestMatrixMul2DParallel1() ...@@ -86,7 +86,7 @@ bool TestMatrixMul2DParallel1()
_MatrixMul2DParallel(s1, X_NOTRANS, s2, X_NOTRANS, t); _MatrixMul2DParallel(s1, X_NOTRANS, s2, X_NOTRANS, t);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
...@@ -162,7 +162,7 @@ bool TestMatrixMul2DParallel2() ...@@ -162,7 +162,7 @@ bool TestMatrixMul2DParallel2()
_MatrixMul2DParallel(s1, X_TRANS, s2, X_NOTRANS, t); _MatrixMul2DParallel(s1, X_TRANS, s2, X_NOTRANS, t);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
......
...@@ -88,7 +88,8 @@ bool TestMatrixMulBatched1() ...@@ -88,7 +88,8 @@ bool TestMatrixMulBatched1()
tUser = MatrixMulBatched(*s1, X_NOTRANS, *s2, X_NOTRANS); tUser = MatrixMulBatched(*s1, X_NOTRANS, *s2, X_NOTRANS);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -110,7 +111,8 @@ bool TestMatrixMulBatched1() ...@@ -110,7 +111,8 @@ bool TestMatrixMulBatched1()
tUserGPU = MatrixMulBatched(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS); tUserGPU = MatrixMulBatched(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
...@@ -210,7 +212,8 @@ bool TestMatrixMulBatched2() ...@@ -210,7 +212,8 @@ bool TestMatrixMulBatched2()
tUser = MatrixMulBatched(*s1, X_NOTRANS, *s2, X_NOTRANS); tUser = MatrixMulBatched(*s1, X_NOTRANS, *s2, X_NOTRANS);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -232,7 +235,8 @@ bool TestMatrixMulBatched2() ...@@ -232,7 +235,8 @@ bool TestMatrixMulBatched2()
tUserGPU = MatrixMulBatched(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS); tUserGPU = MatrixMulBatched(*sGPU1, X_NOTRANS, *sGPU2, X_NOTRANS);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
......
...@@ -72,7 +72,8 @@ bool TestMerge1() ...@@ -72,7 +72,8 @@ bool TestMerge1()
tUser = Merge(*s, 1, 0); tUser = Merge(*s, 1, 0);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -92,7 +93,8 @@ bool TestMerge1() ...@@ -92,7 +93,8 @@ bool TestMerge1()
tUserGPU = Merge(*sGPU, 1, 0); tUserGPU = Merge(*sGPU, 1, 0);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -186,8 +188,10 @@ bool TestMerge2() ...@@ -186,8 +188,10 @@ bool TestMerge2()
tUser2 = Merge(*s, 2, 0); tUser2 = Merge(*s, 2, 0);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData(&tUser1, answer1, tUnitNum1) cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
&& _CheckData(t2, answer2, tUnitNum2) && _CheckData(&tUser2, answer2, tUnitNum2); _CheckData(&tUser1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUser2, answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -212,8 +216,10 @@ bool TestMerge2() ...@@ -212,8 +216,10 @@ bool TestMerge2()
tUserGPU2 = Merge(*sGPU, 2, 0); tUserGPU2 = Merge(*sGPU, 2, 0);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData(&tUserGPU1, answer1, tUnitNum1) gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
&& _CheckData(tGPU2, answer2, tUnitNum2) && _CheckData(&tUserGPU2, answer2, tUnitNum2); _CheckData(&tUserGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUserGPU2, answer2, tUnitNum2, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -302,7 +308,8 @@ bool TestMerge3() ...@@ -302,7 +308,8 @@ bool TestMerge3()
tUser = Merge(*smallList, 0); tUser = Merge(*smallList, 0);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -331,7 +338,8 @@ bool TestMerge3() ...@@ -331,7 +338,8 @@ bool TestMerge3()
tUserGPU = Merge(*smallList, 0); tUserGPU = Merge(*smallList, 0);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
...@@ -418,7 +426,8 @@ bool TestMerge4() ...@@ -418,7 +426,8 @@ bool TestMerge4()
tUser = Merge(*smallList, 1); tUser = Merge(*smallList, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -447,7 +456,8 @@ bool TestMerge4() ...@@ -447,7 +456,8 @@ bool TestMerge4()
tUserGPU = Merge(*smallList, 1); tUserGPU = Merge(*smallList, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
......
...@@ -90,9 +90,9 @@ bool TestMultiply1() ...@@ -90,9 +90,9 @@ bool TestMultiply1()
tUser = Multiply(*s1, *s2, 0); tUser = Multiply(*s1, *s2, 0);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(tMe, answer, tUnitNum) && _CheckData(tMe, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum); _CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -117,9 +117,9 @@ bool TestMultiply1() ...@@ -117,9 +117,9 @@ bool TestMultiply1()
tUserGPU = Multiply(*sGPU1, *sGPU2, 0); tUserGPU = Multiply(*sGPU1, *sGPU2, 0);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(tMeGPU, answer, tUnitNum) && _CheckData(tMeGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum); _CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
...@@ -223,8 +223,8 @@ bool TestMultiply2() ...@@ -223,8 +223,8 @@ bool TestMultiply2()
tUser = Multiply(*s1, *s2); tUser = Multiply(*s1, *s2);
/* check results */ /* check results */
cpuTest = _CheckData(tMe, answer, 1e-4, tUnitNum) && cpuTest = _CheckData(tMe, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, 1e-4, tUnitNum); _CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
......
...@@ -80,9 +80,9 @@ bool TestMultiplyDim1() ...@@ -80,9 +80,9 @@ bool TestMultiplyDim1()
cUser = MultiplyDim(*a, *b, 0); cUser = MultiplyDim(*a, *b, 0);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer, aUnitNum) && cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum) && _CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum); _CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -107,9 +107,9 @@ bool TestMultiplyDim1() ...@@ -107,9 +107,9 @@ bool TestMultiplyDim1()
cUserGPU = MultiplyDim(*aGPU, *bGPU, 0); cUserGPU = MultiplyDim(*aGPU, *bGPU, 0);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) && gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum) && _CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum); _CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -192,9 +192,9 @@ bool TestMultiplyDim2() ...@@ -192,9 +192,9 @@ bool TestMultiplyDim2()
cUser = MultiplyDim(*a, *b, 1); cUser = MultiplyDim(*a, *b, 1);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer, aUnitNum) && cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum) && _CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum); _CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -219,9 +219,9 @@ bool TestMultiplyDim2() ...@@ -219,9 +219,9 @@ bool TestMultiplyDim2()
cUserGPU = MultiplyDim(*aGPU, *bGPU, 1); cUserGPU = MultiplyDim(*aGPU, *bGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) && gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum) && _CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum); _CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -63,7 +63,9 @@ bool TestNegate1() ...@@ -63,7 +63,9 @@ bool TestNegate1()
bUser = Negate(*a); bUser = Negate(*a);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) && _CheckData(aMe, answer, aUnitNum, 1e-4F) && _CheckData(&bUser, answer, aUnitNum, 1e-4F); cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) &&
_CheckData(aMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -85,7 +87,9 @@ bool TestNegate1() ...@@ -85,7 +87,9 @@ bool TestNegate1()
bUserGPU = Negate(*aGPU); bUserGPU = Negate(*aGPU);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) && _CheckData(aMeGPU, answer, aUnitNum, 1e-4F) && _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F); gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -147,7 +151,9 @@ bool TestNegate2() ...@@ -147,7 +151,9 @@ bool TestNegate2()
bUser = Negate(*a); bUser = Negate(*a);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) && _CheckData(aMe, answer, aUnitNum, 1e-4F) && _CheckData(&bUser, answer, aUnitNum, 1e-4F); cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) &&
_CheckData(aMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -169,7 +175,9 @@ bool TestNegate2() ...@@ -169,7 +175,9 @@ bool TestNegate2()
bUserGPU = Negate(*aGPU); bUserGPU = Negate(*aGPU);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) && _CheckData(aMeGPU, answer, aUnitNum, 1e-4F) && _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F); gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -127,8 +127,9 @@ bool TestNormalize1() ...@@ -127,8 +127,9 @@ bool TestNormalize1()
tUser = Normalize(*s, 0, *mean, *var, *a, *b, 0.0F); tUser = Normalize(*s, 0, *mean, *var, *a, *b, 0.0F);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
&& _CheckData(tMe, answer, tUnitNum, 1e-4F) && _CheckData(&tUser, answer, tUnitNum, 1e-4F); _CheckData(tMe, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -159,8 +160,9 @@ bool TestNormalize1() ...@@ -159,8 +160,9 @@ bool TestNormalize1()
tUserGPU = Normalize(*sGPU, 0, *meanGPU, *varGPU, *aGPU, *bGPU, 0.0F); tUserGPU = Normalize(*sGPU, 0, *meanGPU, *varGPU, *aGPU, *bGPU, 0.0F);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
&& _CheckData(tMeGPU, answer, tUnitNum, 1e-4F) && _CheckData(&tUserGPU, answer, tUnitNum, 1e-4F); _CheckData(tMeGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -62,7 +62,8 @@ bool TestRectify1() ...@@ -62,7 +62,8 @@ bool TestRectify1()
yUser = Rectify(*x); yUser = Rectify(*x);
/* check results */ /* check results */
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) && _CheckData(&yUser, answer, unitNum, 1e-4F); cpuTest = _CheckData(y, answer, unitNum, 1e-4F) &&
_CheckData(&yUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -82,7 +83,8 @@ bool TestRectify1() ...@@ -82,7 +83,8 @@ bool TestRectify1()
yUserGPU = Rectify(*xGPU); yUserGPU = Rectify(*xGPU);
/* check results */ /* check results */
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) && _CheckData(&yUserGPU, answer, unitNum, 1e-4F); gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) &&
_CheckData(&yUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete x; delete x;
......
...@@ -87,8 +87,10 @@ bool TestReduceMax1() ...@@ -87,8 +87,10 @@ bool TestReduceMax1()
tUser2 = ReduceMax(*s, 1); tUser2 = ReduceMax(*s, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData(&tUser1, answer1, tUnitNum1) cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
&& _CheckData(t2, answer2, tUnitNum2) && _CheckData(&tUser2, answer2, tUnitNum2); _CheckData(&tUser1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUser2, answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -113,8 +115,10 @@ bool TestReduceMax1() ...@@ -113,8 +115,10 @@ bool TestReduceMax1()
tUserGPU2 = ReduceMax(*sGPU, 1); tUserGPU2 = ReduceMax(*sGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData(&tUserGPU1, answer1, tUnitNum1) gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
&& _CheckData(tGPU2, answer2, tUnitNum2) && _CheckData(&tUserGPU2, answer2, tUnitNum2); _CheckData(&tUserGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUserGPU2, answer2, tUnitNum2, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -182,7 +186,8 @@ bool TestReduceMax2() ...@@ -182,7 +186,8 @@ bool TestReduceMax2()
tUser = ReduceMax(*s, 0); tUser = ReduceMax(*s, 0);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -203,7 +208,8 @@ bool TestReduceMax2() ...@@ -203,7 +208,8 @@ bool TestReduceMax2()
tUserGPU = ReduceMax(*sGPU, 0); tUserGPU = ReduceMax(*sGPU, 0);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -82,8 +82,10 @@ bool TestReduceMean1() ...@@ -82,8 +82,10 @@ bool TestReduceMean1()
tUser2 = ReduceMean(*s, 1); tUser2 = ReduceMean(*s, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData(&tUser1, answer1, tUnitNum1) cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
&& _CheckData(t2, answer2, tUnitNum2) && _CheckData(&tUser2, answer2, tUnitNum2); _CheckData(&tUser1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUser2, answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -108,8 +110,10 @@ bool TestReduceMean1() ...@@ -108,8 +110,10 @@ bool TestReduceMean1()
tUserGPU2 = ReduceMean(*sGPU, 1); tUserGPU2 = ReduceMean(*sGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData(&tUserGPU1, answer1, tUnitNum1) gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
&& _CheckData(tGPU2, answer2, tUnitNum2) && _CheckData(&tUserGPU2, answer2, tUnitNum2); _CheckData(&tUserGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUserGPU2, answer2, tUnitNum2, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -173,7 +177,8 @@ bool TestReduceMean2() ...@@ -173,7 +177,8 @@ bool TestReduceMean2()
tUser = ReduceMean(*s, 0); tUser = ReduceMean(*s, 0);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -193,7 +198,8 @@ bool TestReduceMean2() ...@@ -193,7 +198,8 @@ bool TestReduceMean2()
tUserGPU = ReduceMean(*sGPU, 0); tUserGPU = ReduceMean(*sGPU, 0);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -93,8 +93,10 @@ bool TestReduceSum1() ...@@ -93,8 +93,10 @@ bool TestReduceSum1()
tUser2 = ReduceSum(*s, 1, *shift2); tUser2 = ReduceSum(*s, 1, *shift2);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData(&tUser1, answer1, tUnitNum1) && cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2) && _CheckData(&tUser2, answer2, tUnitNum2); _CheckData(&tUser1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUser2, answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -123,8 +125,10 @@ bool TestReduceSum1() ...@@ -123,8 +125,10 @@ bool TestReduceSum1()
tUserGPU2 = ReduceSum(*sGPU, 1, *shiftGPU2); tUserGPU2 = ReduceSum(*sGPU, 1, *shiftGPU2);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData(&tUserGPU1, answer1, tUnitNum1) && gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2) && _CheckData(&tUserGPU2, answer2, tUnitNum2); _CheckData(&tUserGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUserGPU2, answer2, tUnitNum2, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -203,7 +207,8 @@ bool TestReduceSum2() ...@@ -203,7 +207,8 @@ bool TestReduceSum2()
tUser = ReduceSum(*s, 1); tUser = ReduceSum(*s, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer->data, tUnitNum) && _CheckData(&tUser, answer->data, tUnitNum); cpuTest = _CheckData(t, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer->data, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -222,7 +227,8 @@ bool TestReduceSum2() ...@@ -222,7 +227,8 @@ bool TestReduceSum2()
tUserGPU = ReduceSum(*sGPU, 1); tUserGPU = ReduceSum(*sGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer->data, tUnitNum) && _CheckData(&tUserGPU, answer->data, tUnitNum); gpuTest = _CheckData(tGPU, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer->data, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -292,7 +298,8 @@ bool TestReduceSum3() ...@@ -292,7 +298,8 @@ bool TestReduceSum3()
tUser = ReduceSum(*s, 1); tUser = ReduceSum(*s, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer->data, tUnitNum) && _CheckData(&tUser, answer->data, tUnitNum); cpuTest = _CheckData(t, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer->data, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -311,7 +318,8 @@ bool TestReduceSum3() ...@@ -311,7 +318,8 @@ bool TestReduceSum3()
tUserGPU = ReduceSum(*sGPU, 1); tUserGPU = ReduceSum(*sGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer->data, tUnitNum) && _CheckData(&tUserGPU, answer->data, tUnitNum); gpuTest = _CheckData(tGPU, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer->data, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -381,7 +389,8 @@ bool TestReduceSum4() ...@@ -381,7 +389,8 @@ bool TestReduceSum4()
tUser = ReduceSum(*s, 1); tUser = ReduceSum(*s, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer->data, tUnitNum) && _CheckData(&tUser, answer->data, tUnitNum); cpuTest = _CheckData(t, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer->data, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -400,7 +409,8 @@ bool TestReduceSum4() ...@@ -400,7 +409,8 @@ bool TestReduceSum4()
tUserGPU = ReduceSum(*sGPU, 1); tUserGPU = ReduceSum(*sGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer->data, tUnitNum) && _CheckData(&tUserGPU, answer->data, tUnitNum); gpuTest = _CheckData(tGPU, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer->data, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -472,7 +482,8 @@ bool TestReduceSum5() ...@@ -472,7 +482,8 @@ bool TestReduceSum5()
tUser = ReduceSum(*s, 1); tUser = ReduceSum(*s, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer->data, tUnitNum) && _CheckData(&tUser, answer->data, tUnitNum); cpuTest = _CheckData(t, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer->data, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -491,7 +502,8 @@ bool TestReduceSum5() ...@@ -491,7 +502,8 @@ bool TestReduceSum5()
tUserGPU = ReduceSum(*sGPU, 1); tUserGPU = ReduceSum(*sGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer->data, tUnitNum) && _CheckData(&tUserGPU, answer->data, tUnitNum); gpuTest = _CheckData(tGPU, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer->data, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -564,7 +576,8 @@ bool TestReduceSum6() ...@@ -564,7 +576,8 @@ bool TestReduceSum6()
tUser = ReduceSum(*s, 1); tUser = ReduceSum(*s, 1);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer->data, tUnitNum) && _CheckData(&tUser, answer->data, tUnitNum); cpuTest = _CheckData(t, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer->data, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -583,7 +596,8 @@ bool TestReduceSum6() ...@@ -583,7 +596,8 @@ bool TestReduceSum6()
tUserGPU = ReduceSum(*sGPU, 1); tUserGPU = ReduceSum(*sGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer->data, tUnitNum) && _CheckData(&tUserGPU, answer->data, tUnitNum); gpuTest = _CheckData(tGPU, answer->data, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer->data, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -649,7 +663,8 @@ bool TestReduceSum7() ...@@ -649,7 +663,8 @@ bool TestReduceSum7()
tUser = ReduceSum(*s, 0); tUser = ReduceSum(*s, 0);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -669,7 +684,8 @@ bool TestReduceSum7() ...@@ -669,7 +684,8 @@ bool TestReduceSum7()
tUserGPU = ReduceSum(*sGPU, 0); tUserGPU = ReduceSum(*sGPU, 0);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -83,7 +83,8 @@ bool TestReduceSumSquared1() ...@@ -83,7 +83,8 @@ bool TestReduceSumSquared1()
tUser = ReduceSumSquared(*s, 0, *shift); tUser = ReduceSumSquared(*s, 0, *shift);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -105,7 +106,8 @@ bool TestReduceSumSquared1() ...@@ -105,7 +106,8 @@ bool TestReduceSumSquared1()
tUserGPU = ReduceSumSquared(*sGPU, 0, *shiftGPU); tUserGPU = ReduceSumSquared(*sGPU, 0, *shiftGPU);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -191,7 +193,8 @@ bool TestReduceSumSquared2() ...@@ -191,7 +193,8 @@ bool TestReduceSumSquared2()
tUser = ReduceSumSquared(*s, 1, *shift); tUser = ReduceSumSquared(*s, 1, *shift);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -213,7 +216,8 @@ bool TestReduceSumSquared2() ...@@ -213,7 +216,8 @@ bool TestReduceSumSquared2()
tUserGPU = ReduceSumSquared(*sGPU, 1, *shiftGPU); tUserGPU = ReduceSumSquared(*sGPU, 1, *shiftGPU);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -289,7 +293,8 @@ bool TestReduceSumSquared3() ...@@ -289,7 +293,8 @@ bool TestReduceSumSquared3()
tUser = ReduceSumSquared(*s, 0, *shift); tUser = ReduceSumSquared(*s, 0, *shift);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -311,7 +316,8 @@ bool TestReduceSumSquared3() ...@@ -311,7 +316,8 @@ bool TestReduceSumSquared3()
tUserGPU = ReduceSumSquared(*sGPU, 0, *shiftGPU); tUserGPU = ReduceSumSquared(*sGPU, 0, *shiftGPU);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -83,7 +83,8 @@ bool TestReduceVariance1() ...@@ -83,7 +83,8 @@ bool TestReduceVariance1()
tUser = ReduceVariance(*s, 0, *mean); tUser = ReduceVariance(*s, 0, *mean);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -105,7 +106,8 @@ bool TestReduceVariance1() ...@@ -105,7 +106,8 @@ bool TestReduceVariance1()
tUserGPU = ReduceVariance(*sGPU, 0, *meanGPU); tUserGPU = ReduceVariance(*sGPU, 0, *meanGPU);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -181,7 +183,8 @@ bool TestReduceVariance2() ...@@ -181,7 +183,8 @@ bool TestReduceVariance2()
tUser = ReduceVariance(*s, 0, *mean); tUser = ReduceVariance(*s, 0, *mean);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -203,7 +206,8 @@ bool TestReduceVariance2() ...@@ -203,7 +206,8 @@ bool TestReduceVariance2()
tUserGPU = ReduceVariance(*sGPU, 0, *meanGPU); tUserGPU = ReduceVariance(*sGPU, 0, *meanGPU);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -67,8 +67,9 @@ bool TestScaleAndShift1() ...@@ -67,8 +67,9 @@ bool TestScaleAndShift1()
tUser = ScaleAndShift(*s, scaleFactor, shiftFactor); tUser = ScaleAndShift(*s, scaleFactor, shiftFactor);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, sUnitNum) && cpuTest = _CheckData(t, answer, sUnitNum, 1e-4F) &&
_CheckData(tMe, answer, sUnitNum) && _CheckData(&tUser, answer, sUnitNum); _CheckData(tMe, answer, sUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -90,8 +91,9 @@ bool TestScaleAndShift1() ...@@ -90,8 +91,9 @@ bool TestScaleAndShift1()
tUserGPU = ScaleAndShift(*sGPU, scaleFactor, shiftFactor); tUserGPU = ScaleAndShift(*sGPU, scaleFactor, shiftFactor);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, sUnitNum) && gpuTest = _CheckData(tGPU, answer, sUnitNum, 1e-4F) &&
_CheckData(tMeGPU, answer, sUnitNum) && _CheckData(&tUserGPU, answer, sUnitNum); _CheckData(tMeGPU, answer, sUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, sUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -79,7 +79,8 @@ bool TestSelect1() ...@@ -79,7 +79,8 @@ bool TestSelect1()
tUser = SelectRange(*s, 2, 1, 3); tUser = SelectRange(*s, 2, 1, 3);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -99,7 +100,8 @@ bool TestSelect1() ...@@ -99,7 +100,8 @@ bool TestSelect1()
tUserGPU = SelectRange(*sGPU, 2, 1, 3); tUserGPU = SelectRange(*sGPU, 2, 1, 3);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -54,7 +54,7 @@ bool TestSetAscendingOrder1() ...@@ -54,7 +54,7 @@ bool TestSetAscendingOrder1()
SetAscendingOrder(*s, 1); SetAscendingOrder(*s, 1);
/* check results */ /* check results */
cpuTest = _CheckData(s, answer, sUnitNum); cpuTest = _CheckData(s, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -70,7 +70,7 @@ bool TestSetAscendingOrder1() ...@@ -70,7 +70,7 @@ bool TestSetAscendingOrder1()
SetAscendingOrder(*sGPU, 1); SetAscendingOrder(*sGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(sGPU, answer, sUnitNum); gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -126,7 +126,7 @@ bool TestSetData2() ...@@ -126,7 +126,7 @@ bool TestSetData2()
_SetDataIndexed(s, modify, 0, 1); _SetDataIndexed(s, modify, 0, 1);
/* check results */ /* check results */
cpuTest = _CheckData(s, answer, sUnitNum, 1e-5F); cpuTest = _CheckData(s, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -143,7 +143,7 @@ bool TestSetData2() ...@@ -143,7 +143,7 @@ bool TestSetData2()
/* call SetDataIndexed function */ /* call SetDataIndexed function */
_SetDataIndexed(sGPU, modifyGPU, 0, 1); _SetDataIndexed(sGPU, modifyGPU, 0, 1);
gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-5F); gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -220,7 +220,7 @@ bool TestSetData3() ...@@ -220,7 +220,7 @@ bool TestSetData3()
_SetDataIndexed(s, modify, 1, 1); _SetDataIndexed(s, modify, 1, 1);
/* check results */ /* check results */
cpuTest = _CheckData(s, answer, sUnitNum, 1e-5F); cpuTest = _CheckData(s, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -237,7 +237,7 @@ bool TestSetData3() ...@@ -237,7 +237,7 @@ bool TestSetData3()
/* call SetDataIndexed function */ /* call SetDataIndexed function */
_SetDataIndexed(sGPU, modifyGPU, 1, 1); _SetDataIndexed(sGPU, modifyGPU, 1, 1);
gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-5F); gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -66,7 +66,9 @@ bool TestSign1() ...@@ -66,7 +66,9 @@ bool TestSign1()
bUser = Sign(*a); bUser = Sign(*a);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) && _CheckData(aMe, answer, aUnitNum, 1e-4F) && _CheckData(&bUser, answer, aUnitNum, 1e-4F); cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) &&
_CheckData(aMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -88,7 +90,9 @@ bool TestSign1() ...@@ -88,7 +90,9 @@ bool TestSign1()
bUserGPU = Sign(*aGPU); bUserGPU = Sign(*aGPU);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) && _CheckData(aMeGPU, answer, aUnitNum, 1e-4F) && _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F); gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
delete b; delete b;
......
...@@ -67,7 +67,9 @@ bool TestSin1() ...@@ -67,7 +67,9 @@ bool TestSin1()
bUser = Sin(*a); bUser = Sin(*a);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) && _CheckData(aMe, answer, unitNum, 1e-4F) && _CheckData(&bUser, answer, unitNum, 1e-4F); cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -89,7 +91,9 @@ bool TestSin1() ...@@ -89,7 +91,9 @@ bool TestSin1()
bUserGPU = Sin(*aGPU); bUserGPU = Sin(*aGPU);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) && _CheckData(&bUserGPU, answer, unitNum, 1e-4F); gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -64,7 +64,8 @@ bool TestSoftmax1() ...@@ -64,7 +64,8 @@ bool TestSoftmax1()
yUser = Softmax(*x, 1); yUser = Softmax(*x, 1);
/* check result */ /* check result */
cpuTest = _CheckData(y, answer, unitNum, 1e-4F) && _CheckData(&yUser, answer, unitNum, 1e-4F); cpuTest = _CheckData(y, answer, unitNum, 1e-4F) &&
_CheckData(&yUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -84,7 +85,8 @@ bool TestSoftmax1() ...@@ -84,7 +85,8 @@ bool TestSoftmax1()
yUserGPU = Softmax(*xGPU, 1); yUserGPU = Softmax(*xGPU, 1);
/* check result */ /* check result */
gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) && _CheckData(&yUserGPU, answer, unitNum, 1e-4F); gpuTest = _CheckData(yGPU, answer, unitNum, 1e-4F) &&
_CheckData(&yUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete x; delete x;
...@@ -150,8 +152,8 @@ bool TestSoftmax2() ...@@ -150,8 +152,8 @@ bool TestSoftmax2()
_SoftmaxBackward(g, y, x, dedy, dedx, NULL, 1, CROSSENTROPY); _SoftmaxBackward(g, y, x, dedy, dedx, NULL, 1, CROSSENTROPY);
/* check result */ /* check result */
cpuTest = _CheckData(y, yAnswer, unitNum, 1e-4F) cpuTest = _CheckData(y, yAnswer, unitNum, 1e-4F) &&
&& _CheckData(dedx, dedxAnswer, unitNum, 1e-4F); _CheckData(dedx, dedxAnswer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -178,8 +180,8 @@ bool TestSoftmax2() ...@@ -178,8 +180,8 @@ bool TestSoftmax2()
_SoftmaxBackward(gGPU, yGPU, xGPU, dedyGPU, dedxGPU, NULL, 1, CROSSENTROPY); _SoftmaxBackward(gGPU, yGPU, xGPU, dedyGPU, dedxGPU, NULL, 1, CROSSENTROPY);
/* check result */ /* check result */
gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F) gpuTest = _CheckData(yGPU, yAnswer, unitNum, 1e-4F) &&
&& _CheckData(dedxGPU, dedxAnswer, unitNum, 1e-4F); _CheckData(dedxGPU, dedxAnswer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete x; delete x;
......
...@@ -62,9 +62,9 @@ bool TestSort1() ...@@ -62,9 +62,9 @@ bool TestSort1()
_SortMe(aMe, index, 0); _SortMe(aMe, index, 0);
Sort(*a, bUser, *index, 0); Sort(*a, bUser, *index, 0);
cpuTest = _CheckData(b, answer, unitNum) && cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum) && _CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum); _CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -88,9 +88,9 @@ bool TestSort1() ...@@ -88,9 +88,9 @@ bool TestSort1()
Sort(*aGPU, bUserGPU, *indexGPU, 0); Sort(*aGPU, bUserGPU, *indexGPU, 0);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, unitNum) && gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum); _CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -154,9 +154,9 @@ bool TestSort2() ...@@ -154,9 +154,9 @@ bool TestSort2()
Sort(*a, bUser, *index, 1); Sort(*a, bUser, *index, 1);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, unitNum) && cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum) && _CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum); _CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -180,9 +180,9 @@ bool TestSort2() ...@@ -180,9 +180,9 @@ bool TestSort2()
Sort(*aGPU, bUserGPU, *indexGPU, 1); Sort(*aGPU, bUserGPU, *indexGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, unitNum) && gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum); _CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -77,7 +77,8 @@ bool TestSplit1() ...@@ -77,7 +77,8 @@ bool TestSplit1()
tUser = Split(*s, 0, 2); tUser = Split(*s, 0, 2);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -97,7 +98,8 @@ bool TestSplit1() ...@@ -97,7 +98,8 @@ bool TestSplit1()
tUserGPU = Split(*sGPU, 0, 2); tUserGPU = Split(*sGPU, 0, 2);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -173,7 +175,8 @@ bool TestSplit2() ...@@ -173,7 +175,8 @@ bool TestSplit2()
tUser = Split(*s, 1, 2); tUser = Split(*s, 1, 2);
/* check results */ /* check results */
cpuTest = _CheckData(t, answer, tUnitNum) && _CheckData(&tUser, answer, tUnitNum); cpuTest = _CheckData(t, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUser, answer, tUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
...@@ -194,7 +197,8 @@ bool TestSplit2() ...@@ -194,7 +197,8 @@ bool TestSplit2()
tUserGPU = Split(*sGPU, 1, 2); tUserGPU = Split(*sGPU, 1, 2);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU, answer, tUnitNum) && _CheckData(&tUserGPU, answer, tUnitNum); gpuTest = _CheckData(tGPU, answer, tUnitNum, 1e-4F) &&
_CheckData(&tUserGPU, answer, tUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -293,8 +297,10 @@ bool TestSplit3() ...@@ -293,8 +297,10 @@ bool TestSplit3()
Split(*s, tUserList, 1, 2); Split(*s, tUserList, 1, 2);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData((XTensor *)tUserList.Get(0), answer1, tUnitNum1) && cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2) && _CheckData((XTensor *)tUserList.Get(1), answer2, tUnitNum2); _CheckData((XTensor *)tUserList.Get(0), answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData((XTensor *)tUserList.Get(1), answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -328,8 +334,10 @@ bool TestSplit3() ...@@ -328,8 +334,10 @@ bool TestSplit3()
Split(*sGPU, tUserList, 1, 2); Split(*sGPU, tUserList, 1, 2);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData((XTensor *)tUserList.Get(0), answer1, tUnitNum1) && gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2) && _CheckData((XTensor *)tUserList.Get(1), answer2, tUnitNum2); _CheckData((XTensor *)tUserList.Get(0), answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData((XTensor *)tUserList.Get(1), answer2, tUnitNum2, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
...@@ -98,7 +98,7 @@ bool TestSpread1() ...@@ -98,7 +98,7 @@ bool TestSpread1()
_Spread(s, modify, 0, srcIndex, 2, tgtIndex); _Spread(s, modify, 0, srcIndex, 2, tgtIndex);
/* check results */ /* check results */
cpuTest = _CheckData(s, answer, sUnitNum, 1e-5F); cpuTest = _CheckData(s, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -115,7 +115,7 @@ bool TestSpread1() ...@@ -115,7 +115,7 @@ bool TestSpread1()
/* call _Spread function */ /* call _Spread function */
_Spread(sGPU, modifyGPU, 0, srcIndex, 2, tgtIndex); _Spread(sGPU, modifyGPU, 0, srcIndex, 2, tgtIndex);
gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-5F); gpuTest = _CheckData(sGPU, answer, sUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
...@@ -207,8 +207,8 @@ bool TestSpread2() ...@@ -207,8 +207,8 @@ bool TestSpread2()
_SpreadForGather(s2, t, sIndex); _SpreadForGather(s2, t, sIndex);
/* check results */ /* check results */
cpuTest = _CheckData(s1, answer, sUnitNum) && cpuTest = _CheckData(s1, answer, sUnitNum, 1e-4F) &&
_CheckData(s2, answer, sUnitNum); _CheckData(s2, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -233,8 +233,8 @@ bool TestSpread2() ...@@ -233,8 +233,8 @@ bool TestSpread2()
_SpreadForGather(sGPU2, tGPU, sIndexGPU); _SpreadForGather(sGPU2, tGPU, sIndexGPU);
/* check results */ /* check results */
gpuTest = _CheckData(sGPU1, answer, sUnitNum) && gpuTest = _CheckData(sGPU1, answer, sUnitNum, 1e-4F) &&
_CheckData(sGPU2, answer, sUnitNum); _CheckData(sGPU2, answer, sUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
...@@ -342,8 +342,8 @@ bool TestSpread3() ...@@ -342,8 +342,8 @@ bool TestSpread3()
_SpreadForCopyIndexed(s2, t, dim, sIndex, tIndex, 1); _SpreadForCopyIndexed(s2, t, dim, sIndex, tIndex, 1);
/* check results */ /* check results */
cpuTest = _CheckData(s1, answer, sUnitNum) && cpuTest = _CheckData(s1, answer, sUnitNum, 1e-4F) &&
_CheckData(s2, answer, sUnitNum); _CheckData(s2, answer, sUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -368,8 +368,8 @@ bool TestSpread3() ...@@ -368,8 +368,8 @@ bool TestSpread3()
_SpreadForCopyIndexed(sGPU2, tGPU, dim, sIndexGPU, tIndexGPU, 1); _SpreadForCopyIndexed(sGPU2, tGPU, dim, sIndexGPU, tIndexGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(sGPU1, answer, sUnitNum) && gpuTest = _CheckData(sGPU1, answer, sUnitNum, 1e-4F) &&
_CheckData(sGPU2, answer, sUnitNum); _CheckData(sGPU2, answer, sUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s1; delete s1;
......
...@@ -66,8 +66,9 @@ bool TestSub1() ...@@ -66,8 +66,9 @@ bool TestSub1()
cUser = Sub(*a, *b); cUser = Sub(*a, *b);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer, unitNum) cpuTest = _CheckData(c, answer, unitNum, 1e-4F) &&
&& _CheckData(cMe, answer, unitNum) && _CheckData(&cUser, answer, unitNum); _CheckData(cMe, answer, unitNum, 1e-4F) &&
_CheckData(&cUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -92,8 +93,9 @@ bool TestSub1() ...@@ -92,8 +93,9 @@ bool TestSub1()
cUserGPU = Sub(*aGPU, *bGPU); cUserGPU = Sub(*aGPU, *bGPU);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F) gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F) &&
&& _CheckData(cMeGPU, answer, unitNum, 1e-4F) && _CheckData(&cUserGPU, answer, unitNum, 1e-4F); _CheckData(cMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -162,8 +164,9 @@ bool TestSub2() ...@@ -162,8 +164,9 @@ bool TestSub2()
cUser = Sub(*a, *b, beta); cUser = Sub(*a, *b, beta);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer, unitNum) cpuTest = _CheckData(c, answer, unitNum, 1e-4F) &&
&& _CheckData(cMe, answer, unitNum) && _CheckData(&cUser, answer, unitNum); _CheckData(cMe, answer, unitNum, 1e-4F) &&
_CheckData(&cUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -188,8 +191,9 @@ bool TestSub2() ...@@ -188,8 +191,9 @@ bool TestSub2()
cUserGPU = Sub(*aGPU, *bGPU, beta); cUserGPU = Sub(*aGPU, *bGPU, beta);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F) gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F) &&
&& _CheckData(cMeGPU, answer, unitNum, 1e-4F) && _CheckData(&cUserGPU, answer, unitNum, 1e-4F); _CheckData(cMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -267,7 +271,7 @@ bool TestSub3() ...@@ -267,7 +271,7 @@ bool TestSub3()
cUser = Sub(*a, *b, beta); cUser = Sub(*a, *b, beta);
/* check results */ /* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum); cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -286,7 +290,7 @@ bool TestSub3() ...@@ -286,7 +290,7 @@ bool TestSub3()
cUserGPU = Sub(*aGPU, *bGPU, beta); cUserGPU = Sub(*aGPU, *bGPU, beta);
/* check results */ /* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum); gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -369,7 +373,7 @@ bool TestSub4() ...@@ -369,7 +373,7 @@ bool TestSub4()
cUser = Sub(*a, *b, beta); cUser = Sub(*a, *b, beta);
/* check results */ /* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum); cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -388,7 +392,7 @@ bool TestSub4() ...@@ -388,7 +392,7 @@ bool TestSub4()
cUserGPU = Sub(*aGPU, *bGPU, beta); cUserGPU = Sub(*aGPU, *bGPU, beta);
/* check results */ /* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum); gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -471,7 +475,7 @@ bool TestSub5() ...@@ -471,7 +475,7 @@ bool TestSub5()
cUser = Sub(*a, *b, beta); cUser = Sub(*a, *b, beta);
/* check results */ /* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum); cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -490,7 +494,7 @@ bool TestSub5() ...@@ -490,7 +494,7 @@ bool TestSub5()
cUserGPU = Sub(*aGPU, *bGPU, beta); cUserGPU = Sub(*aGPU, *bGPU, beta);
/* check results */ /* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum); gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -66,8 +66,9 @@ bool TestSum1() ...@@ -66,8 +66,9 @@ bool TestSum1()
cUser = Sum(*a, *b); cUser = Sum(*a, *b);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer, unitNum) cpuTest = _CheckData(c, answer, unitNum, 1e-4F) &&
&& _CheckData(cMe, answer, unitNum) && _CheckData(&cUser, answer, unitNum); _CheckData(cMe, answer, unitNum, 1e-4F) &&
_CheckData(&cUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -92,8 +93,9 @@ bool TestSum1() ...@@ -92,8 +93,9 @@ bool TestSum1()
cUserGPU = Sum(*aGPU, *bGPU); cUserGPU = Sum(*aGPU, *bGPU);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer, unitNum) gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F) &&
&& _CheckData(cMeGPU, answer, unitNum) && _CheckData(&cUserGPU, answer, unitNum); _CheckData(cMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -162,8 +164,9 @@ bool TestSum2() ...@@ -162,8 +164,9 @@ bool TestSum2()
cUser = Sum(*a, *b, beta); cUser = Sum(*a, *b, beta);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer, unitNum) cpuTest = _CheckData(c, answer, unitNum, 1e-4F) &&
&& _CheckData(cMe, answer, unitNum) && _CheckData(&cUser, answer, unitNum); _CheckData(cMe, answer, unitNum, 1e-4F) &&
_CheckData(&cUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -188,8 +191,9 @@ bool TestSum2() ...@@ -188,8 +191,9 @@ bool TestSum2()
cUserGPU = Sum(*aGPU, *bGPU, beta); cUserGPU = Sum(*aGPU, *bGPU, beta);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer, unitNum) gpuTest = _CheckData(cGPU, answer, unitNum, 1e-4F) &&
&& _CheckData(cMeGPU, answer, unitNum) && _CheckData(&cUserGPU, answer, unitNum); _CheckData(cMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -267,7 +271,7 @@ bool TestSum3() ...@@ -267,7 +271,7 @@ bool TestSum3()
cUser = Sum(*a, *b, beta); cUser = Sum(*a, *b, beta);
/* check results */ /* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum); cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -286,7 +290,7 @@ bool TestSum3() ...@@ -286,7 +290,7 @@ bool TestSum3()
cUserGPU = Sum(*aGPU, *bGPU, beta); cUserGPU = Sum(*aGPU, *bGPU, beta);
/* check results */ /* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum); gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -369,7 +373,7 @@ bool TestSum4() ...@@ -369,7 +373,7 @@ bool TestSum4()
cUser = Sum(*a, *b, beta); cUser = Sum(*a, *b, beta);
/* check results */ /* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum); cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -388,7 +392,7 @@ bool TestSum4() ...@@ -388,7 +392,7 @@ bool TestSum4()
cUserGPU = Sum(*aGPU, *bGPU, beta); cUserGPU = Sum(*aGPU, *bGPU, beta);
/* check results */ /* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum); gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -471,7 +475,7 @@ bool TestSum5() ...@@ -471,7 +475,7 @@ bool TestSum5()
cUser = Sum(*a, *b, beta); cUser = Sum(*a, *b, beta);
/* check results */ /* check results */
cpuTest = _CheckData(&cUser, answer, cUnitNum); cpuTest = _CheckData(&cUser, answer, cUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -490,7 +494,7 @@ bool TestSum5() ...@@ -490,7 +494,7 @@ bool TestSum5()
cUserGPU = Sum(*aGPU, *bGPU, beta); cUserGPU = Sum(*aGPU, *bGPU, beta);
/* check results */ /* check results */
gpuTest = _CheckData(&cUserGPU, answer, cUnitNum); gpuTest = _CheckData(&cUserGPU, answer, cUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -82,9 +82,9 @@ bool TestSumDim1() ...@@ -82,9 +82,9 @@ bool TestSumDim1()
cUser = SumDim(*a, *b, 0); cUser = SumDim(*a, *b, 0);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer, aUnitNum) && cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum) && _CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum); _CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -109,9 +109,9 @@ bool TestSumDim1() ...@@ -109,9 +109,9 @@ bool TestSumDim1()
cUserGPU = SumDim(*aGPU, *bGPU, 0); cUserGPU = SumDim(*aGPU, *bGPU, 0);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) && gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum) && _CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum); _CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -196,9 +196,9 @@ bool TestSumDim2() ...@@ -196,9 +196,9 @@ bool TestSumDim2()
cUser = SumDim(*a, *b, 1); cUser = SumDim(*a, *b, 1);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer, aUnitNum) && cpuTest = _CheckData(c, answer, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer, aUnitNum) && _CheckData(cMe, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer, aUnitNum); _CheckData(&cUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -223,9 +223,9 @@ bool TestSumDim2() ...@@ -223,9 +223,9 @@ bool TestSumDim2()
cUserGPU = SumDim(*aGPU, *bGPU, 1); cUserGPU = SumDim(*aGPU, *bGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer, aUnitNum) && gpuTest = _CheckData(cGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer, aUnitNum) && _CheckData(cMeGPU, answer, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer, aUnitNum); _CheckData(&cUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -305,9 +305,9 @@ bool TestSumDim3() ...@@ -305,9 +305,9 @@ bool TestSumDim3()
cUser = SumDim(*a, *b, 1); cUser = SumDim(*a, *b, 1);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer->data, aUnitNum) && cpuTest = _CheckData(c, answer->data, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer->data, aUnitNum) && _CheckData(cMe, answer->data, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer->data, aUnitNum); _CheckData(&cUser, answer->data, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -331,9 +331,9 @@ bool TestSumDim3() ...@@ -331,9 +331,9 @@ bool TestSumDim3()
cUserGPU = SumDim(*aGPU, *bGPU, 1); cUserGPU = SumDim(*aGPU, *bGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer->data, aUnitNum) && gpuTest = _CheckData(cGPU, answer->data, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer->data, aUnitNum) && _CheckData(cMeGPU, answer->data, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer->data, aUnitNum); _CheckData(&cUserGPU, answer->data, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -414,9 +414,9 @@ bool TestSumDim4() ...@@ -414,9 +414,9 @@ bool TestSumDim4()
cUser = SumDim(*a, *b, 1); cUser = SumDim(*a, *b, 1);
/* check results */ /* check results */
cpuTest = _CheckData(c, answer->data, aUnitNum) && cpuTest = _CheckData(c, answer->data, aUnitNum, 1e-4F) &&
_CheckData(cMe, answer->data, aUnitNum) && _CheckData(cMe, answer->data, aUnitNum, 1e-4F) &&
_CheckData(&cUser, answer->data, aUnitNum); _CheckData(&cUser, answer->data, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -440,9 +440,9 @@ bool TestSumDim4() ...@@ -440,9 +440,9 @@ bool TestSumDim4()
cUserGPU = SumDim(*aGPU, *bGPU, 1); cUserGPU = SumDim(*aGPU, *bGPU, 1);
/* check results */ /* check results */
gpuTest = _CheckData(cGPU, answer->data, aUnitNum) && gpuTest = _CheckData(cGPU, answer->data, aUnitNum, 1e-4F) &&
_CheckData(cMeGPU, answer->data, aUnitNum) && _CheckData(cMeGPU, answer->data, aUnitNum, 1e-4F) &&
_CheckData(&cUserGPU, answer->data, aUnitNum); _CheckData(&cUserGPU, answer->data, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -67,7 +67,9 @@ bool TestTan1() ...@@ -67,7 +67,9 @@ bool TestTan1()
bUser = Tan(*a); bUser = Tan(*a);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, unitNum, 1e-4F) && _CheckData(aMe, answer, unitNum, 1e-4F) && _CheckData(&bUser, answer, unitNum, 1e-4F); cpuTest = _CheckData(b, answer, unitNum, 1e-4F) &&
_CheckData(aMe, answer, unitNum, 1e-4F) &&
_CheckData(&bUser, answer, unitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -89,7 +91,9 @@ bool TestTan1() ...@@ -89,7 +91,9 @@ bool TestTan1()
bUserGPU = Tan(*aGPU); bUserGPU = Tan(*aGPU);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) && _CheckData(aMeGPU, answer, unitNum, 1e-4F) && _CheckData(&bUserGPU, answer, unitNum, 1e-4F); gpuTest = _CheckData(bGPU, answer, unitNum, 1e-4F) &&
_CheckData(aMeGPU, answer, unitNum, 1e-4F) &&
_CheckData(&bUserGPU, answer, unitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -73,8 +73,8 @@ bool TestTranspose1() ...@@ -73,8 +73,8 @@ bool TestTranspose1()
bUser = Transpose(*a, 0, 1); bUser = Transpose(*a, 0, 1);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) &&
&& _CheckData(&bUser, answer, aUnitNum, 1e-4F); _CheckData(&bUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -93,8 +93,8 @@ bool TestTranspose1() ...@@ -93,8 +93,8 @@ bool TestTranspose1()
bUserGPU = Transpose(*aGPU, 0, 1); bUserGPU = Transpose(*aGPU, 0, 1);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) &&
&& _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F); _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
...@@ -179,8 +179,8 @@ bool TestTranspose2() ...@@ -179,8 +179,8 @@ bool TestTranspose2()
bUser = Transpose(*a, 0, 2); bUser = Transpose(*a, 0, 2);
/* check results */ /* check results */
cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) cpuTest = _CheckData(b, answer, aUnitNum, 1e-4F) &&
&& _CheckData(&bUser, answer, aUnitNum, 1e-4F); _CheckData(&bUser, answer, aUnitNum, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -199,8 +199,8 @@ bool TestTranspose2() ...@@ -199,8 +199,8 @@ bool TestTranspose2()
bUserGPU = Transpose(*aGPU, 0, 2); bUserGPU = Transpose(*aGPU, 0, 2);
/* check results */ /* check results */
gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) gpuTest = _CheckData(bGPU, answer, aUnitNum, 1e-4F) &&
&& _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F); _CheckData(&bUserGPU, answer, aUnitNum, 1e-4F);
/* destroy variables */ /* destroy variables */
delete a; delete a;
......
...@@ -100,8 +100,10 @@ bool TestUnsqueeze1() ...@@ -100,8 +100,10 @@ bool TestUnsqueeze1()
tUser2 = Unsqueeze(*s, 2, 2); tUser2 = Unsqueeze(*s, 2, 2);
/* check results */ /* check results */
cpuTest = _CheckData(t1, answer1, tUnitNum1) && _CheckData(&tUser1, answer1, tUnitNum1) && cpuTest = _CheckData(t1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2) && _CheckData(&tUser2, answer2, tUnitNum2); _CheckData(&tUser1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(t2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUser2, answer2, tUnitNum2, 1e-4F);
#ifdef USE_CUDA #ifdef USE_CUDA
/* GPU test */ /* GPU test */
...@@ -126,8 +128,10 @@ bool TestUnsqueeze1() ...@@ -126,8 +128,10 @@ bool TestUnsqueeze1()
tUserGPU2 = Unsqueeze(*sGPU, 2, 2); tUserGPU2 = Unsqueeze(*sGPU, 2, 2);
/* check results */ /* check results */
gpuTest = _CheckData(tGPU1, answer1, tUnitNum1) && _CheckData(&tUserGPU1, answer1, tUnitNum1) gpuTest = _CheckData(tGPU1, answer1, tUnitNum1, 1e-4F) &&
&& _CheckData(tGPU2, answer2, tUnitNum2) && _CheckData(&tUserGPU2, answer2, tUnitNum2); _CheckData(&tUserGPU1, answer1, tUnitNum1, 1e-4F) &&
_CheckData(tGPU2, answer2, tUnitNum2, 1e-4F) &&
_CheckData(&tUserGPU2, answer2, tUnitNum2, 1e-4F);
/* destroy variables */ /* destroy variables */
delete s; delete s;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论