how to use culaDeviceSgels in C
1 post
• Page 1 of 1
how to use culaDeviceSgels in C
Hi, I'm new in CULA and get some troubles.
1. the matrix is in col major,i want get the x where Ax=B in least square solution.A demension is m×n,so x is n×1 ,B is m×1. The problem is I copy A and B to device and set them in culaDeviceSgels , how I get x. The dimension of B is different from x. I dont know how to copy x to the host.
2.if A and B are both in row-major ,how I call the function?
1. the matrix is in col major,i want get the x where Ax=B in least square solution.A demension is m×n,so x is n×1 ,B is m×1. The problem is I copy A and B to device and set them in culaDeviceSgels , how I get x. The dimension of B is different from x. I dont know how to copy x to the host.
- Code: Select all
//A ,B is given,and m>=n
float* d_A;
float* d_B;
cudaMalloc((void**)&d_A,sizeof(float)*m*n); //allocate device memory for d_A
cudaMalloc((void**)&d_B,m*sizeof(float)); //I allocate device memory for d_B
cudaMemcpy(d_A,A,sizeof(float)*m*n,cudaMemcpyHostToDevice);//copy
cudaMemcpy(d_B,B,sizeof(float)*m,cudaMemcpyHostToDevice);//copy
culaInitialize();
culaDeviceSgels('N',m,n,1,A,m,B,m);
//Then how I copy B and get x??????
cudaFree(d_A);
cudaFree(d_B);
culaShutdown();
2.if A and B are both in row-major ,how I call the function?
- sawyer
- Posts: 1
- Joined: Fri Jan 10, 2014 9:02 am
1 post
• Page 1 of 1
Who is online
Users browsing this forum: Google [Bot] and 4 guests