[Omp] dynamically change the number of threads for OpenMP

DING, Yang dingyang at gmail.com
Sun May 20 11:07:36 PDT 2007


Hi, all,

I have a beginner's question regarding to executing the OpenMP
programs. Is it possible to run an application and dynamically change
the number of threads used for different parallel loops? (i.e. decide
the number of threads to use at runtime, otherwise, I guess function
omp_set_thread_num() satisfies.)

I think it might be easy to do this because the same binary file is
used no matter how many threads are specified. Is it true? If so, how
to do it? Would it work if I simply change the value of the
environment variable "OMP_NUM_THREADS"?

Thank you for your attention. Any suggestions or comments are greatly
appreciated.

Best regards,
Yang


More information about the Omp mailing list