Closed jaeyoo closed 1 year ago
Check out this pull request on
See visual diffs & provide feedback on Jupyter Notebooks.
Powered by ReviewNB
_GLIBCXX_USE_CXX11_ABI=1
. Downstream projects that encounter std::__cxx11
or [abi:cxx11]
linker errors will need to adopt this compiler option. See the GNU C++ Library docs on Dual ABI.-std=c++17
, see install.md for build instructions.0.13.1
to ~=1.0
cirq_google.XMON
was deprecated : https://github.com/quantumlib/Cirq/issues/4856QuantumEngineSampler
was deprecated : https://github.com/quantumlib/Cirq/issues/5371 cirq.CNOT
interface was changed.cirq.SingleQubitGate
was deprecated.cirq.testing.SingleQubitGate
: https://github.com/quantumlib/Cirq/pull/5272/filescirq.Gate
.use_cuquantum=True
at layer instantiation. Examples:tfq.layers.Expectation(use_cuquantum=True)
tfq.layers.SampledExpectation(use_cuquantum=True)
(note that cuQuantum runtime is unsupported for any noisy circuit operationstfq.layers.State(use_cuquantum=True)
tfq.layers.Sample(use_cuquantum=True)
tfq.layers.PQC(model_circuit, operators, use_cuquantum=True)
tfq.layers.ControlledPQC(model_circuit, operators, use_cuquantum=True)
tensorFlow-cpu
from source following the instructions in install.md.configure.sh
script at this step of building. This ensures that you build upon tensorflow-cpu
as tensorflow-gpu
is unnecessary for CuQuantum support in TensorFlow Quantum.CUQUANTUM_ROOT
environment variable is set (referred to in the installation instructions). If not set, bazel will attempt to automatically locate the folder containing the cuQuantum installation upon running configure.sh
at this step.use_cuquantum=True
. This can be done by running: tfq.python.quantum_context.set_quantum_concurrent_op_mode(False)
Source: https://github.com/Sinestro38/quantum/blob/master/tensorflow_quantum/release.md cc: @MichaelBroughton @QuantumJaeYoo
Hi I tried all the above and when ran the tests, these failed:
//tensorflow_quantum/core/ops:tfq_adj_grad_op_cuquantum_test FAILED in 8.9s
/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/testlogs/tensorflow_quantum/core/ops/tfq_adj_grad_op_cuquantum_test/test.log
//tensorflow_quantum/core/ops:tfq_simulate_ops_cuquantum_test FAILED in 7.6s
/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/testlogs/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum_test/test.log
//tensorflow_quantum/python/layers/circuit_executors:sampled_expectation_test FAILED in 59.1s
/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/testlogs/tensorflow_quantum/python/layers/circuit_executors/sampled_expectation_test/test.log
//tensorflow_quantum/python/optimizers:spsa_minimizer_test FAILED in 24.6s
/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/testlogs/tensorflow_quantum/python/optimizers/spsa_minimizer_test/test.log
the output of the second test log being
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //tensorflow_quantum/core/ops:tfq_simulate_ops_cuquantum_test
-----------------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/bin/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum_test.runfiles/__main__/tensorflow_quantum/core/ops/load_module.py", line 42, in load_module
return load_library.load_op_library(path)
File "/home/ubuntu/quantum_nvidia/quantum/quantum_env/lib/python3.8/site-packages/tensorflow/python/framework/load_library.py", line 54, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: libcublas.so.12: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/bin/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum_test.runfiles/__main__/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum_test.py", line 23, in <module>
from tensorflow_quantum.core.ops import tfq_simulate_ops_cuquantum
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/bin/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum_test.runfiles/__main__/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum.py", line 19, in <module>
SIM_OP_MODULE = load_module("_tfq_simulate_ops_cuquantum.so")
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/bin/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum_test.runfiles/__main__/tensorflow_quantum/core/ops/load_module.py", line 46, in load_module
return load_library.load_op_library(path)
File "/home/ubuntu/quantum_nvidia/quantum/quantum_env/lib/python3.8/site-packages/tensorflow/python/framework/load_library.py", line 54, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /home/ubuntu/quantum_nvidia/quantum/quantum_env/lib/python3.8/site-packages/tensorflow_quantum/core/ops/_tfq_simulate_ops_cuquantum.so: cannot open shared object file: No such file or directory
@jccalvojackson
lib
directory of your cuQuantum AND cuBLAS installations to your LD_LIBRARY_PATH
environment variable? For example, after setting CUQUANTUM_ROOT
env var, I would run:
export LD_LIBRARY_PATH=${CUQUANTUM_ROOT}/lib:${LD_LIBRARY_PATH}
docs/install.md
doc of this fork. Specifically this section to enable GPU support: https://github.com/jaeyoo/quantum/blob/master/docs/install.md#7-build-the-tensorflow-quantum-pip-package-for-gpuiI followed those, I didn't get any error during the build instructions.
when running configure I do get the message
cuQuantum library is detected here: CUQUANTUM_ROOT=<my path>
I tried again and see this error in one of the tests
Traceback (most recent call last):
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/bin/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum_test.runfiles/__main__/tensorflow_quantum/core/ops/load_module.py", line 42, in load_module
return load_library.load_op_library(path)
File "/home/ubuntu/quantum_nvidia/quantum/quantum_env/lib/python3.8/site-packages/tensorflow/python/framework/load_library.py", line 54, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: libcublas.so.12: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/bin/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum_test.runfiles/__main__/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum_test.py", line 23, in <module>
from tensorflow_quantum.core.ops import tfq_simulate_ops_cuquantum
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/bin/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum_test.runfiles/__main__/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum.py", line 19, in <module>
SIM_OP_MODULE = load_module("_tfq_simulate_ops_cuquantum.so")
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/3a577e6722a9311ddc77692e6a730328/execroot/__main__/bazel-out/k8-opt/bin/tensorflow_quantum/core/ops/tfq_simulate_ops_cuquantum_test.runfiles/__main__/tensorflow_quantum/core/ops/load_module.py", line 46, in load_module
return load_library.load_op_library(path)
File "/home/ubuntu/quantum_nvidia/quantum/quantum_env/lib/python3.8/site-packages/tensorflow/python/framework/load_library.py", line 54, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: libcublas.so.12: cannot open shared object file: No such file or directory
I see that I have /usr/local/cuda/lib64/libcublas.so.11
but not libcublas.so.12
how do I make it use 11 instead of 12?
when running configure
it says
Please specify the CUDA SDK major version you want to use. [Leave empty to default to CUDA 11]:
which I do
managed to make it work (though is not using gpus significantly) but that's for later. Thank you!
This has large changes and requires some deps error, rewrite documentations, and fixed internal bugs inside random ops, and so forth.
Please look at the PR descriptions in my repo to understand the procedures : https://github.com/jaeyoo/quantum/pulls?q=is%3Apr+is%3Aclosed