Commit 3a5c2a51 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

add qsharp-qcor code server image

parent e92692b2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -59,9 +59,11 @@ docker run_docker_deploy:
  script:
  - cd docker/ci/alpine/qcor && docker build -t qcor/cli . --no-cache
  - cd ../code-server && docker build -t qcor/qcor . --no-cache
  - cd ../qsharp-code-server && docker build -t qcor/qsharp-qcor . --no-cache
  - echo "$REGISTRY_PASSWORD" | docker login -u qcor --password-stdin
  - docker push qcor/cli
  - docker push qcor/qcor
  - docker push qcor/qsharp-qcor
  - docker system prune -f
  - docker rmi -f qcor/qcor qcor/cli
  allow_failure: true
+50 −0
Original line number Diff line number Diff line
FROM qcor/cli
ENV VERSION=3.11.0

RUN sudo apk add nodejs openssh-client gnupg bash && \
   wget https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-linux-amd64.tar.gz && \
   tar x -zf code-server-$VERSION-linux-amd64.tar.gz && \
   rm code-server-$VERSION-linux-amd64.tar.gz && \
   rm code-server-$VERSION-linux-amd64/node && \
   rm code-server-$VERSION-linux-amd64/code-server && \
   rm code-server-$VERSION-linux-amd64/lib/node && \
   sudo mv code-server-$VERSION-linux-amd64 /usr/lib/code-server && \
   sudo sed -i 's/"$ROOT\/lib\/node"/node/g'  /usr/lib/code-server/bin/code-server 

# WORKDIR /home/root

RUN sudo apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib wget \
   && sudo apk add libgdiplus --repository https://dl-3.alpinelinux.org/alpine/edge/testing/ \
   && wget https://dot.net/v1/dotnet-install.sh \
   && chmod +x dotnet-install.sh \
   && ./dotnet-install.sh -c 3.1 \
   && sudo ln -s ~/.dotnet/dotnet /usr/bin/dotnet \
   && dotnet nuget add source "https://pkgs.dev.azure.com/ms-quantum-public/Microsoft Quantum (public)/_packaging/alpha/nuget/v3/index.json" -n qdk-alpha \
   && dotnet new -i Microsoft.Quantum.ProjectTemplates \
   && git clone https://github.com/ornl-qci/qcor && cp -r qcor/examples cpp-examples && rm -rf qcor \
   && sudo apk add llvm \
   && sudo apk add xmlstarlet \
   && xmlstarlet ed --inplace -s /configuration -t elem -n config -v "" \
                              -s /configuration/config -t elem -n add -v "" \
                              -i /configuration/config/add -t attr -n "key" -v "maxHttpRequestsPerSource" \
                              -i /configuration/config/add -t attr -n "value" -v "2" \
                                 /home/coder/.nuget/NuGet/NuGet.Config \
   && sudo apk del xmlstarlet \  
   && dotnet new console && dotnet add package libllvm.runtime.ubuntu.20.04-x64 --version 11.0.0 \
   && cd /home/coder/.nuget/packages/libllvm.runtime.ubuntu.20.04-x64/11.0.0/runtimes/ubuntu.20.04-x64/native/ \
   && rm libLLVM.so \
   && ln -s /usr/lib/libLLVM-11.so libLLVM.so \
   && mkdir -p /home/coder/.local/share/code-server/User \
   && printf "{\"workbench.startupEditor\": \"readme\", \"workbench.colorTheme\": \"Monokai Dimmed\", \"workbench.panel.defaultLocation\": \"right\", \"terminal.integrated.shell.linux\": \"bash\", \"files.associations\": {\"*.qasm\": \"cpp\"}" | tee /home/coder/.local/share/code-server/User/settings.json \
   && wget https://github.com/microsoft/vscode-cpptools/releases/download/1.5.1/cpptools-linux.vsix \
   && wget https://github.com/microsoft/vscode-python/releases/download/2020.10.332292344/ms-python-release.vsix \
   && /usr/lib/code-server/bin/code-server --install-extension cpptools-linux.vsix \
   && /usr/lib/code-server/bin/code-server --install-extension ms-python-release.vsix \
   && rm -rf cpptools-linux.vsix ms-python-release.vsix
   
ENV PATH "${PATH}:/usr/lib/code-server/bin"
ADD README.md .
ENV QCOR_QDK_VERSION 0.17.2106148041-alpha
ENV LD_LIBRARY_PATH /home/coder/.nuget/packages/libllvm.runtime.ubuntu.20.04-x64/11.0.0/runtimes/ubuntu.20.04-x64/native

ENTRYPOINT ["/usr/lib/code-server/bin/code-server", "--bind-addr", "0.0.0.0:8080", "--auth", "none", "."]
 No newline at end of file
+71 −0
Original line number Diff line number Diff line
<img src="https://github.com/ornl-qci/qcor/blob/master/docs/assets/qcor_full_logo.svg?raw=true" alt="qcor_fig" width="600"/>

# Welcome to QCOR

You are using the QCOR web-IDE for heterogeneous quantum-classical computing. <br>
This project provides a pre-built image containing the entire `qcor` compiler stack, including the [`qcor`](https://github.com/ornl-qci/qcor) <br>
C++ compiler and Python quantum JIT environment, the [XACC](https://github.com/eclipse/xacc) framework and high-level Python API, <br>
and the OpenQASM 3 MLIR compiler. 

For much more on the `qcor` platform, check out [docs.aide-qc.org](http://docs.aide-qc.org).

## Getting Started

In the file browser to the left you'll notice a number of example directories. We have provided illustrative examples in C++, Python, <br>
and OpenQASM 3 (via the MLIR compiler). Feel free to try them out! To start, open a Terminal with `CTRL`+<code>\`</code> (single-quote). <br>
From the terminal, you have the `qcor` compiler available in your path as well as the Python bindings for `qcor` and XACC in your `PYTHONPATH`. <br>
Open up the simple `bell.py`, look at it, and run it with 
```bash
$ code-server py-examples/bell.py (or just double-click in file browser)
$ python3 py-examples/bell.py -shots 100
{
    "AcceleratorBuffer": {
        "name": "qrg_ASjHA",
        "size": 2,
        "Information": {},
        "Measurements": {
            "00": 44,
            "11": 56
        }
    }
}
```
To run on IBM or any other physical backend, check out how to provide your [API credentials](https://aide-qc.github.io/deploy/users/remote_qpu_creds/). 

To run a C++ example like [Phase Estimation](https://github.com/ORNL-QCI/qcor/blob/master/examples/qpe/qpe_callable_oracle.cpp), run the following
```bash
$ qcor -shots 100 cpp-examples/qpe/qpe_callable_oracle.cpp
$ ./a.out
X qrg_ASjHA3
H qrg_ASjHA0
H qrg_ASjHA1
H qrg_ASjHA2
CPhase(0.785398) qrg_ASjHA0,qrg_ASjHA3
CPhase(0.785398) qrg_ASjHA1,qrg_ASjHA3
CPhase(0.785398) qrg_ASjHA1,qrg_ASjHA3
CPhase(0.785398) qrg_ASjHA2,qrg_ASjHA3
CPhase(0.785398) qrg_ASjHA2,qrg_ASjHA3
CPhase(0.785398) qrg_ASjHA2,qrg_ASjHA3
CPhase(0.785398) qrg_ASjHA2,qrg_ASjHA3
Swap qrg_ASjHA0,qrg_ASjHA2
H qrg_ASjHA0
CPhase(-1.5708) qrg_ASjHA1,qrg_ASjHA0
H qrg_ASjHA1
CPhase(-1.5708) qrg_ASjHA2,qrg_ASjHA1
CPhase(-0.785398) qrg_ASjHA2,qrg_ASjHA0
H qrg_ASjHA2
Measure qrg_ASjHA0
Measure qrg_ASjHA1
Measure qrg_ASjHA2

{
    "AcceleratorBuffer": {
        "name": "qrg_ASjHA",
        "size": 4,
        "Information": {},
        "Measurements": {
            "100": 100
        }
    }
}
```
 No newline at end of file