1
추력이 관리 메모리를 사용하지 않는 경우에도 동일한 CUDA 6 애플리케이션 추력에서 cudaMallocManaged() 및 추력을 사용할 때 문제가 발생하는 문제가 있습니다. 단순히 사용하지 않는 관리 변수를 사용하면 추력이 실패하는 것만으로도 충분합니다.CUDA 6 관리 메모리의 추력 문제
#include "thrust/device_ptr.h"
#include "thrust/sort.h"
__global__ void calculate_hash(uint *hash_values, uint *particle_ids, int length)
{
int i = blockIdx.x*blockDim.x + threadIdx.x;
if(i >= length)
return;
hash_values[i] = 1;
particle_ids[i] = i;
}
void hash_particles_gpu(uint *d_hash_values, uint *d_particle_ids, int length)
{
int block_size = 256;
int num_blocks = ceil(length/(float)block_size);
calculate_hash<<<num_blocks, block_size>>>(d_hash_values, d_particle_ids, length);
cudaDeviceSynchronize();
thrust::device_ptr<uint> keys(d_hash_values);
thrust::device_ptr<uint> values(d_particle_ids);
thrust::sort_by_key(keys, keys+length, values);
}
int main(int argc, char *argv[])
{
int length = 15;
int bytes;
#ifdef BROKE
int *m_int;
cudaMallocManaged((void**)&m_int, sizeof(int));
#endif
// Allocate uint hash value array
bytes = length*sizeof(unsigned int);
unsigned int * hash_values;
cudaMalloc((void**)&hash_values, bytes);
// Allocate uint particle ID array
bytes = length*sizeof(unsigned int);
unsigned int *particle_ids;
cudaMalloc((void**)&particle_ids, bytes);
hash_particles_gpu(hash_values, particle_ids, length);
}
내가 컴파일하고 실행하면 : 내가 만들 확인했다
$ nvcc -DBROKE -DTHRUST_DEBUG example.cu -o broke.exe
$ nvcc -DTHRUST_DEBUG example.cu -o fixed.exe
$ ./fixed.exe
$ ./broke.exe
terminate called after throwing an instance of 'thrust::system::system_error'
what(): synchronize: RakingReduction: unknown error
Abort
확인 내가 어떤이없는 내가 CUDA 6.0을 실행하는 NVIDIA 젝슨 TK1에서 테스트하고 다음 재생 장치를 만들었습니다 이 시점까지 오류가 발생하고 sort_by_key를 호출 할 때까지 모든 것이 잘된 것처럼 보입니다. 무슨 일이 일어나고 있는지 아십니까?
'cudaMallocManaged' 호출에 대해 올바른 cuda 오류 검사를 수행하면 어떻게됩니까? 어떤 API 오류가보고 되었습니까? Jetson 플랫폼에서 어떤 운영 체제를 실행하고 있습니까? –
모든 cuda 기능 및 커널 시작을 점검했으며 sort_by_key까지 오류를 반환하지 않습니다. TK1은 Tegra 용 기본 Linux (L4T)를 실행 중입니다. 별도로 추력 및 관리되는 메모리가 올바르게 작동하는 것 같습니다. –
아마도 CUDA 6.5RC를 사용하여 동작이 다른지 확인할 수 있습니다. 그 외에는 아이디어가 없지만 NVIDIA에 버그를 제기 할 것을 제안 할 수 있습니다. –