NVIDIA / NVIDIA/cuda-samples

threadFenceReduction can not use 1024 threads per block

Open
#166 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
9.6k
Forks
2.4k
Avg merge
53m
Merged PRs (30d)
1

Description

The Problem

If one tries to execute ./threadFenceReduction --threads=1024, it will exit with a failure without further explanation.

The Solution

The switch statements in threadFenceReduction_kernel.cuh just don't have a case for 1024 which is trivial to fix. With the fix I get significantly better performance by using 1024 threads compared to 512 or less for --n=33554432 both in the single-pass and the multi-pass case.

I have tested both single-pass and-multi-pass for several power-of-2 and random inputs, so there doesn't seem to be an algorithmic reason to limit the number of threads to 512.

One might also want to add a default case to the switches which produces a clear error message.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with threadFenceReduction_kernel.cuh and trace the switch statements used by ./threadFenceReduction for the --threads option. Verify single-pass and multi-pass runs with 1024 threads and the stated large --n value; done means the command no longer fails for 1024 and unsupported values produce a clear error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.