How to tell if OpenMP is working?

后端 未结 2 731
温柔的废话
温柔的废话 2021-02-08 04:35

I am trying to run LIBSVM in parallel mode, however my question is in OpenMP in general. According to LIBSVM FAQ, I have modified the code with #pragma calls to use OpenMP. I al

2条回答
  •  执笔经年
    2021-02-08 05:12

    With omp_get_max_threads() you get the maximum number of threads available to your program. It is also the maximum of all possible return values of omp_get_num_threads(). You can explicitly set the number of threads to be used by your program with the environment variable OMP_NUM_THREADS, e.g. in bash via

    $export OMP_NUM_THREADS=8; your_program
    

提交回复
热议问题