COMPLEX GETTRI
13 posts
• Page 1 of 1
COMPLEX GETTRI
Hi! In the middle of my program i have to do an inverse of complex matrix so i do the following:
culaInt *ipiv1;
culaGetrf(DIMENSION2, DIMENSION2, mtx_w11cula, DIMENSION2,ipiv1);
culaGetri(DIMENSION2, mtx_w11cula, DIMENSION2, ipiv1);
But this closes the program in MS-DOS (the typical window problem)
mtx_w11cula is this:
-0.0105 -0.0050 0.0016 - 0.0083i 0.0016 + 0.0083i
0.0024 0.0132 0.0029 - 0.0044i 0.0029 + 0.0044i
0.0260 -0.0087 -0.0001 + 0.0082i -0.0001 - 0.0082i
0.0253 0.0019 0.0052 + 0.0046i 0.0052 - 0.0046i
If i put this in matlab and make the inverse i get:
1.0e+002 *
0.2014 0.6879 0.8301 -0.4402
-0.4653 0.5618 -0.0664 -0.1786
0.1017 + 0.5684i -1.0620 + 0.8011i -1.3393 + 0.7536i 1.5199 - 0.6162i
0.1017 - 0.5684i -1.0620 - 0.8011i -1.3393 - 0.7536i 1.5199 + 0.6162i
So, clearly it must be performed in the GPU... I have cuda 4.0 and cula r12...
Where is the problem? Thanks for your help!
culaInt *ipiv1;
culaGetrf(DIMENSION2, DIMENSION2, mtx_w11cula, DIMENSION2,ipiv1);
culaGetri(DIMENSION2, mtx_w11cula, DIMENSION2, ipiv1);
But this closes the program in MS-DOS (the typical window problem)
mtx_w11cula is this:
-0.0105 -0.0050 0.0016 - 0.0083i 0.0016 + 0.0083i
0.0024 0.0132 0.0029 - 0.0044i 0.0029 + 0.0044i
0.0260 -0.0087 -0.0001 + 0.0082i -0.0001 - 0.0082i
0.0253 0.0019 0.0052 + 0.0046i 0.0052 - 0.0046i
If i put this in matlab and make the inverse i get:
1.0e+002 *
0.2014 0.6879 0.8301 -0.4402
-0.4653 0.5618 -0.0664 -0.1786
0.1017 + 0.5684i -1.0620 + 0.8011i -1.3393 + 0.7536i 1.5199 - 0.6162i
0.1017 - 0.5684i -1.0620 - 0.8011i -1.3393 - 0.7536i 1.5199 + 0.6162i
So, clearly it must be performed in the GPU... I have cuda 4.0 and cula r12...
Where is the problem? Thanks for your help!
- apardo
- Posts: 11
- Joined: Tue Jun 21, 2011 10:01 am
Re: COMPLEX GETTRI
A number of things could be going wrong...
Is your data column major? Are you checking culaStatus for errors?
Is your data column major? Are you checking culaStatus for errors?
- kyle
- Administrator
- Posts: 301
- Joined: Fri Jun 12, 2009 7:47 pm
Re: COMPLEX GETTRI
Yes, it is column major order. Now i tried to alocate ipiv because i was not doing it.... it looks like this:
culaDeviceInt* ipiv0;
culaInt *ipiv1;
culaInt *ipiv2;
ipiv0 = (culaDeviceInt*)malloc(DIMENSION2*sizeof(culaDeviceInt));
ipiv1 = (culaInt*)malloc(DIMENSION2*sizeof(culaInt));
ipiv2 = (culaInt*)malloc(DIMENSION1*sizeof(culaInt));
status = culaDeviceSgetrf(DIMENSION2, DIMENSION2, mtx_ainv, DIMENSION2,ipiv0);
status = culaDeviceSgetri(DIMENSION2, mtx_ainv, DIMENSION2, ipiv0);
That is for the first inversion... But now the ipiv0 has, as an output, all zeros...
I think that i am alocating it well but i am not sure why does it happens...
culaDeviceInt* ipiv0;
culaInt *ipiv1;
culaInt *ipiv2;
ipiv0 = (culaDeviceInt*)malloc(DIMENSION2*sizeof(culaDeviceInt));
ipiv1 = (culaInt*)malloc(DIMENSION2*sizeof(culaInt));
ipiv2 = (culaInt*)malloc(DIMENSION1*sizeof(culaInt));
status = culaDeviceSgetrf(DIMENSION2, DIMENSION2, mtx_ainv, DIMENSION2,ipiv0);
status = culaDeviceSgetri(DIMENSION2, mtx_ainv, DIMENSION2, ipiv0);
That is for the first inversion... But now the ipiv0 has, as an output, all zeros...
I think that i am alocating it well but i am not sure why does it happens...
- apardo
- Posts: 11
- Joined: Tue Jun 21, 2011 10:01 am
Re: COMPLEX GETTRI
Device data has to be initialized with cudaMalloc().
Please read the Programmer's Guide documentation for more information; this is covered in detail there.
Please read the Programmer's Guide documentation for more information; this is covered in detail there.
- kyle
- Administrator
- Posts: 301
- Joined: Fri Jun 12, 2009 7:47 pm
Re: COMPLEX GETTRI
Ahhh, thanks. That was my problem... Another question: how do i copy a matrix to, for example, the real part of a complex matrix? All in device memory... Just with cudaMemcpy?
- apardo
- Posts: 11
- Joined: Tue Jun 21, 2011 10:01 am
Re: COMPLEX GETTRI
The complex data is stored as an array of structures (AoS) - the data is interleaved.
- kyle
- Administrator
- Posts: 301
- Joined: Fri Jun 12, 2009 7:47 pm
Re: COMPLEX GETTRI
So... Do i have to copy it manually?
- apardo
- Posts: 11
- Joined: Tue Jun 21, 2011 10:01 am
Re: COMPLEX GETTRI
If it's on the GPU, yes.
- kyle
- Administrator
- Posts: 301
- Joined: Fri Jun 12, 2009 7:47 pm
Re: COMPLEX GETTRI
Ohhh, i was thinking about a function that copies DevicetoDevice with complex... what a pity... Thank you!!!
- apardo
- Posts: 11
- Joined: Tue Jun 21, 2011 10:01 am
Re: COMPLEX GETTRI
I'd recommend reading the CUDA Programmer's Guide (from NVIDIA) if you are going to use the device interface. We assume users who are using this interface (opposed to the normal host interface) are familiar with the CUDA programming model.
- kyle
- Administrator
- Posts: 301
- Joined: Fri Jun 12, 2009 7:47 pm
Re: COMPLEX GETTRI
Ok! I am familiar to CUDA but I had doubts about CULA because there are almost no places to look about it!
- apardo
- Posts: 11
- Joined: Tue Jun 21, 2011 10:01 am
Re: COMPLEX GETTRI
I would recommend reading through our examples folder very carefully. It shows many different usage patterns you can use.
- john
- Administrator
- Posts: 587
- Joined: Thu Jul 23, 2009 2:31 pm
Re: COMPLEX GETTRI
Ok, i'll take your advice. Thanks for your help!!!
- apardo
- Posts: 11
- Joined: Tue Jun 21, 2011 10:01 am
13 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests