float1 to float conversion
Hello Im using Geforece9800GT on Windows platform. I was trying to use float1 type so that I can align my code. However, Im stuck with this part.
So the following code gives me an error saying.

"error: no suitable conversion function from "float1" to "float" exists.

code:


__global__ void kernel( float1 *b, int1 *c, float1 *sum_spectrum, float1 *resamp, float k_resampledspacing, uchar4 *ptr ){
int x = blockIdx.x*XDIM/2 + threadIdx.x;
int1 i, offset;
float1 data[2*YDIM];
float1 phase, temp, datatemp;

....
phase.x = D1*(y-YDIM/2)*(y-YDIM/2);
data[2*y].x = datatemp.x * __cosf(phase); // this line
data[2*y+1].x = datatemp.x * __sinf(phase); // this line

...
}

Im not sure why the code (this line) should give me that error. Can somebody find the reason? Thank you for helping me.
Hello Im using Geforece9800GT on Windows platform. I was trying to use float1 type so that I can align my code. However, Im stuck with this part.

So the following code gives me an error saying.



"error: no suitable conversion function from "float1" to "float" exists.



code:





__global__ void kernel( float1 *b, int1 *c, float1 *sum_spectrum, float1 *resamp, float k_resampledspacing, uchar4 *ptr ){

int x = blockIdx.x*XDIM/2 + threadIdx.x;

int1 i, offset;

float1 data[2*YDIM];

float1 phase, temp, datatemp;



....

phase.x = D1*(y-YDIM/2)*(y-YDIM/2);

data[2*y].x = datatemp.x * __cosf(phase); // this line

data[2*y+1].x = datatemp.x * __sinf(phase); // this line



...

}



Im not sure why the code (this line) should give me that error. Can somebody find the reason? Thank you for helping me.

#1
Posted 04/27/2012 01:15 AM   
You want to make that [font="Courier New"]__cosf(phase.x)[/font] and [font="Courier New"]__sinf(phase.x)[/font] (or better yet, use [font="Courier New"]__sincosf()[/font]). I don't quite get what advantage you expect from using float1 though.
You want to make that __cosf(phase.x) and __sinf(phase.x) (or better yet, use __sincosf()). I don't quite get what advantage you expect from using float1 though.

Always check return codes of CUDA calls for errors. Do not use __syncthreads() in conditional code unless the condition is guaranteed to evaluate identically for all threads of each block. Run your program under cuda-memcheck to detect stray memory accesses. If your kernel dies for larger problem sizes, it might exceed the runtime limit and trigger the watchdog timer.

#2
Posted 04/27/2012 01:28 AM   
Scroll To Top