Skip to content

Commit

Permalink
Fix setting MPI processes and ranks (#1808)
Browse files Browse the repository at this point in the history
0.12.0 accidentally removed MPI support if application does not use qobj. This commit reverts the change.
  • Loading branch information
doichanj authored May 10, 2023
1 parent da1623e commit d23210d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions releasenotes/notes/fix_mpi_procs-68b76c11fe7a6b8e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
MPI parallelization was not enabled since we have not used qobj.
This fix sets the number of processes and MPI rank correctly.
9 changes: 4 additions & 5 deletions src/controllers/aer_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,11 +852,6 @@ Transpile::CacheBlocking Controller::transpile_cache_blocking(
//-------------------------------------------------------------------------
template <typename inputdata_t>
Result Controller::execute(const inputdata_t &input_qobj) {
#ifdef AER_MPI
MPI_Comm_size(MPI_COMM_WORLD, &num_processes_);
MPI_Comm_rank(MPI_COMM_WORLD, &myrank_);
#endif

// Load QOBJ in a try block so we can catch parsing errors and still return
// a valid JSON output containing the error message.
try {
Expand Down Expand Up @@ -908,6 +903,10 @@ Result Controller::execute(std::vector<Circuit> &circuits,
// Start QOBJ timer
auto timer_start = myclock_t::now();

#ifdef AER_MPI
MPI_Comm_size(MPI_COMM_WORLD, &num_processes_);
MPI_Comm_rank(MPI_COMM_WORLD, &myrank_);
#endif
// Determine simulation method for each circuit
// and enable required noise sampling methods
auto methods = simulation_methods(circuits, noise_model);
Expand Down

0 comments on commit d23210d

Please sign in to comment.