Closed mpiku closed 3 years ago
Dependency on omp_get_num_procs() might be a problem when a user force the OpenMP to create more threads than CPUs available https://www.openmp.org/spec-html/5.0/openmpsu114.html.
omp_get_num_procs()
I guess the following function might be usefull (after lurking SO): https://www.openmp.org/spec-html/5.0/openmpsu112.html#x149-6510003.2.3
https://github.com/egi-megi/rojCzastek_Szczepanski_Jurkiewicz_Pikulinski/blob/83e6a109c0b1c8cecd8bcf53c0e89a6207918eb8/src/Swarm.cpp#L50
https://github.com/egi-megi/rojCzastek_Szczepanski_Jurkiewicz_Pikulinski/blob/83e6a109c0b1c8cecd8bcf53c0e89a6207918eb8/src/Swarm.cpp#L105
Solution is working now with any given number of threads. Threads number might be changed with, e.g. OMP_NUM_THREADS environment variable or omp_set_num_threads(int) routine.
OMP_NUM_THREADS
omp_set_num_threads(int)
https://www.openmp.org/spec-html/5.0/openmpse50.html
Dependency on
omp_get_num_procs()
might be a problem when a user force the OpenMP to create more threads than CPUs available https://www.openmp.org/spec-html/5.0/openmpsu114.html.I guess the following function might be usefull (after lurking SO): https://www.openmp.org/spec-html/5.0/openmpsu112.html#x149-6510003.2.3
https://github.com/egi-megi/rojCzastek_Szczepanski_Jurkiewicz_Pikulinski/blob/83e6a109c0b1c8cecd8bcf53c0e89a6207918eb8/src/Swarm.cpp#L50
https://github.com/egi-megi/rojCzastek_Szczepanski_Jurkiewicz_Pikulinski/blob/83e6a109c0b1c8cecd8bcf53c0e89a6207918eb8/src/Swarm.cpp#L105