Skip to content

Commit

Permalink
sync bench with polaris - compression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Lykov committed Oct 1, 2024
1 parent 2069353 commit 64abce7
Show file tree
Hide file tree
Showing 10 changed files with 14,686 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bench/qc_simulation/analysis/Notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Benchmark analysis scripts
## Usage
### Compression tests

1. `compression_scaling_analysis` - print nicely formatted data from each json in glob provided as first argument
2. `Compression_quality.ipynb` - notebook to analyze quality and scaling of compression

## Tracktable maxcut_qaoa instances

M29
`data/preprocess/qaoa_maxcut/

- p=1 N=256
- p=3 N=64
- p=5 N=42
- p=6 N=

With compression:
306 changes: 306 additions & 0 deletions bench/qc_simulation/analysis/Single_contraction_memory_trace.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bench/qc_simulation/analysis/compression_project_repo_link
165 changes: 165 additions & 0 deletions bench/qc_simulation/analysis/run_compression.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"from pathlib import Path\n",
"filename = '../data/circuits/qaoa_maxcut_fixangle/3regfix_N30_p5.jsonterms'\n",
"assert Path(filename).is_file()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Using file ../data/circuits/qaoa_maxcut_fixangle/3regfix_N30_p5.jsonterms. hostname: x3006c0s19b0n0. Python: Python 3.10.9.\n"
]
}
],
"source": [
"!echo \"Using file {filename}. hostname: $(hostname). Python: $(python --version).\""
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"pkgenv = \"PYTHONPATH=/home/danlkv/QTensor:/home/danlkv/QTensor/qtree\""
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2023-11-03 05:58:45.525317: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA\n",
"To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
"/home/danlkv/QTensor/qtensor/compression/szx/src\n",
"\u001b[1mNAME\u001b[0m\n",
" main.py\n",
"\n",
"\u001b[1mSYNOPSIS\u001b[0m\n",
" main.py \u001b[4mCOMMAND\u001b[0m\n",
"\n",
"\u001b[1mCOMMANDS\u001b[0m\n",
" \u001b[1m\u001b[4mCOMMAND\u001b[0m\u001b[0m is one of the following:\n",
"\n",
" echo\n",
" Simple mapper that just echoes stuff\n",
"\n",
" estimate\n",
" Estimate the parameters of a simulator\n",
"\n",
" generate\n",
"\n",
" preprocess\n",
"\n",
" simulate\n",
" Simulate the quantum circuit\n"
]
}
],
"source": [
"!export {pkgenv}; ../main.py"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Preprocess"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [],
"source": [
"in_preprocessed = \"../data/preprocess/compress/qaoa_e/slicesvar/3regfix_N30_p5.jsonterms_Orgreedy_0.02_20_M27\"\n",
"assert Path(preprocess).is_file()\n",
"import sys\n",
"sys.path.append('../')\n",
"sys.path.append('/home/danlkv/QTensor/qtree')\n",
"sys.path.append('/home/danlkv/QTensor')\n",
"from main import Main"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3regfix_N30_p5.jsonterms_Orgreedy_0.02_20_M26\n",
"3regfix_N30_p5.jsonterms_Orgreedy_0.02_20_M27\n",
"3regfix_N30_p5.jsonterms_Orgreedy_0.02_20_M28\n",
"3regfix_N30_p5.jsonterms_Orgreedy_0.02_20_M29\n",
"index.csv\n"
]
}
],
"source": [
"out_dir = \"../data/preprocess/compress/qaoa_e/slicesvar/\"\n",
"!ls {out_dir}"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"zsh:export:1: not valid in this context: {pkgenv}\n"
]
}
],
"source": [
"out_dir = '../data/preprocess/compress/qaoa_e/slicesvar2/3regfix_N30_p5.jsonterms_Orgreedy_0.02_20_M27'\n",
"Main.simulate(in_preprocessed, 'qtensor_energy', M='26,27,28,29', S=1, after_slice='TD-reuse')\n",
"!export {pkgenv}; ./main.py simulate {preprocess} data/preprocess/compress/qaoa_e/slicesvar/\\\\{in_file\\}_O\\{O\\}_M\\{M\\} --O rgreedy_0.02_20 --sim=qtensor_energy --M 26,27,28,29 --S 1 --after_slice=TD-reuse"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 64abce7

Please sign in to comment.