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

Init cooperative wait test for multiple threads #770

Merged
merged 1 commit into from
Sep 14, 2023
Merged

Conversation

lcw
Copy link
Member

@lcw lcw commented Sep 13, 2023

In the cooperative wait test multiple threads are calling MPI functions in a non-serialized way. Thus, MPI needs to be initialized with threadlevel=:multiple.

In the cooperative wait test multiple threads are calling MPI functions
in a non-serialized way. Thus, MPI needs to be initialized with
`threadlevel=:multiple`.
@@ -1,7 +1,7 @@
# tests for the various kinds of waits
include("common.jl")

MPI.Init()
MPI.Init(threadlevel=:multiple)
Copy link
Member

Choose a reason for hiding this comment

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

Isn't that our default?

Copy link
Member Author

@lcw lcw Sep 14, 2023

Choose a reason for hiding this comment

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

Nope, the default is :serialized, see

function Init(;threadlevel=:serialized, finalize_atexit=true, errors_return=true)

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this always the case here or only if one launches Julia with threads > 1 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. I guess it would be only when julia is launched with more than one thread. But Valentin would know better.

Copy link
Member

Choose a reason for hiding this comment

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

We went with :serialized as that is the most common use case, and not all MPI libraries support :multiple by default (or they might incur additional overhead)

Copy link
Contributor

@luraess luraess Sep 15, 2023

Choose a reason for hiding this comment

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

So ideally one should always have

(Threads.nthreads() > 1) ? MPI.Init(threadlevel=:multiple) : MPI.Init()

Copy link
Member

Choose a reason for hiding this comment

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

This doesn't account for interactive threadpool usage, or foreign threads being dynamically added.

maxthreadid is probably okay, but that get's skewed by GC threads and the IO thread.

@lcw lcw merged commit 1f61a64 into master Sep 14, 2023
@vchuravy vchuravy deleted the lcw/fixthreading branch September 14, 2023 23:41
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.

4 participants