 
 /**
  * Device function
- */__global__ void device_method(int n, float *d_inside, float *d_x, float *d_y) {
+ */__global__ void device_method(float *d_x, float *d_y, int *d_inside, int n) {
 
 	unsigned block_id = blockIdx.y * gridDim.x + blockIdx.x;
 	int thread_id = threadIdx.x + block_id * blockDim.x;

#endif

	// count how many fell inside
	float h_result;
	vector_sum(&h_result, h_inside, n);

	// approximate PI
	float pi = 4.0f * h_result / n;
	printf("pi: %f\n", pi);

	checkCuda(cudaFreeHost(h_x));


	float *d_x = NULL;
	float *d_y = NULL;
	int *d_inside = NULL;
	checkCuda(cudaHostGetDevicePointer(&d_x, h_x, 0));
	checkCuda(cudaHostGetDevicePointer(&d_y, h_y, 0));
	checkCuda(cudaHostGetDevicePointer(&d_inside, h_inside, 0));

	printf("Run computation on GPU\n");
	device_method<<<blocks, threads>>>(d_x, d_y, d_inside, n);

#ifdef DEBUG // For debugging purposes
// Check for CUDA runtime errors
