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

Add cuQuantum-based TFQ native ops and layers #774

Closed
wants to merge 138 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
bd2b612
broken version of ops
Sinestro38 Mar 29, 2023
d749b05
Add cuquantum_configure()
jaeyoo Mar 30, 2023
1831ec1
Merge branch 'master' into custatevec_support_v4
jaeyoo Mar 30, 2023
9ae4fd0
Add CUQUANTUM_ROOT detection for automatic setup in configure.sh
jaeyoo Mar 30, 2023
eca1f01
Merge pull request #4 from tensorflow/master
jaeyoo Mar 30, 2023
2e29308
Fix errors
jaeyoo Mar 30, 2023
60a2ee9
Merge branch 'master' into custatevec_support_v4
jaeyoo Mar 30, 2023
67b8e81
Split cuda/cuquantum and fix cuquantum_configure error
jaeyoo Mar 30, 2023
dcf189f
modify kernels and add python wrapper file
Sinestro38 Mar 30, 2023
3eae118
linting
Sinestro38 Mar 30, 2023
c5e0235
Add simulate cuquantum ops
jaeyoo Mar 30, 2023
41c1839
Fix lint and format
jaeyoo Mar 30, 2023
7189efc
Fix lint
jaeyoo Mar 30, 2023
8b2ce11
Merge pull request #5 from jaeyoo/custatevec_support_v5
jaeyoo Mar 30, 2023
615a949
merge master
Sinestro38 Mar 31, 2023
e9dfeb4
merge master ops BUILD file
Sinestro38 Mar 31, 2023
80861ae
cuquantum support for gpu ops, need to add CUDA support tho
Sinestro38 Apr 1, 2023
ae9cac5
python support for adj grad cuqantum op (needs to be merged WIP)
Sinestro38 Apr 1, 2023
d830a3b
cuquantum support for circuit executor ops
Sinestro38 Apr 1, 2023
c97fa3a
keras layers cuquantum support
Sinestro38 Apr 1, 2023
6aec6dd
adj grad cuquantum op kernel v0
Sinestro38 Apr 3, 2023
19717bf
update BUILD to master version
Sinestro38 Apr 4, 2023
249e2eb
added build targets and initial tests
Sinestro38 Apr 4, 2023
9b59824
add adj grad cuquantum op to release BUILD
Sinestro38 Apr 4, 2023
bad38a0
uncomment accidentally commented out tests
Sinestro38 Apr 4, 2023
69a61a5
add passing sanity check tests for cuquantm simulate ops
Sinestro38 Apr 4, 2023
68dc4fe
Merge branch 'pavan/add_cuquantum_simulate_tests' into pavan/port_cuq…
Sinestro38 Apr 4, 2023
39ba7c2
modify bazel test target
Sinestro38 Apr 4, 2023
d457e60
add cpu vs gpu benchmark test
Sinestro38 Apr 4, 2023
d92225a
Merge branch 'pavan/port_cuquantum_kernels' into pavan/keras_gpu_support
Sinestro38 Apr 6, 2023
34ad903
lint all
Sinestro38 Apr 6, 2023
b6ba3cc
Merge pull request #6 from jaeyoo/pavan/port_cuquantum_kernels
jaeyoo Apr 6, 2023
50814f6
add adj grad keras layer use_gpu option [left debug statements]
Sinestro38 Apr 11, 2023
40f1ba2
comment out all tests but trivial adj grad op learning with gpu test
Sinestro38 Apr 11, 2023
f2fb9ca
remove the debug print statements
Sinestro38 Apr 13, 2023
5158802
modify the cuquantum dep in adjoint build target to be conditional on…
Sinestro38 Apr 13, 2023
ccd2138
uncomment out the tests
Sinestro38 Apr 14, 2023
44fae73
linting
Sinestro38 Apr 14, 2023
d0410e4
Merge branch 'master' into pavan/keras_gpu_support
Sinestro38 Apr 14, 2023
176f266
Merge pull request #7 from jaeyoo/pavan/keras_gpu_support
jaeyoo Apr 14, 2023
75f8cb3
Fix BUILD error with unloaded bzl rule.
jaeyoo Apr 14, 2023
30756d2
Merge pull request #9 from jaeyoo/fix_build
jaeyoo Apr 14, 2023
eb05692
Rename old _gpu_cpu to _cuquantum
jaeyoo Apr 15, 2023
2ba5a20
cuquantum op should not be called in paralell.
jaeyoo Apr 15, 2023
de033ac
Rename use_gpu to use_cuquantum not to mean cuda.
jaeyoo Apr 15, 2023
b729c60
Fix wrong tfq version (0.7.2 to 0.7.3) and lint use_cuquantum
jaeyoo Apr 16, 2023
f1a09ab
Add circuit_execution_ops_test
jaeyoo Apr 16, 2023
72ca20d
Fix wrong usage of GuardedPhiloxRandom, so fix expectation_test error
jaeyoo Apr 16, 2023
0bdfe15
Merge pull request #10 from jaeyoo/test_device_gpu
jaeyoo Apr 16, 2023
1eff5e6
Update expectation_test.py
Sinestro38 Apr 26, 2023
2b6af67
Fix the quantum_concurrent for expectation layer
jaeyoo Apr 29, 2023
4efdb66
Remove *_cuda ops. support it later.
jaeyoo Apr 29, 2023
3adb3ea
Move cublas/custatevec init/destory handlers to cstr/dstr
jaeyoo Apr 29, 2023
317cd46
Update 4 cuquantum ops
jaeyoo Apr 29, 2023
790fc06
Fix typos
jaeyoo Apr 29, 2023
e135088
Fix typo
jaeyoo Apr 29, 2023
c2220b1
Remove wrongly alive codes
jaeyoo Apr 29, 2023
32e10f6
Change seed type from numbertype to int
jaeyoo Apr 29, 2023
4e7c36f
Apply unsaved changes
jaeyoo Apr 29, 2023
636d2fe
Add seed2
jaeyoo Apr 29, 2023
3783a65
Fix sampled_expectation and samples ops of CPU version.
jaeyoo Apr 29, 2023
3a3d30e
Remove legacy random code
jaeyoo Apr 29, 2023
66fb6f0
Tune the test parameters
jaeyoo Apr 29, 2023
0036ad8
Add more tolerance because it's large number of qubits...
jaeyoo Apr 29, 2023
6e0aeaf
Tune tolerance one more..
jaeyoo Apr 29, 2023
6854980
Fix format
jaeyoo Apr 29, 2023
a7c905f
Fix
jaeyoo Apr 29, 2023
34055d0
Merge pull request #11 from jaeyoo/gpu_context
jaeyoo Apr 29, 2023
feddbfa
Upgrade qsim from jaeyoo's to official 0.16.0
jaeyoo Apr 30, 2023
3fb6fe9
Add automatic linkopt for cuquantum without LD_LIBRARY_PATH
jaeyoo Apr 30, 2023
3e5b565
Fix tensorflow/absl status & error
jaeyoo Apr 30, 2023
ea3ff94
Fix configure.sh for users not to type bazel options manually
jaeyoo Apr 30, 2023
9f03bb1
Fix typo nescessary to necessary
jaeyoo Apr 30, 2023
0d17c1f
Fix the copy&paste error.
jaeyoo Apr 30, 2023
7323c73
Increase the test time for 4 cuquantum ops
jaeyoo Apr 30, 2023
d9243e5
Increase state cpu vs gpu test qubit size to 20 & add logs
jaeyoo Apr 30, 2023
7ce9608
Change simmux.h to simmux_gpu.h for qsim 0.16.0
jaeyoo Apr 30, 2023
9127379
Use cudaMemcpy for fast copy in state op.
jaeyoo Apr 30, 2023
13ac9dc
Merge pull request #12 from jaeyoo/update_qsim_16
Sinestro38 Apr 30, 2023
0683d1c
controlled pqc cuquantum support
Sinestro38 May 1, 2023
1b10b08
Merge pull request #13 from jaeyoo/pavan/control_pqc_gpu
Sinestro38 May 1, 2023
1ff0912
Bump up to qsim 0.16.1
jaeyoo May 1, 2023
f4f0125
Fix cuquantum config bzl rule for uninitialized lib path
jaeyoo May 1, 2023
598c415
Merge pull request #14 from jaeyoo/update_qsim_16
jaeyoo May 2, 2023
f6f00fd
Upgrade cirq version to ~= 1.0
jaeyoo May 3, 2023
6094d2b
Comment out corrupted test.
jaeyoo May 3, 2023
47d7617
Fix parse_context for graceful termination with returning status
jaeyoo May 3, 2023
d81733d
Fix int to size_t to turn off warning messages.
jaeyoo May 3, 2023
8c521bb
Enable cuda config in test all
jaeyoo May 3, 2023
5b85e3c
Fix format and use [[maybe_unused]] because we are in c++17
jaeyoo May 3, 2023
35c2715
Fix format lint and enable expecation test for cpu&gpu
jaeyoo May 3, 2023
2147099
Fix [[maybe_unused]] decorator usage.
jaeyoo May 3, 2023
1e3a13e
Fix if-statements for backend & use_cuquantum for 4 major Keras layers.
jaeyoo May 3, 2023
0b59038
Merge pull request #15 from jaeyoo/upgrade_cirq
jaeyoo May 3, 2023
f293478
Fix ./scripts/test_all.sh for CPU mode to be testable and passed
jaeyoo May 3, 2023
41bde6d
Fix format
jaeyoo May 3, 2023
0a74115
Merge pull request #16 from jaeyoo/both_cpu_gpu_ok
Sinestro38 May 3, 2023
53222df
Fix lint
jaeyoo May 3, 2023
9e30f8d
Fix BulkSetAmpl bug, Add more diff cuquantum unit tests
jaeyoo May 4, 2023
4df7a44
Merge branch 'master' into both_cpu_gpu_ok
jaeyoo May 4, 2023
780061d
Add skipTest() reason
jaeyoo May 4, 2023
5c53f9f
Add random seed for samples & sampled_expectation tests
jaeyoo May 4, 2023
e9e045e
Add GPU availability in 4 major keras layer tests
jaeyoo May 4, 2023
277a56e
Fix format of license / add tests fixed seed random inits
jaeyoo May 4, 2023
5931af0
Fix simple errors
jaeyoo May 4, 2023
9949d25
Merge pull request #17 from jaeyoo/both_cpu_gpu_ok
jaeyoo May 5, 2023
31cd871
Add gpu wheel install path and fix install.md / configs
jaeyoo May 5, 2023
e629877
update configure
Sinestro38 May 7, 2023
2ed029c
Merge pull request #18 from jaeyoo/pavan/update_configure
Sinestro38 May 7, 2023
69e02d6
add benchmark tests
Sinestro38 May 9, 2023
dd5ecfd
comment out cpu vs gpu benchmark assertions in unit tests
Sinestro38 May 9, 2023
5b85c78
remove commented lines
Sinestro38 May 9, 2023
3c787cd
Merge pull request #19 from jaeyoo/pavan/benchmarks
Sinestro38 May 9, 2023
b5b6f05
disable use_cuquantum with cirq backend
Sinestro38 May 11, 2023
0eac7aa
fix breaking typo error
Sinestro38 May 11, 2023
7c13efe
Merge pull request #20 from jaeyoo/pavan/disable_cirq_cuquantum
Sinestro38 May 11, 2023
e3a14d6
include install instructions to set CUQUANTUM_ROOT env var
Sinestro38 May 12, 2023
06062de
all benchmarks passing version
Sinestro38 May 14, 2023
d16aef9
add uncomment toggle
Sinestro38 May 14, 2023
cd9d928
remove seed
Sinestro38 May 14, 2023
ffdc598
Merge pull request #21 from jaeyoo/pavan/benchmark_update
Sinestro38 May 14, 2023
0d2738d
add passing depth benchmark cases
Sinestro38 May 15, 2023
6b845d3
update default cpu config
Sinestro38 May 15, 2023
91ca04b
Merge branch 'master' of https://github.com/jaeyoo/quantum into jaeyo…
QuantumJaeYoo May 21, 2023
2a15f49
Merge pull request #1 from QuantumJaeYoo/jaeyoo_fork
QuantumJaeYoo May 21, 2023
044123d
Fix format
QuantumJaeYoo May 21, 2023
b44d903
Fix format
QuantumJaeYoo May 21, 2023
cf20129
Merge pull request #2 from QuantumJaeYoo/fix_format
QuantumJaeYoo May 21, 2023
0aeacf7
Fix the sampled expectation test error
QuantumJaeYoo May 22, 2023
129970b
Fix ipynb for cirq 1.0
QuantumJaeYoo May 22, 2023
953bda8
Merge pull request #3 from QuantumJaeYoo/fix_format
QuantumJaeYoo May 22, 2023
cf1b876
Fix qcnn.ipynb and update the version to 0.8.0
QuantumJaeYoo May 22, 2023
dbad959
Merge pull request #4 from QuantumJaeYoo/version_up_0.8.0
QuantumJaeYoo May 22, 2023
2ed8101
Fix ReCirq import error and boixo circuit name
QuantumJaeYoo May 24, 2023
56a6d59
Squash the commits
jaeyoo Jun 6, 2023
1ba95ae
Merge branch 'master' into copy_master
jaeyoo Jun 7, 2023
2cb1103
Merge pull request #7 from QuantumJaeYoo/new_copy_master
QuantumJaeYoo Jun 9, 2023
d90aed7
Merge branch 'master' of https://github.com/QuantumJaeYoo/quantum
QuantumJaeYoo Jun 9, 2023
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
33 changes: 5 additions & 28 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,11 @@ cc_library(
],
)

# http_archive(
# name = "qsim",
# sha256 = "b9c1eba09a885a938b5e73dfc2e02f5231cf3b01d899415caa24769346a731d5",
# strip_prefix = "qsim-0.13.3",
# urls = ["https://github.com/quantumlib/qsim/archive/refs/tags/v0.13.3.zip"],
# )

# TODO: After merging this patch later into qsim mainstream, remove this and uncomment the above.
http_archive(
name = "qsim",
sha256 = "",
strip_prefix = "qsim-0.15.0-dev20230327_v3",
urls = ["https://github.com/jaeyoo/qsim/archive/refs/tags/v0.15.0+dev20230327_v3.tar.gz"],
sha256 = "f7f410a07543a51b254f7a5810b5153e196a4c7b4ec89dc8faf86f9c77eec97b",
strip_prefix = "qsim-0.16.1",
urls = ["https://github.com/quantumlib/qsim/archive/refs/tags/v0.16.1.zip"],
)

http_archive(
Expand Down Expand Up @@ -81,21 +73,6 @@ bind(
actual = "@six_archive//:six",
)

new_local_repository(
name = "cuquantum_libs",
path = "/usr/local/google/home/jaeyoo/workspace/cuquantum-linux-x86_64-22.11.0.13-archive",
build_file_content = """
cc_library(
name = "custatevec_headers",
srcs = ["include/custatevec.h"],
visibility = ["//visibility:public"],
)

cc_library(
name = "custatevec",
srcs = ["lib/libcustatevec.so"],
visibility = ["//visibility:public"],
)
""",
)
load("//third_party/cuquantum:cuquantum_configure.bzl", "cuquantum_configure")

cuquantum_configure(name = "local_config_cuquantum")
13 changes: 13 additions & 0 deletions benchmarks/scripts/BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@local_config_cuda//cuda:build_defs.bzl", "if_cuda_is_configured")
package(default_visibility = ["//visibility:public"])

licenses(["notice"])
Expand Down Expand Up @@ -27,6 +28,18 @@ py_test(
],
)

py_test(
name = "benchmark_cuquantum_ops",
srcs = ["benchmark_cuquantum_ops.py"],
python_version = "PY3",
deps = [
"//tensorflow_quantum/core/ops:tfq_simulate_ops_cuquantum_py",
"//tensorflow_quantum/core/ops:tfq_simulate_ops_py",
"//tensorflow_quantum/core/serialize:serializer",
"@local_config_tf//:test_log_pb2",
"//tensorflow_quantum/python:util",
],
)
py_test(
name = "benchmark_op_gradients",
srcs = ["benchmark_op_gradients.py"],
Expand Down
Loading