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

CPU Multithreading Question #67

Closed
ali-vaziri opened this issue Oct 4, 2023 · 1 comment
Closed

CPU Multithreading Question #67

ali-vaziri opened this issue Oct 4, 2023 · 1 comment

Comments

@ali-vaziri
Copy link

Hi,

If one runs the example provided here for CPU, only one thread per rank will be used (?). This is based on my observation, and setting 'JULIA_NUM_THREADS=n' or using 'julia --threads n' did not change it. If that's the case, would the solution for using multiple MPI ranks and multithreading within each rank involve combining ParallelStencil and ImplicitGlobalGrid, as demonstrated in the example here?

Thanks!

@luraess
Copy link
Collaborator

luraess commented Oct 5, 2023

Hi @ali-vaziri, thanks for reaching out. Note that usage questions (as this one, compared to issues) should rather be posted on Julia Discourse.

The example you are flagging indeed would use only a single thread per MPI rank. Changing the numbers of threads to run Julia with will most likely not have any impact since the vectorised code used here cannot leverage multi-threading as such. To enable multi-threading per MPI rank, you'd need to write the vectorised statement (using broadcasting here) as compute functions (or kernels) in a loop fashion where you then could decorate the outer loop with Threads.@threads to enable multi-threading. This could be achieved on a higher-level approach by using e.g. ParallelStencil.

I am closing this for now, but feel free to post on Discourse.

@luraess luraess closed this as completed Oct 5, 2023
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

No branches or pull requests

2 participants