첫 번째 오류 :C - 1 차원 배열을 두 개로 매핑 - 왜 작동하지 않습니까?
error: a value of type "float *" cannot be used to initialize an entity of type "float (*)[2000]"
을 Heres 관련 코드 : 내가 나중에 함수에 이중 포인터를 전달하고 참조 할 수 있도록 두 가지 차원으로 정상화를 시도하고
#define opType float
const int N = 2000;
opType *a_h,*b_h,*d_h, *a_d,*b_d, *d_d;
opType (*normalized_a)[N] = a_h;
opType (*normalized_b)[N] = b_h;
opType (*normalized_d)[N] = d_h;
opType (*normalized_a_d)[N] = a_d;
opType (*normalized_b_d)[N] = b_d;
opType (*normalized_d_d)[N] = d_d;
속기 브래킷 구문을 사용하는 두 가지 차원 CUDA를 사용하고 있으므로 메모리를 복사하는 데 일차원 선언이 있어야합니다. 위의 작업을 수행 할 수있는 방법이 있습니까?
이 구조는 배열 초기화에 대한 데이터가 어디에서 오는지 내가 볼 수없는 http://forums.nvidia.com/index.php?showtopic=83941&view=findpost&p=475901
int linear[10*32]; // linear array
int (*twodim)[32] = linear; // interpreted as a two-dimensional [10][32] array.
assert(&twodim[2][4] == &linear[2*32 + 4]); // these are the same
'typedef '를 사용하십시오. – nmichaels
잘 들어, 나는 미래를 염두에 두겠다. –