Skip to content

Commit 2cf4c09

Browse files
improve dockerfile
1 parent c2c0b47 commit 2cf4c09

File tree

6 files changed

+38
-8
lines changed

6 files changed

+38
-8
lines changed

.dockerignore

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,13 @@
33
**/*idea
44
**/*mypy_cache
55
**/*pytest_cache
6-
**/*develop
6+
**/*develop
7+
**/*dist
8+
**/*build
9+
**/*htmlcov
10+
**/*__pycache__
11+
**/*.pyc
12+
**/*.outdated
13+
**/*.result
14+
**/*.results
15+
**/*.data

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
- type conversion in measure API when high precision is set
1414

15+
- fix bug in to_qiskit with new version qiskit
16+
1517
## 0.0.220509
1618

1719
### Added

docker/Dockerfile

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
FROM nvidia/cuda:11.0.3-cudnn8-runtime-ubuntu18.04
22

3+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/doc/supported-tags.md
4+
5+
RUN apt-key del 7fa2af80
6+
RUN apt-key del 3bf863cc
7+
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
8+
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
9+
10+
# Nvidia is breaking the docker images on Apr 2022 ...
11+
# https://github.com/NVIDIA/nvidia-docker/issues/1631
12+
313
RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y \
414
wget \
515
cuda-command-line-tools-11-0 \
616
git \
7-
vim
17+
vim \
18+
pandoc
819

920
RUN wget -q -P /tmp \
1021
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
@@ -26,8 +37,16 @@ RUN pip install jaxlib==0.3.2+cuda11.cudnn805 -f https://storage.googleapis.com/
2637

2738
RUN pip install -U git+https://github.com/jcmgray/cotengra.git
2839

40+
RUN pip install ray
41+
42+
# requirements conflict for ray
43+
2944
RUN ln -s /usr/local/cuda-11.0/targets/x86_64-linux/lib/libcusolver.so.10 /usr/local/cuda-11.0/targets/x86_64-linux/lib/libcusolver.so.11
3045

46+
RUN echo export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.0/targets/x86_64-linux/lib >> ~/.bashrc \
47+
&& echo export PYTHONPATH=/app >> ~/.bashrc \
48+
&& echo export TF_CPP_MIN_LOG_LEVEL=3 >> ~/.bashrc
49+
3150
COPY . /app
3251

3352
# RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.1/targets/x86_64-linux/lib

examples/bp_benchmark.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
os.environ["TF_FORCE_GPU_ALLOW_GROWTH"] = "true"
77
import time
88
import tensorflow as tf
9-
import tensorflow_quantum as tfq
109
import cirq
1110
import sympy
1211
import numpy as np
12+
import tensorflow_quantum as tfq
1313
import tensorcircuit as tc
1414

1515

requirements-docker.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
numpy
22
scipy
3-
cirq==0.11
3+
cirq
44
tensorflow==2.7
55
tensornetwork==0.4.6
66
graphviz
@@ -23,7 +23,7 @@ quimb
2323
openfermionpyscf
2424
# below is for development
2525
mypy==0.782
26-
pytest==6.2.4
26+
pytest
2727
pytest-cov
2828
pytest-benchmark
2929
pytest-xdist
@@ -34,7 +34,7 @@ sphinx-intl
3434
sphinx-copybutton
3535
nbsphinx
3636
furo
37-
pylint==2.11.1
37+
pylint
3838
ray
3939
pennylane
4040
tensorflow_quantum==0.6.1

tensorcircuit/translation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ def qir2qiskit(qir: List[Dict[str, Any]], n: int) -> Any:
110110
qiskit_circ.unitary(wroot_op, index, label=qis_name)
111111
elif gate_name in ["rx", "ry", "rz", "crx", "cry", "crz"]:
112112
getattr(qiskit_circ, gate_name)(
113-
np.real(backend.numpy(parameters["theta"])), *index
113+
np.real(backend.numpy(parameters["theta"])).item(), *index
114114
)
115115
elif gate_name in ["orx", "ory", "orz"]:
116116
getattr(qiskit_circ, "c" + gate_name[1:])(
117-
np.real(backend.numpy(parameters["theta"])), *index, ctrl_state=0
117+
np.real(backend.numpy(parameters["theta"])).item(), *index, ctrl_state=0
118118
)
119119
elif gate_name in ["exp", "exp1"]:
120120
unitary = backend.numpy(backend.convert_to_tensor(parameters["unitary"]))

0 commit comments

Comments
 (0)