Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ORNL Quantum Computing Institute
xacc
Commits
bdab0f7b
Commit
bdab0f7b
authored
May 28, 2021
by
Nguyen, Thien Minh
Browse files
Merge branch 'master' into tnguyen/qalloc-experiment
parents
d0c35ef5
cf45e3c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
bdab0f7b
...
...
@@ -22,17 +22,6 @@ docker build_master:
-
git config remote.aideqc.url >&- || git remote add -t master aideqc https://amccaskey:$AIDEQC_ACCESS_TOKEN@github.com/aide-qc/xacc
-
git push -f aideqc HEAD:master
-
git remote remove aideqc
# - git clone https://github.com/aide-qc/homebrew-deploy && cd homebrew-deploy
# - git clone --depth=1 --recursive https://github.com/eclipse/xacc
# - tar -czvf xacc-1.0.0.tar.gz xacc
# - jfrog bt u --override --publish xacc-1.0.0.tar.gz amccaskey/qci-homebrew-bintray/xacc-source/xacc-1.0.0
# - export src_sha=$(sha256sum xacc-1.0.0.tar.gz | cut -d " " -f 1)
# - sed -i "0,/sha256 \".*\"/s//sha256 \"$src_sha\" /" Formula/xacc.rb
# - git add Formula/xacc.rb
# - git commit -m "updating sha256 for xacc homebrew formula"
# - git config remote.aideqchbdeploy.url >&- || git remote add -t master aideqchbdeploy https://amccaskey:$AIDEQC_ACCESS_TOKEN@github.com/aide-qc/homebrew-deploy
# - git push -f aideqchbdeploy HEAD:master
# - git remote remove aideqchbdeploy
docker run_docker_deploy
:
stage
:
deploy
...
...
@@ -42,3 +31,5 @@ docker run_docker_deploy:
-
cd docker/deploy/dev && docker build -t xacc/xacc . --no-cache
-
echo "$REGISTRY_PASSWORD" | docker login -u xacc --password-stdin
-
docker push xacc/xacc
allow_failure
:
true
docker/deploy/base/Dockerfile
View file @
bdab0f7b
FROM
ubuntu:18.04
ENV
DEBIAN_FRONTEND noninteractive
ARG
GITHUB_TOKEN
ARG
NODE_VERSION=10.1
6
.0
ARG
NODE_VERSION=10.1
7
.0
ENV
NODE_VERSION $NODE_VERSION
ENV
YARN_VERSION 1.13.0
...
...
@@ -114,25 +114,4 @@ RUN apt-get update && \
gdb && \
ln -s /usr/bin/clangd-12 /usr/bin/clangd && \
ln -s /usr/bin/clang-tidy-12 /usr/bin/clang-tidy && \
rm -rf /var/lib/apt/lists/*
#&& cd /home/dev && git clone --recursive https://github.com/eclipse/xacc && cd xacc && mkdir build && cd build \
#&& cmake .. -DXACC_BUILD_TESTS=TRUE -DXACC_BUILD_EXAMPLES=TRUE \
#&& make -j18 install \
#&& cd ../../ && git clone https://github.com/ornl-qci/tnqvm && cd tnqvm && mkdir build && cd build \
#&& cmake .. -DXACC_DIR=~/.xacc && make -j18 install \
# Theia application
#ADD $version.package.json ./package.json
#RUN yarn --cache-folder ./ycache && rm -rf ./ycache && \
# NODE_OPTIONS="--max_old_space_size=4096" yarn theia build ;\
# yarn theia download:plugins
#EXPOSE 3000
#ENV SHELL=/bin/bash \
# THEIA_DEFAULT_PLUGINS=local-dir:/home/dev/plugins
#ENV PYTHONPATH "${PYTHONPATH}:/root/.xacc"
#ENTRYPOINT [ "yarn", "theia", "start", "/home/dev", "--hostname=0.0.0.0" ]
rm -rf /var/lib/apt/lists/*
\ No newline at end of file
quantum/plugins/algorithms/vqe/vqe.cpp
View file @
bdab0f7b
...
...
@@ -96,9 +96,12 @@ void VQE::execute(const std::shared_ptr<AcceleratorBuffer> buffer) const {
"valid Optimizer."
);
}
std
::
vector
<
std
::
shared_ptr
<
AcceleratorBuffer
>>
min_child_buffers
;
// auto kernels = observable->observe(xacc::as_shared_ptr(kernel));
// Cache of energy values during iterations.
std
::
vector
<
double
>
energies
;
double
last_energy
=
std
::
numeric_limits
<
double
>::
max
();
// Here we just need to make a lambda kernel
// to optimize that makes calls to the targeted QPU.
...
...
@@ -264,6 +267,16 @@ void VQE::execute(const std::shared_ptr<AcceleratorBuffer> buffer) const {
xacc
::
info
(
ss
.
str
());
// Saves the energy value.
energies
.
emplace_back
(
energy
);
if
(
energy
<
last_energy
)
{
min_child_buffers
.
clear
();
min_child_buffers
.
push_back
(
idBuffer
);
for
(
auto
b
:
buffers
)
{
min_child_buffers
.
push_back
(
b
);
}
last_energy
=
energy
;
}
return
energy
;
},
kernel
->
nVariables
());
...
...
@@ -271,11 +284,9 @@ void VQE::execute(const std::shared_ptr<AcceleratorBuffer> buffer) const {
auto
result
=
optimizer
->
optimize
(
f
);
// Get the children at the opt-params
auto
children_at_final_parameters
=
buffer
->
getChildren
(
"parameters"
,
result
.
second
);
std
::
vector
<
double
>
opt_exp_vals
,
children_coeffs
;
std
::
vector
<
std
::
string
>
children_names
;
for
(
auto
&
child
:
child
ren_at_final_paramet
ers
)
{
for
(
auto
&
child
:
min_
child
_buff
ers
)
{
if
(
!
child
->
hasExtraInfoKey
(
"is-gradient-calc"
))
{
opt_exp_vals
.
push_back
(
child
->
getInformation
(
"exp-val-z"
).
as
<
double
>
());
...
...
@@ -283,7 +294,7 @@ void VQE::execute(const std::shared_ptr<AcceleratorBuffer> buffer) const {
children_coeffs
.
push_back
(
child
->
getInformation
(
"coefficient"
).
as
<
double
>
());
children_names
.
push_back
(
child
->
name
());
}
}
}
buffer
->
addExtraInfo
(
"opt-exp-vals"
,
opt_exp_vals
);
...
...
quantum/plugins/ibm/accelerator/IBMAccelerator.cpp
View file @
bdab0f7b
...
...
@@ -99,7 +99,15 @@ std::vector<xacc::ibm_pulse::Instruction> alignMeasurePulseInstructions(
if
(
!
acquiredBits
.
empty
())
{
auto
mergedAcquire
=
acquireInsts
.
front
();
mergedAcquire
.
set_qubits
(
acquiredBits
);
mergedAcquire
.
set_memory_slot
(
acquiredBits
);
// Use the same logic as QASM-based measurements:
// i.e. use memory slots from 0 onward.
// This is important for the AcceleratorBuffer to summarize the bit count
// later.
// e.g. when only measure qubit 1 (acquire pulse), we need to map the result
// to memory slot 0, not 1.
std
::
vector
<
int64_t
>
memory_slots
(
acquiredBits
.
size
());
std
::
iota
(
std
::
begin
(
memory_slots
),
std
::
end
(
memory_slots
),
0
);
mergedAcquire
.
set_memory_slot
(
memory_slots
);
result
.
emplace_back
(
mergedAcquire
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment