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

Limit the number of parallelism #71

Closed
uncttao opened this issue Oct 1, 2021 · 5 comments
Closed

Limit the number of parallelism #71

uncttao opened this issue Oct 1, 2021 · 5 comments

Comments

@uncttao
Copy link

uncttao commented Oct 1, 2021

Hi, how can I limit the Cilk runtime scheduler to a maximum N number of threads (instead of all available threads)? I need this for benchmark and other purposes. Thanks!

@neboat
Copy link
Collaborator

neboat commented Oct 1, 2021

You can use the CILK_NWORKERS environment variable to set the number of Cilk workers the program uses at runtime. For example, to run the classic Cilk fib(40) on 1 worker:

$ CILK_NWORKERS=1 ./fib 40

Equivalently:

$ export CILK_NWORKERS=1
$ ./fib 40

Let me know if that works for you.

@uncttao
Copy link
Author

uncttao commented Oct 1, 2021

This works. Thank you!

@uncttao uncttao closed this as completed Oct 4, 2021
@vivkumar
Copy link

Can we change the worker count dynamically during the program execution?

@neboat
Copy link
Collaborator

neboat commented Jun 28, 2023

Currently, no. We don't offer an API function to change the number of workers during program execution. Such a function turns out to be dangerous outside of a few specific contexts, and as a result, we have been reluctant to add that functionality without understanding how people want to use it.

What would you want to do with that functionality, @vivkumar?

@vivkumar
Copy link

We wanted to use OpenCilk for evaluating https://ftp.cs.wisc.edu/sohi/papers/2014/PLDI_2014_Adaptive.pdf

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

3 participants