     }
     
     return error;
-} // bool check_cuda_error()
+} /* bool check_cuda_error() */
 

}


__global__ void kernel_function( int i, int* j ) {
    *j = EXPECTED_KERNEL_RESULT;
}

char const* get_kernel_function() {
    return ((char const*) kernel_function);
}




bool setup_cuda()
{
    int deviceCount = 0;
    cudaGetDeviceCount(&deviceCount); 
    if (deviceCount == 0) { 
        printf( "There is no device.\n" );
        return false;
    } 
    
    int dev = 0;
    for (dev = 0; dev < deviceCount; ++dev) {
        cudaDeviceProp deviceProp;
        cudaGetDeviceProperties(&deviceProp, dev);
        if (deviceProp.major >= 1) {
            break;
        }
    }
    
    if (dev == deviceCount) {
        printf( "There is no device supporting CUDA.\n" );
        return false;
    }
    
    
    cudaSetDevice(dev);
    
    return true;
} // bool setup_cuda()




    cudaMemset( d_jp, 0, sizeof( int ) ); 
    check_cuda_error();
    
    /* Setup CUDA kernel arguments */
    dim3 block_dim( 1 );
    dim3 grid_dim( 1 );
    
    bool const use_native_cuda_kernel_call = false;
    if ( use_native_cuda_kernel_call ) {
        
        /* CUDA native kernel call. */
        kernel_function<<< grid_dim, block_dim >>>( i, d_jp);
        
    } else {
    
        /* CUDA runtime API kernel call. */
        
        cudaConfigureCall( grid_dim, block_dim );
        check_cuda_error();
        
        int offset = 0;
        cudaSetupArgument( i, offset);
        check_cuda_error();	 
        offset += sizeof( i );
    
        cudaSetupArgument( d_jp, offset );
        check_cuda_error();
        offset += sizeof( d_jp );
        
