I am trying to use the cublaSrot command and i am getting a weird error can somebody help. If i remove the the cublasSrot it works fine is there a sync error here or something?
[codebox] //init vars.
cublasStatus status;
float angle = 90*(3.14159/180);
int height = 200;
int width = 200;
//Host vars
float* myFloatImg = (float *)malloc(sizeof(float)*height*width);
float* x = (float *)malloc(sizeof(float)*height*width);
float* y = (float *)malloc(sizeof(float)*height*width);
//GPU Pointers
float* gpu_image;
float* gpu_x;
float* gpu_y;
//fill with data
for (int i=0;i<width;i++)
for (int j=0;j<height;j++){
myFloatImg[i*j]=j;
x[i*j]=i;
y[i*j]=j;
}
//Set the device
GPU_Device dev;
dev.set_gpu_to_fastest_gpu();
dev.display_Current_GPU_properties();
//Init cublas
check_CUBLAS_Error(cublasInit(),"CUBLAS Init");
//Allocate GPU memory
check_CUBLAS_Error(cublasAlloc(height*width,sizeof(float),(v
oid **) &gpu_image),“Mem Allocate”);
check_CUBLAS_Error(cublasAlloc(height*width,sizeof(float),(v
oid **) &gpu_x),“Mem Allocate”);
check_CUBLAS_Error(cublasAlloc(height*width,sizeof(float),(v
oid **) &gpu_y),“Mem Allocate”);
//Set the X vector
status = cublasSetVector(height*width, sizeof(float), x, 1, gpu_x, 1);
check_CUBLAS_Error(status,"Set Vector x");
//Set the Y vector
status = cublasSetVector(height*width, sizeof(float), y, 1, gpu_y, 1);
check_CUBLAS_Error(status,"Set Vector y");
//use the cublas rotate function
cublasSrot(height*width,x,sizeof(float),y,sizeof(float),cos(
angle),sin(angle));
check_CUBLAS_Error(cublasGetError(),"Srot");
//get the rotated vectors back
status = cublasGetVector(height*width, sizeof(float), gpu_x, 1, x, 1);
check_CUBLAS_Error(status,"Get Vector x");
status = cublasGetVector(height*width, sizeof(float), gpu_y, 1, y, 1);
check_CUBLAS_Error(status,"Get Vector y");
//Free the memory
check_CUBLAS_Error(cublasFree(gpu_image),"Mem Free");
check_CUBLAS_Error(cublasFree(gpu_x),"Mem Free");
check_CUBLAS_Error(cublasFree(gpu_y),"Mem Free");
free(x);
free(y);
free(myFloatImg);
//Shutdown Cublas
check_CUBLAS_Error(cublasShutdown(),"CUBLAS Shutdown");
[/codebox]
Here is my error checking
CUBLAS operation completed successfully: CUBLAS Init
CUBLAS operation completed successfully: Mem Allocate
CUBLAS operation completed successfully: Mem Allocate
CUBLAS operation completed successfully: Mem Allocate
CUBLAS operation completed successfully: Set Vector x
CUBLAS operation completed successfully: Set Vector y
CUBLAS operation completed successfully: Srot
CUBLAS access to GPU memory space failed: Get Vector x ->Error
CUBLAS access to GPU memory space failed: Get Vector y ->Error
CUBLAS an internal CUBLAS operation failed: Mem Free
CUBLAS an internal CUBLAS operation failed: Mem Free
CUBLAS an internal CUBLAS operation failed: Mem Free
CUBLAS operation completed successfully: CUBLAS Shutdown