StatMech
Loading...
Searching...
No Matches
testEigenMatrixOnGPU.cu File Reference

Functions

__global__ void testEigenMatrix_kernel (int dim)
 
int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)
56 {
57 int const dim = std::atoi(argv[1]);
58 std::cout << "dim = " << dim << std::endl;
59
60 testEigenMatrix_kernel<<<1, 1>>>(dim);
61 cuCHECK(cudaGetLastError());
62 cuCHECK(cudaDeviceSynchronize());
63
64 return EXIT_SUCCESS;
65}
cuCHECK(cudaFuncGetAttributes(&attr, MatrixElementsInSector))

◆ testEigenMatrix_kernel()

__global__ void testEigenMatrix_kernel ( int  dim)
4 {
5 {
6 printf("Entered test point 1\n");
7 Eigen::MatrixXd mat;
8 }
9 printf("Passed test point 1\n");
10
11 {
12 printf("Entered test point 2\n");
13 Eigen::MatrixXd mat;
14 mat.resize(dim, dim);
15 }
16 printf("Passed test point 2\n");
17
18 {
19 printf("Entered test point 3\n");
20 Eigen::MatrixXd mat(dim, dim);
21 }
22 printf("Passed test point 3\n");
23
24 {
25 printf("Entered test point 4\n");
26 Eigen::MatrixXd mat;
27 mat = Eigen::MatrixXd::Ones(dim, dim);
28 for(int j = 0; j != mat.rows(); ++j) {
29 printf("\t");
30 for(int k = 0; k != mat.cols(); ++k) printf("%f ", (double)mat(j, k));
31 printf("\n");
32 }
33 }
34 printf("Passed test point 4\n");
35
36 {
37 printf("Entered test point 5\n");
38 Eigen::MatrixXd mat;
39 mat = Eigen::MatrixXd::Ones(dim, dim);
40 for(int j = 0; j != mat.rows(); ++j) {
41 printf("\t");
42 for(int k = 0; k != mat.cols(); ++k) printf("%f ", (double)mat(j, k));
43 printf("\n");
44 }
45
46 Eigen::MatrixXd mat2(mat);
47 for(int j = 0; j != mat2.rows(); ++j) {
48 printf("\t");
49 for(int k = 0; k != mat2.cols(); ++k) printf("%f ", (double)mat2(j, k));
50 printf("\n");
51 }
52 }
53 printf("Passed test point 5\n");
54}