Skip to content

Commit

Permalink
use omp_set_max_active_levels instead of omp_set_nested (Qiskit#1752
Browse files Browse the repository at this point in the history
)

omp_set_nested was deprecated since OpenMP 3.0 and this commit
replaces it with omp_set_max_active_levels.

* use omp_set_max_active_levels instead of omp_set_nested
* use omp_set_nested in WIN
* Update releasenotes/notes/use_omp_set_max_active_levels-7e6c1d301c4434a6.yaml
* use _OPENMP to select omp_set_max_active_levels or omp_set_nested
---------

Co-authored-by: Jake Lishman <jake@binhbar.com>
  • Loading branch information
hhorii and jakelishman committed Apr 7, 2023
1 parent d4f4be2 commit 4a13ca9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
Aer will now use ``omp_set_max_active_levels()`` instead of the deprecated ``omp_set_nested()`` when compiled against recent versions of OpenMP.
4 changes: 4 additions & 0 deletions src/controllers/aer_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,11 @@ Result Controller::execute(std::vector<Circuit> &circuits,
parallel_nested_ = true;

// nested should be set to zero if num_threads clause will be used
#if _OPENMP >= 200805
omp_set_max_active_levels(0);
#else
omp_set_nested(0);
#endif

result.metadata.add(parallel_nested_, "omp_nested");
} else {
Expand Down

0 comments on commit 4a13ca9

Please sign in to comment.