Created
July 30, 2016 16:26
-
-
Save pierremoreau/b7013872ae0b98cbade1ecd792f466f8 to your computer and use it in GitHub Desktop.
Compiling CUDA kernel which uses `surf2Dwrite()`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Software version:
/opt/cuda