Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in aer_apply_measure in libaer and enable libaer build in Mac #1860

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,7 @@ else() # Standalone build

install(TARGETS qasm_simulator DESTINATION bin)

# build libaer.so (currently, Linux on x86 is supportted)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(AER_RUNTIME_SOURCE "${PROJECT_SOURCE_DIR}/contrib/runtime/aer_runtime.cpp")
if(CUDA_FOUND AND AER_THRUST_BACKEND STREQUAL "CUDA")
build_cuda(aer ${AER_RUNTIME_SOURCE} FALSE)
Expand Down
4 changes: 2 additions & 2 deletions contrib/runtime/aer_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
#include "controllers/state_controller.hpp"
#include <cmath>
#include <stdio.h>

// initialize and return state
extern "C" {
Expand Down Expand Up @@ -51,8 +52,7 @@ uint_t aer_allocate_qubits(void *handler, uint_t num_qubits) {
// measure qubits
uint_t aer_apply_measure(void *handler, uint_t *qubits_, size_t num_qubits) {
AER::AerState *state = reinterpret_cast<AER::AerState *>(handler);
std::vector<uint_t> qubits;
qubits.insert(qubits.end(), &(qubits_[0]), &(qubits[num_qubits - 1]));
std::vector<uint_t> qubits(qubits_, qubits_ + num_qubits);
return state->apply_measure(qubits);
};

Expand Down
Loading