shfl_scan 's shuffle_integral_image_test has some misleading code.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 9.6k
- Forks
- 2.4k
- Avg merge
- 53m
- Merged PRs (30d)
- 1
Description
The size of d_data and d_integral_image here can be misleading.
int n_elements = w * h;
int sz = sizeof(unsigned int) * n_elements;
checkCudaErrors(cudaMallocHost(reinterpret_cast<void **>(&h_image), sz));
checkCudaErrors(cudaMalloc(reinterpret_cast<void **>(&d_data), sz));
checkCudaErrors(cudaMalloc(reinterpret_cast<void **>(&d_integral_image),
n_elements * sizeof(int) * 4));
checkCudaErrors(cudaMemset(d_data, 1, sz));
checkCudaErrors(cudaMemset(d_integral_image, 0, sz));
d_data 's size is (w * h) *sizeof(char) in this ap, while malloc it with w * h *sizeof(unsigned int).
d_integral_image's size is n_elements * sizeof(int) in this ap.
Current version has a puzzling size.
change it to:
int n_elements = w * h;
int sz = sizeof(unsigned int) * n_elements;
checkCudaErrors(cudaMallocHost(reinterpret_cast<void **>(&h_image), sz));
checkCudaErrors(cudaMalloc(reinterpret_cast<void **>(&d_data), sz / 4));
checkCudaErrors(cudaMalloc(reinterpret_cast<void **>(&d_integral_image),
n_elements * sizeof(int)));
checkCudaErrors(cudaMemset(d_data, 1, sz / 4));
checkCudaErrors(cudaMemset(d_integral_image, 0, sz));
may be better?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open Samples/2_Concepts_and_Techniques/shfl_scan/shfl_scan.cu around lines 329-333 and inspect how d_data and d_integral_image are used after allocation. Compare their allocated and memset sizes with the element types and dimensions in the sample. Done means the allocation and initialization sizes clearly match the buffers' actual data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-vision, hpc
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100