I am writing a parallel program using OpenMP in C++.
I want to control the number of threads in the program using omp_set_num_threads(), but it does not
omp_set_num_threads()
The omp_get_num_threads() function returns the number of threads that are currently in the team executing the parallel region from which it is called. You are calling it outside of the parallel region, which is why it returns 1.
omp_get_num_threads()
1