Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMP: apply split between threads and work units in ITK5 #10

Merged
merged 1 commit into from
Oct 26, 2018

Conversation

dzenanz
Copy link
Member

@dzenanz dzenanz commented Oct 26, 2018

No description provided.

@dzenanz dzenanz requested a review from thewtex October 26, 2018 18:12
Copy link
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💚

@@ -154,7 +154,7 @@ void
LabelSetMorphBaseImageFilter< TInputImage, doDilate, TOutputImage >
::GenerateData(void)
{
ThreadIdType nbthreads = this->GetNumberOfThreads();
ThreadIdType nbthreads = this->GetNumberOfWorkUnits();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also change the variable name: nbthreads.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had noticed it at various points in ITK itself and the remotes as well. Since the name of the variable is not consistent across all of them, this would require a non-negligible amount of work. May be an issue in ITK would help having this in mind. If no objections exist, I'll open the issue tonight, and the desired variable naming can be discussed there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to address it in other places.

To avoid confusion, workUnits or numberOfWorkUnits will be more accurate than a variable that indicates it is the number of threads.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like pieces. It is short, and its use can be inferred from the method names it is used with.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do like pieces also: can remain unchanged when at some point in time multi-threading gets a new refactoring (not in the near future we hope 😁 ).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nbthreads is not an English word, I may suggest something like numberOfThreads (already used in ITK), this would also help keep tool like codespell happy.

To get an idea, here are some stats from ITK master:

$ ack numberOfThreads | wc -l
179
$ ack nbthreads | wc -l
7

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the stats Jean-Christophe: opened in InsightSoftwareConsortium/ITK#86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants