Created
August 30, 2013 20:59
-
-
Save allanmac/6394233 to your computer and use it in GitHub Desktop.
Inspecting the difference between kernel arguments and __constant__ variables.
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
// | |
// | |
// | |
#define KERNEL_QUALIFIERS extern "C" __global__ | |
// | |
// | |
// | |
KERNEL_QUALIFIERS | |
void | |
argKernel(const int* const argIn, int* const argOut) | |
{ | |
argOut[threadIdx.x] = argIn[threadIdx.x]; | |
} | |
// | |
// | |
// | |
__constant__ const int* symIn; | |
__constant__ int* symOut; | |
KERNEL_QUALIFIERS | |
void | |
symKernel() | |
{ | |
symOut[threadIdx.x] = symIn[threadIdx.x]; | |
} | |
// | |
// | |
// | |
typedef struct | |
{ | |
const int* in; | |
int* out; | |
} KernelEnv; | |
KERNEL_QUALIFIERS | |
void | |
envKernel(const KernelEnv kenv) | |
{ | |
kenv.out[threadIdx.x] = kenv.in[threadIdx.x]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Architectures before sm_20 pass kernel parameters via shared:
nvcc -m 32 -arch sm_12 -Xptxas=-v,-abi=no -cubin symarg.cu