Hello.
I recive some error at this fragment of code:
if((gpuError=cudaMemcpy(was_pulse,gpu_was_pulse,sizeof(unsig
ned),cudaMemcpyDeviceToHost)) != cudaSuccess){
switch(gpuError){
case cudaErrorInvalidValue: fprintf(stderr,“Error at gpu_was_pulse->was_pulse copy, error code is cudaErrorInvalidValue\n”);break;
case cudaErrorInvalidDevicePointer: fprintf(stderr,“Error at gpu_was_pulse->was_pulse copy, error code is cudaErrorInvalidDevicePointer\n”);break;
case cudaErrorInvalidMemcpyDirection: fprintf(stderr,“Error at gpu_was_pulse->was_pulse copy, error code is cudaErrorInvalidMemcpyDirection\n”);break;
default: fprintf(stderr,“Error at gpu_was_pulse->was_pulse copy, error code is UNKNOWN\n”);break;
}
}
was_pulse and gpu_was_pulse both defined as unsigned*
Fragment of code with this statement:
#if 1
{//R:GPU memory check block
unsigned free=0,total=0;
cuMemGetInfo(&free,&total);
fprintf(stderr,“Mainloop before pulse search: Total GPU memory %u\t free GPU memory %u\n”, total,free);
}
#endif
*was_pulse=0;
cudaMemset( gpu_was_pulse,0, sizeof(unsigned) );
GPU_compare_with_threshold_strong(gpupower, dechirped_range_data_length,state.thresh[l],gpu_was_pulse);
#if 1
{//R:GPU memory check block
unsigned free=0,total=0;
cuMemGetInfo(&free,&total);
fprintf(stderr,“Mainloop after pulse search: Total GPU memory %u\t free GPU memory %u\n”, total,free);
}
#endif
if((gpuError=cudaMemcpy(was_pulse,gpu_was_pulse,sizeof(unsig
ned),cudaMemcpyDeviceToHost)) != cudaSuccess){
switch(gpuError){
case cudaErrorInvalidValue: fprintf(stderr,“Error at gpu_was_pulse->was_pulse copy, error code is cudaErrorInvalidValue\n”);break;
case cudaErrorInvalidDevicePointer: fprintf(stderr,“Error at gpu_was_pulse->was_pulse copy, error code is cudaErrorInvalidDevicePointer\n”);break;
case cudaErrorInvalidMemcpyDirection: fprintf(stderr,“Error at gpu_was_pulse->was_pulse copy, error code is cudaErrorInvalidMemcpyDirection\n”);break;
default: fprintf(stderr,“Error at gpu_was_pulse->was_pulse copy, error code is UNKNOWN\n”);break;
}
}
GPU_compare_with_threshold_strong() is:
extern “C” void GPU_compare_with_threshold_strong(float* gpupower, int size,float threshold,unsigned* is_pulse){
dim3 Dg;
dim3 Db;
int new_size=size;
Db.y=1;
Db.z=1;
Dg.y=1;
Dg.z=1;
if(size>>thread_num_pow){
Dg.x=size>>thread_num_pow;
Db.x=1<<thread_num_pow;
strong_compare_kernel<<<Dg,Db>>>(gpupower,threshold,is_pulse);
new_size=size-Dg.x*Db.x;
}
strong_compare_kernel<<<1,new_size>>>(gpupower,threshold,is_pulse);
}
where strong_compare_kernel is:
global void strong_compare_kernel(float* power, float threshold,unsigned* is_pulse){
unsigned int index=blockDim.x*blockIdx.x+threadIdx.x;
if(power[index]>threshold) *is_pulse=1;
}
What is wrong with that copy or with another part of these fragments ?