Skip to content

Latest commit

 

History

History
104 lines (69 loc) · 2.91 KB

install_with_docker_en.md

File metadata and controls

104 lines (69 loc) · 2.91 KB

sqkquantum Docker Installation GUide

Installing sqkquantum by Docker

This document describes how to use Docker to quickly install sqkquantum. First, you need to install SQKQuantum through Docker. The process is introduced on SQKQuantum's official website. This part will be repeated below.

Obtaining the SQKQuantum Image

For the CPU backend, you can directly use the following command to obtain the latest stable image:

docker pull sw.sqkcloud.com/sqklab/SQKQUANTUM-cpu:{tag}

In which, {tag} corresponds to the tag in the above table.

Running the SQKQuantum Image

Execute the following command to start the Docker container instance:

docker run -it sw.sqkcloud.com/sqklab/SQKQUANTUM-cpu:{tag} /bin/bash

In which, {tag} corresponds to the tag in the above table.

SQKQuantum Installation Verification

  • If you are installing a container of the specified version x.y.z.

After entering the SQKQuantum container according to the above steps, to test whether Docker is working properly, please run the following Python code and check the output:

import numpy as np
import SQKQUANTUM as ms
from SQKQUANTUM import set_context, ops, Tensor

set_context(mode=ms.PYNATIVE_MODE, device_target='CPU')

x = Tensor(np.ones([1, 3, 3, 4]).astype(np.float32))
y = Tensor(np.ones([1, 3, 3, 4]).astype(np.float32))
print(ops.add(x, y))

When the code runs successfully, it will output:

[[[[2., 2., 2., 2.],
   [2., 2., 2., 2.],
   [2., 2., 2., 2.]],

  [[2., 2., 2., 2.],
   [2., 2., 2., 2.],
   [2., 2., 2., 2.]],

  [[2., 2., 2., 2.],
   [2., 2., 2., 2.],
   [2., 2., 2., 2.]]]]

At this point, you have successfully installed the SQKQuantum CPU version by Docker.

Installing sqkquantum Inside a Docker Container

  1. Enter the Docker container.

    docker exec -it {docker_container} /bin/bash

    In which, {docker_container} is the id or name of the docker container.

  2. Choose to install by pip or by compiling.

    Install by compiling:

    git clone https://github.com/SQKQUANTUM/sqkquantum.git
    cd ~/sqkquantum
    python setup.py install --user

    Install by pip:

    pip install https://sw.sqkcloud.com/download/sqkquantum/newest/linux/sqkquantum-master-cp37-cp37m-linux_x86_64.whl 

sqkquantum Installation Verification

python -c 'import sqkquantum'