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
qcor
Commits
2303e53d
Commit
2303e53d
authored
Sep 22, 2021
by
Nguyen, Thien Minh
Browse files
Added adder circuit example for dm-sim and random circuit for TNQVM
Signed-off-by:
Thien Nguyen
<
nguyentm@ornl.gov
>
parent
2a74ae2c
Changes
4
Hide whitespace changes
Inline
Side-by-side
examples/qcor_demos/ibm_qasm3_demo_092021/qasm3-gpu-sim/adder_dm_sim.qasm
0 → 100644
View file @
2303e53d
/*
* quantum ripple-carry adder
* Cuccaro et al, quant-ph/0410184
*/
// Install DM-SIM plugin:
// qcor -install-plugin https://github.com/ORNL-QCI/DM-Sim.git
// Using DM-Sim:
// qcor -linker g++ -qrt nisq adder.qasm -shots 1024 -qpu dm-sim[gpus:1]
// Note: on a login node, GPU-GPU comm is disabled, hence can only run with 1 GPU.
// Multi-GPU on compute node: e.g, see the bsub example:
OPENQASM 3;
gate ccx a,b,c
{
h c;
cx b,c; tdg c;
cx a,c; t c;
cx b,c; tdg c;
cx a,c; t b; t c; h c;
cx a,b; t a; tdg b;
cx a,b;
}
gate majority a, b, c {
cx c, b;
cx c, a;
ccx a, b, c;
}
gate unmaj a, b, c {
ccx a, b, c;
cx c, a;
cx a, b;
}
qubit cin;
qubit a[4];
qubit b[4];
qubit cout;
bit ans[5];
// Input values:
uint[4] a_in = 1;
uint[4] b_in = 15;
for i in [0:4] {
if (bool(a_in[i])) {
x a[i];
}
if (bool(b_in[i])) {
x b[i];
}
}
// add a to b, storing result in b
majority cin, b[0], a[0];
for i in [0: 3] {
majority a[i], b[i + 1], a[i + 1];
}
cx a[3], cout;
for i in [2: -1: -1] {
unmaj a[i], b[i+1], a[i+1];
}
unmaj cin, b[0], a[0];
measure b[0:3] -> ans[0:3];
measure cout[0] -> ans[4];
\ No newline at end of file
examples/qcor_demos/ibm_qasm3_demo_092021/qasm3-gpu-sim/random_circuit.qasm
0 → 100644
View file @
2303e53d
OPENQASM 3;
include "stdgates.inc";
const n_qubits = 50;
const n_layers = 12;
qubit q[n_qubits];
// Compile: qcor random_circuit.qasm
// Run by: mpiexec -n <N> ./a.out -qrt nisq -qpu tnqvm -qpu-config tnqvm.ini
// Loop over layers
float[64] theta = 1.234;
for i in [0:n_layers] {
// Single qubit layers:
for j in [0:n_qubits] {
rx(theta) q[j];
}
// For demonstration purposes, just change the
// angle in each layer by adding 1.0.
theta += 1.0;
// Entanglement layers:
for j in [0:n_qubits - 1] {
cx q[j], q[j+1];
}
}
examples/qcor_demos/ibm_qasm3_demo_092021/qasm3-gpu-sim/summit_job.lsf
0 → 100644
View file @
2303e53d
#!/bin/bash
#BSUB -P <PROJECT_ID>
#BSUB -W 1
#BSUB -nnodes 1
#BSUB -o out_cc.txt -e err_cc.txt
module load python/3.8.10 gcc/9.3.0 cuda/11.4.0 openblas/0.3.15-omp
## "--smpiargs=-gpu" is for enabling GPU-Direct RDMA
## 4 GPUs
jsrun
-n4
-a1
-g1
-c1
--smpiargs
=
"-gpu"
./a.out
\ No newline at end of file
examples/qcor_demos/ibm_qasm3_demo_092021/qasm3-gpu-sim/tnqvm.ini
0 → 100644
View file @
2303e53d
tnqvm-visitor
=
exatn:float
exatn-buffer-size-gb
=
2
bitstring
=
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
\ No newline at end of file
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