NVIDIA / NVIDIA/cuda-samples

the TaskListPtr in UnifiedMemoryStreams cannot correctly get the value when USE_PTHREAD

Open
#160 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

if ((TaskList.size() / nthreads) == 0) {
  InputToThreads[i].taskSize = (TaskList.size() / nthreads);
  InputToThreads[i].TaskListPtr =
      &TaskList[i * (TaskList.size() / nthreads)];
} else {
  if (i == nthreads - 1) {
    InputToThreads[i].taskSize =
        (TaskList.size() / nthreads) + (TaskList.size() % nthreads);
    InputToThreads[i].TaskListPtr =
        &TaskList[i * (TaskList.size() / nthreads) +
                  (TaskList.size() % nthreads)];
  } else {
    InputToThreads[i].taskSize = (TaskList.size() / nthreads);
    InputToThreads[i].TaskListPtr =
        &TaskList[i * (TaskList.size() / nthreads)];
  }

should be

if ((TaskList.size() / nthreads) == 0) {
  InputToThreads[i].taskSize = (TaskList.size() / nthreads);
  InputToThreads[i].TaskListPtr =
      &TaskList[i * (TaskList.size() / nthreads)];
} else {
  if (i == nthreads - 1) {
    InputToThreads[i].taskSize =
        (TaskList.size() / nthreads) + (TaskList.size() % nthreads);
    InputToThreads[i].TaskListPtr =
        &TaskList[i * (TaskList.size() / nthreads)];
  } else {
    InputToThreads[i].taskSize = (TaskList.size() / nthreads);
    InputToThreads[i].TaskListPtr =
        &TaskList[i * (TaskList.size() / nthreads)];
  }

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

Search the repository for UnifiedMemoryStreams and TaskListPtr, then inspect the pthread task-partitioning code shown in the issue. Verify the final worker's pointer starts at its assigned slice rather than adding the remainder twice, and confirm the resulting task ranges remain valid.

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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.