diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..465b1b6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +data/* +Dockerfile \ No newline at end of file diff --git a/DOCKER.md b/DOCKER.md new file mode 100644 index 0000000..b794389 --- /dev/null +++ b/DOCKER.md @@ -0,0 +1,43 @@ + +## Docker Setup + +We also provide a Dockerfile to run MorphQ in a Docker container. + +1. To build the Docker image, run the following command: +```bash +docker build -t morphq . +``` + +1. To run the Docker container, run the following command: +```bash +docker run -it --rm -p 8888:8888 morphq +``` + + +### LEVEL 1: Reproduce the Paper Figures + +1. To run the run the notebook in the Docker container, run the following command: +```bash +jupyter notebook --allow-root --no-browser --ip=0.0.0.0 --port=8888 +``` +1. Then open the link that is printed in the terminal in your browser. Note that the link will look something like this: `http://127.0.0.1:8888/?token=6819f647f19859d9e92013a41f52f49d6ffed633e7b68657`. +1. Open the `notebooks/RQs_Reproduce_Analysis_Results_Level_1.ipynb` notebook. +1. Run the notebook top-to-bottom. +1. Congratulations! You reproduced all the paper figures based on our experimental data. + + +### LEVEL 2: Run MorphQ For a New Testing Campaign + +1. Generate a new configuration file with the following command: + ```bash + python3 -m lib.generate_new_config --version 01 + ``` +1. Select `morphq_demo.yaml` as the base configuration file. +1. Run the following command to run MorphQ with the new configuration: + ```bash + python3 -m lib.qmt config/qmt_v01.yaml + ``` +1. Congratulations! You successfully run MorphQ. + +Note that your newly generated data will be transient in this Docker, thus if you are interested in accessing them you either need to mount a volume or copy the data folder with `docker cp`. + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9016941 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,75 @@ +FROM ubuntu:22.04 + +WORKDIR /root/ + +# Install OS dependencies +# Many of these are for blender, where we got the full list from: +# https://wiki.blender.org/wiki/Building_Blender/Linux/Ubuntu +RUN apt-get update && \ + apt-get install -y \ + wget \ + xz-utils \ + build-essential \ + git subversion \ + cmake \ + libx11-dev \ + libxxf86vm-dev \ + libxcursor-dev \ + libxi-dev \ + libxrandr-dev \ + libxinerama-dev \ + libegl-dev && \ + apt-get clean + + + +# Download and install Anaconda +RUN wget https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh -O Anaconda3-2022.10-Linux-x86_64.sh +RUN bash Anaconda3-2022.10-Linux-x86_64.sh -b +RUN rm Anaconda3-2022.10-Linux-x86_64.sh + +ENV PATH=/root/anaconda3/bin:$PATH + +# Install unzip +RUN apt-get install unzip + +# Move to the opt directory +WORKDIR /opt/ + +# Download the environment.yml file +RUN wget https://raw.githubusercontent.com/sola-st/MorphQ-Quantum-Qiskit-Testing-ICSE-23/main/environment.yml + +# Install Python dependencies +RUN conda env create -f environment.yml + +# Initialize the bash +RUN conda init bash + +# Create data directory +RUN mkdir data + +# Download Data +RUN wget -O data/figshare_data --no-check-certificate https://ndownloader.figshare.com/files/38923367/2 + +# Unzip Data +RUN unzip data/figshare_data -d data/ +RUN mv data/morphq_evaluation_compressed/qmt_v52 data/qmt_v52 +RUN mv data/morphq_evaluation_compressed/qmt_v53 data/qmt_v53 + + +# Initialize the sh +RUN conda init bash +# activate MorphQ environment +RUN /bin/bash -c conda activate MorphQ + +# Copy MorphQ files +COPY . /opt/ + +SHELL ["/bin/bash","-c"] +RUN conda init +RUN echo 'conda activate MorphQ' >> ~/.bashrc + +# Run the container and open jupyter notebook +EXPOSE 8888 +# start bash +CMD ["/bin/bash"] \ No newline at end of file diff --git a/README.md b/README.md index 5b9926d..f9d744d 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ You can run MorphQ with two objectives: 1. Check that your setup meets the [REQUIREMENTS.md](REQUIREMENTS.md). 2. Follow the installation instructions in [INSTALL.md](INSTALL.md). +Note: if you are more familiar with docker or you are having trouble with the installation on your system, you can also build a docker image based on Ubuntu. +We provide a [Dockerfile](Dockerfile) which will configure an Ubuntu container containing all you need to run MorphQ. See [DOCKER.md](DOCKER.md) for instructions. We recommend reading this README first and then the docker instructions. # Reproduce the Paper Figures (Level 1)