tensorflow / quantum

Hybrid Quantum-Classical Machine Learning in TensorFlow
https://www.tensorflow.org/quantum
Apache License 2.0
1.77k stars 560 forks source link

Python support for GPU ops [WIP] #759

Closed Sinestro38 closed 1 year ago

Sinestro38 commented 1 year ago

[] Tests still need to be written

jccalvojackson commented 1 year ago

Hi, I get the following error when installing tensorflow_quantum on this container nvcr.io/nvidia/cuquantum-appliance:22.03-cirq from NVIDIA cuQuantum Appliance. (this tag because is the one with cirq 0.13.0).

>>> import tensorflow_quantum as tfq
Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/ops/load_module.py", line 42, in load_module
    return load_library.load_op_library(path)
  File "/opt/conda/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: /opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/ops/_tfq_simulate_ops.so: undefined symbol: _ZNK10tensorflow8OpKernel11TraceStringERKNS_15OpKernelContextEb

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/__init__.py", line 18, in <module>
    from tensorflow_quantum.core import (append_circuit, get_expectation_op,
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/__init__.py", line 17, in <module>
    from tensorflow_quantum.core.ops import (get_expectation_op,
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/ops/__init__.py", line 18, in <module>
    from tensorflow_quantum.core.ops.circuit_execution_ops import (
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/ops/circuit_execution_ops.py", line 20, in <module>
    from tensorflow_quantum.core.ops import (cirq_ops, tfq_simulate_ops,
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/ops/tfq_simulate_ops.py", line 19, in <module>
    SIM_OP_MODULE = load_module("_tfq_simulate_ops.so")
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/ops/load_module.py", line 46, in load_module
    return load_library.load_op_library(path)
  File "/opt/conda/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: /opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/ops/_tfq_simulate_ops.so: undefined symbol: _ZNK10tensorflow8OpKernel11TraceStringERKNS_15OpKernelContextEb
jccalvojackson commented 1 year ago

The above was using tensorflow 2.11.0. Using 2.7.0 as mentioned in #714 it goes away

jccalvojackson commented 1 year ago

after removing the import error I get the same error as in #766 when trying to run QRL with any qsimcirq backend on a Nvidia cuquantum appliance container

QuantumJaeYoo commented 1 year ago

@jccalvojackson Could you please give me your instructions to reproduce the result on your Nvidia cuquantum appliance container?

jccalvojackson commented 1 year ago

@QuantumJaeYoo the instructions are the same as those in the description of #766