This service takes a qsharp implementation as data or via an URL and returns either compiled circuit properties and the traced qsharp compilation (Transpilation Request) or its results (Execution Request) depending on the input data and selected backend.
- Clone repository:
git clone https://github.com/UST-QuAntiL/qsharp-service.git
- Start containers:
docker-compose pull
docker-compose up
Now the qsharp-service is available on http://localhost:5022/.
- Update container:
docker build -t planqk/qsharp-service:latest
docker push planqk/qsharp-service:latest
- Start containers:
docker-compose pull
docker-compose up
Send implementation to the API to get properties of the compiled circuit, as well as the trace tree of the circuit. The first executable operation found in the code will be transpiled. In case of QSharp code, and parameters will be inserted on transpilation. In case of Python code, parameters will be used to call the "get_circuit" method, which is expected to return a QSharp string without parameters. QSharp only counts "T-Gates" as having a gate time, so the depth only counts "T-Gates".
POST /qsharp-service/api/v1.0/transpile
{
"impl-url": "URL-OF-IMPLEMENTATION",
"impl-language": "QSharp/Python",
"input-params": {
"PARAM-NAME-1": {
"rawValue": "YOUR-VALUE-1",
"type": "Integer"
},
"PARAM-NAME-2": {
"rawValue": "YOUR-VALUE-2",
"type": "String"
},
...
}
}
{
"impl-data": "BASE64-ENCODED-IMPLEMENTATION",
"impl-language": "QSharp/Python",
"input-params": {
"PARAM-NAME-1": {
"rawValue": "YOUR-VALUE-1",
"type": "Integer"
},
"PARAM-NAME-2": {
"rawValue": "YOUR-VALUE-2",
"type": "String"
},
...
}
}
{
"qsharp-string": "QSHARP-STRING",
"impl-language": "QSharp",
"input-params": {
"PARAM-NAME-1": {
"rawValue": "YOUR-VALUE-1",
"type": "Integer"
},
"PARAM-NAME-2": {
"rawValue": "YOUR-VALUE-2",
"type": "String"
},
...
}
}
Send implementation, input, and QPU information to the API to execute your circuit and get the result. Note: Currently, the QSharp only supports local simulation. Thus, no real backends are accessible. The first executable operation found in the code will be executed. In case of QSharp code, and parameters will be inserted on execution. In case of Python code, parameters will be used to call the "get_circuit" method, which is expected to return a QSharp string without parameters.
POST /qsharp-service/api/v1.0/execute
{
"impl-url": "URL-OF-IMPLEMENTATION",
"impl-language": "QSharp/Python",
"shots": "SHOTS",
"gate-noise": {
"single-qubit": "SINGLE-QUBIT-GATE-DEPOLARISATION-PROBABILITY",
"multiple-qubit": "MULTIPLE-QUBIT-GATE-DEPOLARISATION-PROBABILITY",
"measurement": "MEASUREMENT-GATE-DEPOLARISATION-PROBABILITY"
},
"input-params": {
"PARAM-NAME-1": {
"rawValue": "YOUR-VALUE-1",
"type": "Integer"
},
"PARAM-NAME-2": {
"rawValue": "YOUR-VALUE-2",
"type": "String"
},
...
}
}
{
"impl-data": "BASE64-ENCODED-IMPLEMENTATION",
"impl-language": "QSharp/Python",
"shots": "SHOTS",
"gate-noise": {
"single-qubit": "SINGLE-QUBIT-GATE-DEPOLARISATION-PROBABILITY",
"multiple-qubit": "MULTIPLE-QUBIT-GATE-DEPOLARISATION-PROBABILITY",
"measurement": "MEASUREMENT-GATE-DEPOLARISATION-PROBABILITY"
},
"input-params": {
"PARAM-NAME-1": {
"rawValue": "YOUR-VALUE-1",
"type": "Integer"
},
"PARAM-NAME-2": {
"rawValue": "YOUR-VALUE-2",
"type": "String"
},
...
}
}
{
"qsharp-string": "QSHARP-STRING",
"impl-language": "QSharp",
"shots": "SHOTS",
"gate-noise": {
"single-qubit": "SINGLE-QUBIT-GATE-DEPOLARISATION-PROBABILITY",
"multiple-qubit": "MULTIPLE-QUBIT-GATE-DEPOLARISATION-PROBABILITY",
"measurement": "MEASUREMENT-GATE-DEPOLARISATION-PROBABILITY"
},
"input-params": {
"PARAM-NAME-1": {
"rawValue": "YOUR-VALUE-1",
"type": "Integer"
},
"PARAM-NAME-2": {
"rawValue": "YOUR-VALUE-2",
"type": "String"
},
...
}
}
If no gate-noise is passed, a perfect simulation will be used. A default noisy simulation can be achieved by passing a "noisy-simulator" as a qpu.
Returns a content location for the result. Access it via GET
.
Sample implementations can be found here and under the folder 'Sample Implementations'.
Please use the raw GitHub URL as impl-url
value (see example).
Dies ist ein Forschungsprototyp. Die Haftung für entgangenen Gewinn, Produktionsausfall, Betriebsunterbrechung, entgangene Nutzungen, Verlust von Daten und Informationen, Finanzierungsaufwendungen sowie sonstige Vermögens- und Folgeschäden ist, außer in Fällen von grober Fahrlässigkeit, Vorsatz und Personenschäden, ausgeschlossen.
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.