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

Functions

__global__ void dummy_kernel ()
 
__global__ void testEigenMatrix1_kernel ()
 
__global__ void testEigenMatrix2_kernel ()
 
__global__ void testEigenMatrix3_kernel ()
 
__global__ void testEigenMatrix4_kernel ()
 
int main ()
 

Variables

__constant__ int size = 6
 
__constant__ int rows = 6
 
__constant__ int cols = 6
 

Function Documentation

◆ dummy_kernel()

__global__ void dummy_kernel ( )
8 {
9 int x = threadIdx.x;
10 return;
11}

◆ main()

int main ( void  )
44 {
45 // Eigen::MatrixXd mat(2,2);
46 // printf("(CPU): Constructed a Eigen::MatrixXd object.\n");
47 // mat.resize(6, 6);
48 // for(int j = 0; j != mat.rows(); ++j)
49 // for(int k = 0; k != mat.cols(); ++k) { printf("\tmat(%d,%d) = %f\n", j, k, mat(j, k)); }
50
51 testEigenMatrix1_kernel<<<1, 1>>>();
52 dummy_kernel<<<1,1>>>();
53 cudaDeviceSynchronize();
54 std::cout << "Passed the point 1\n\n" << std::endl;
55
56 // testEigenMatrix2_kernel<<<1, 1>>>();
57 // dummy_kernel<<<1,1>>>();
58 // cudaDeviceSynchronize();
59 // std::cout << "Passed the point 2\n\n" << std::endl;
60
61 testEigenMatrix3_kernel<<<1, 1>>>();
62 cudaDeviceSynchronize();
63 std::cout << "Passed the point 3\n\n" << std::endl;
64
65 // testEigenMatrix4_kernel<<<1, 1>>>();
66 // dummy_kernel<<<1,1>>>();
67 // cudaDeviceSynchronize();
68 // std::cout << "Passed the point 4\n\n" << std::endl;
69 return EXIT_SUCCESS;
70}

◆ testEigenMatrix1_kernel()

__global__ void testEigenMatrix1_kernel ( )
13 {
14 Eigen::MatrixXd mat(rows, cols);
15 for(int j = 0; j != mat.rows(); ++j)
16 for(int k = 0; k != mat.cols(); ++k) { printf("\tmat(%d,%d) = %f\n", j, k, mat(j, k)); }
17}
__constant__ int cols
Definition testEigenOnGPU.cu:6
__constant__ int rows
Definition testEigenOnGPU.cu:5

◆ testEigenMatrix2_kernel()

__global__ void testEigenMatrix2_kernel ( )
19 {
20 Eigen::MatrixXd mat;
21 mat.resize(rows, cols);
22 for(int j = 0; j != mat.rows(); ++j)
23 for(int k = 0; k != mat.cols(); ++k) { printf("\tmat(%d,%d) = %f\n", j, k, mat(j, k)); }
24 return;
25}

◆ testEigenMatrix3_kernel()

__global__ void testEigenMatrix3_kernel ( )
27 {
28 Eigen::MatrixXd mat(2,2);
29 printf("testEigenMatrix3_kernel: Constructed a Eigen::MatrixXd object.\n");
30 mat.resize(rows, cols);
31 for(int j = 0; j != mat.rows(); ++j)
32 for(int k = 0; k != mat.cols(); ++k) { printf("\tmat(%d,%d) = %f\n", j, k, mat(j, k)); }
33 return;
34}

◆ testEigenMatrix4_kernel()

__global__ void testEigenMatrix4_kernel ( )
36 {
37 Eigen::MatrixXd mat;
38 mat = Eigen::MatrixXd::Ones(rows, cols);
39 for(int j = 0; j != mat.rows(); ++j)
40 for(int k = 0; k != mat.cols(); ++k) { printf("\tmat(%d,%d) = %f\n", j, k, mat(j, k)); }
41 return;
42}

Variable Documentation

◆ cols

__constant__ int cols = 6

◆ rows

__constant__ int rows = 6

◆ size

__constant__ int size = 6