Skip to content

Instantly share code, notes, and snippets.

@pierremoreau
Created July 30, 2016 16:26
Show Gist options
  • Save pierremoreau/b7013872ae0b98cbade1ecd792f466f8 to your computer and use it in GitHub Desktop.
Save pierremoreau/b7013872ae0b98cbade1ecd792f466f8 to your computer and use it in GitHub Desktop.
Compiling CUDA kernel which uses `surf2Dwrite()`
% clang++ --cuda-path=/opt/cuda --cuda-gpu-arch=sm_30 -std=c++14 -I/opt/cuda/include surface.cu -o surf -L/opt/cuda/lib64 -lcudart_static -ldl -lrt -pthread
surface.cu:15:3: error: use of undeclared identifier 'surf2Dwrite'
surf2Dwrite(make_float4(0.0f, 0.0f, 0.0f, 1.0f), result_surface, index.x * sizeof(float4), index.y);
^
1 error generated.
#include <cuda_runtime.h>
//#if !defined(__DEVICE_FUNCTIONS_H__)
//#define __DEVICE_FUNCTIONS_H__
//#include "surface_indirect_functions.h"
//#endif
__global__
void
test_kernel(cudaSurfaceObject_t result_surface)
{
auto const index = make_uint2(blockIdx.x * blockDim.x + threadIdx.x, blockIdx.y * blockIdx.y + threadIdx.y);
if (index.x >= 1920u || index.y >= 1080u)
return;
surf2Dwrite(make_float4(0.0f, 0.0f, 0.0f, 1.0f), result_surface, index.x * sizeof(float4), index.y);
}
int main()
{
return 0;
}
@pierremoreau
Copy link
Author

Software version:

  • CUDA 7.5 (installed in /opt/cuda
  • clang 3.8.0 (as well as HEAD from yesterday 30 July)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment