Jump to content

Cuda Pointer Problem

RexLee
Go to solution Solved by Unimportant,

you have a function and a parameter to that function with the same name (_gaussian_array). That'll conflict on some level.

__global__ void _gaussian_array(int *_squared_product, const int _cube_size, int *_gaussian_array)
{
	const double sigma = 1.5;
	const double pi = 3.14159;
	const double e = 2.718;
	int idx = threadIdx.x + blockIdx.x * _cube_size;
	_gaussian_array[idx] = (1 / (2 * pi) * pow(e, - _squared_product[idx] / (2 * sigma * sigma)));
}

void _init_gaussian_array(const int *_squared_product, const int _cube_size, int *_gaussian_array)
{
	int *_dev_squared_product;
	int *_dev_gaussian_array;
    cudaMalloc((void**)&_dev_squared_product, sizeof(int) * _cube_size * _cube_size);
	cudaMalloc((void**)&_dev_gaussian_array, sizeof(int) * _cube_size * _cube_size);
	cudaMemcpy(_dev_squared_product, _squared_product, sizeof(int) * _cube_size * _cube_size, cudaMemcpyHostToDevice);
	_gaussian_array <<<_cube_size, _cube_size>>>(_dev_squared_product, _cube_size, _dev_gaussian_array);
}

Error: expression preceding parentheses of apparent call must have (pointer-to-) function type

What am I doing wrong here?

Link to comment
Share on other sites

Link to post
Share on other sites

you have a function and a parameter to that function with the same name (_gaussian_array). That'll conflict on some level.

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks man. That was it. I can't believe I didn't notice it.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×