gpumatrix icon indicating copy to clipboard operation
gpumatrix copied to clipboard

Some other test errors

Open TianBo-Timothy opened this issue 8 years ago • 3 comments

There are some more test errors I noticed:

ArrayOperationTest: ....gpu operation costing time of 2119 while cpu operation costing time of 1765
no error

GPUMatrixData: .........[10=F].
MapOperationTest: .
MatrixAlgebraTest: .......
MatrixVectorAlgebraTest: .73003.6
[2=F]4119.32
[3=F]..5.84723e+09
[6=F]
UnaryOperationTest: ...
VectorAlgebraTest: .

---> group: GPUMatrixData, test: test<10>
     problem: assertion failed

---> group: MatrixVectorAlgebraTest, test: test<2>
     problem: assertion failed

---> group: MatrixVectorAlgebraTest, test: test<3>
     problem: assertion failed

---> group: MatrixVectorAlgebraTest, test: test<6>
     problem: assertion failed

tests summary: failures:4 ok:29

Please have a look.

TianBo-Timothy avatar Dec 25 '17 13:12 TianBo-Timothy

Interesting, all test passed in my environment.

Could you provide any detailed information about the environment?

rudaoshi avatar Jan 07 '18 06:01 rudaoshi

gcc: 5.4.0 nvcc: 9.1 eigen: 3.3.4

Is there anything else related?

TianBo-Timothy avatar Jan 09 '18 13:01 TianBo-Timothy

The problem seems to be related with rowwise().sum() and colwise().sum() as all mentioned tests involve those functionalities and nowhere else in the test rowwise().sum() and colwise().sum() are used.

I added some prints in TestGpuMatrix test<10>, and fixed row = 4, col =2 and noticed the output d_B is incorrect. The test code is as follows:

	void object::test<10>()
	{
		for (int i = 0;i<10;i++)
		{
            int row = 4;
            int col = 2;

            std::cout << "row, col = " << row << ", " << col << std::endl;

			Eigen::MatrixXd h_A = Eigen::MatrixXd::Random(col,row);
			std::cout << "h_A\n" << h_A << "\n\n";

			Matrix<double> d_A(h_A);
			std::cout << "d_A:\n" << (Eigen::MatrixXd)d_A << "\n\n";

			Vector<double> d_B = d_A.rowwise().sum();

			Eigen::VectorXd h_B = h_A.rowwise().sum();

			double error1 = (h_B - (Eigen::VectorXd)d_B).squaredNorm();

            std::cout << "h_B:\n" << h_B << "\n\n";
            std::cout << "d_B:\n" << (Eigen::VectorXd)d_B << "\n\n";
            std::cout << "error: " << error1 << std::endl;

			ensure(error1 < 1e-5);

		}
	}

The output is (the relevant part):

GPUMatrixData: .........row, col = 4, 2
h_A
 0.999374  -0.52722 -0.617201  0.281537
 0.822625  0.923059   0.91492 -0.727981

d_A:
 0.999374  -0.52722 -0.617201  0.281537
 0.822625  0.923059   0.91492 -0.727981

h_B:
0.136491
 1.93262

d_B:
-0.145046
   2.6606

error: 0.609219
[10=F].

Obviously d_B is incorrect.

Help this extra information will help to solve the problem.

BTW, if I set row = 3 then the test passes.

TianBo-Timothy avatar Feb 12 '18 09:02 TianBo-Timothy