Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ Checks: |
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.ClassIgnoredRegexp
value: ".*ZX.*|.*SWAP.*|.*CEX.*|.*DD.*|.*EQ.*"
- key: readability-identifier-naming.ConstantParameterCase
value: camelBack
- key: readability-identifier-naming.EnumCase
Expand All @@ -41,7 +39,7 @@ CheckOptions:
- key: readability-identifier-naming.FunctionCase
value: camelBack
- key: readability-identifier-naming.FunctionIgnoredRegexp
value: ".*ZX.*|.*SWAP.*|.*CEX.*|.*DD.*|.*EQ.*"
value: ".*MQSS.*"
- key: readability-identifier-naming.GlobalConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.IgnoreMainLikeFunctions
Expand Down
48 changes: 30 additions & 18 deletions .github/workflows/mqss_client-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: MQSS Client Testing

on:
Expand All @@ -15,25 +12,40 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
Comment thread
mnfarooqi marked this conversation as resolved.

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv
uv sync
sudo apt update -y
sudo apt-get install -y \
software-properties-common \
cmake \
nlohmann-json3-dev \
librabbitmq-dev \
libboost-dev \
libgtest-dev \
libgmock-dev \
libcurl4-openssl-dev

python3 -m pip install --upgrade pip
pip install uv pre-commit

- name: Run pre-commit
run: |
uv run pre-commit install
uv run pre-commit run --all-files
- name: Test with pytest
pre-commit install
pre-commit run --all-files

- name: Configure project
run: |
cmake -S . -B build -DBUILD_UNIT_TESTS=ON

- name: Build
run: |
cmake --build build --parallel

- name: Run tests
run: |
uv run nox -s test
ctest --test-dir build/tests/unit/c++/ --output-on-failure
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ coverage.xml
.hypothesis/
.pytest_cache/
cover/
Testing/*

# Translations
*.mo
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ project(
MQSS-Client
VERSION 0.1
DESCRIPTION "MQSS Client"
LANGUAGES CXX)
LANGUAGES CXX C)

# Generate compile_commands.json to make it easier to work with clang based tools
set(CMAKE_EXPORT_COMPILE_COMMANDS
Expand All @@ -33,6 +33,7 @@ option(BUILD_TESTS "Build the tests" OFF)
option(BUILD_UNIT_TESTS "Build the unit tests" OFF)
option(BUILD_INTEGRATION_TESTS "Build the unit tests" OFF)
option(ENABLE_COVERAGE "Enabling coverage" OFF)
option(BUILD_BINDINGS "Build Python Bindings" OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

Expand Down
6 changes: 3 additions & 3 deletions bindings/job.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ void registerJobInterface(const py::module& m) {

py::class_<mqss::client::JobResult>(m, "JobResult")
.def_property_readonly("results", &mqss::client::JobResult::getResults)
.def_property_readonly("completion_timestamp",
.def_property_readonly("timestamp_completed",
&mqss::client::JobResult::getTimestampCompleted)
.def_property_readonly("submission_timestamp",
.def_property_readonly("timestamp_submitted",
&mqss::client::JobResult::getTimestampSubmitted)
.def_property_readonly("scheduled_timestamp",
.def_property_readonly("timestamp_scheduled",
&mqss::client::JobResult::getTimestampScheduled);
}
6 changes: 4 additions & 2 deletions bindings/resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ void registerResourceInterface(const py::module& m) {

py::class_<mqss::client::Gate>(m, "Gate")
.def_property_readonly("name", &mqss::client::Gate::getName)
.def_property_readonly("qubit_number", &mqss::client::Gate::getQubitNumber)
.def_property_readonly("parameter_number", &mqss::client::Gate::getParameterNumber)
.def_property_readonly("qubit_number",
&mqss::client::Gate::getQubitNumber)
.def_property_readonly("parameter_number",
&mqss::client::Gate::getParameterNumber)
.def_property_readonly("supported_qubits",
&mqss::client::Gate::getSupportedQubits);
}
49 changes: 49 additions & 0 deletions include/mqss-c/client.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2024 - 2026 MQSS Project
* All rights reserved.
*
* Licensed under the Apache License v2.0 with LLVM Exceptions (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://llvm.org/LICENSE.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#pragma once

#ifdef __cplusplus
extern "C" {
#endif
#include "job.h"
#include "resource.h"

#include <stdbool.h>

typedef struct MQSSOpaqueClient* MQSSClientRef;

MQSSClientRef MQSSClientCreateClient(char* token, char* urlOrQueue, bool isHpc);

MQSSResourceRef* MQSSClientGetAllResources(MQSSClientRef client, int* size);

MQSSResourceRef MQSSClientGetResourceInfo(MQSSClientRef client,
const char* resourceName);

int MQSSClientSubmitJob(MQSSClientRef client, MQSSJobRef job);

void MQSSClientCancelJob(MQSSClientRef client, MQSSJobRef job);

MQSSJobResultRef MQSSClientGetJobResult(MQSSClientRef client, MQSSJobRef job,
bool wait, unsigned int timeout);

int MQSSClientGetNumberPendingJobs(MQSSClientRef client, char* resourceName);
Comment on lines +30 to +46
#ifdef __cplusplus
}
#endif
53 changes: 53 additions & 0 deletions include/mqss-c/job.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2024 - 2026 MQSS Project
* All rights reserved.
*
* Licensed under the Apache License v2.0 with LLVM Exceptions (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://llvm.org/LICENSE.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#pragma once

#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
typedef struct MQSSOpaqueJob* MQSSJobRef;

typedef struct MQSSOpaqueJobResult* MQSSJobResultRef;

MQSSJobRef MQSSClientCreateCircuitJob(char* circuit, char* circuitFormat,
char* resourceName, unsigned int shots,
bool noModify, bool queued);

MQSSJobRef MQSSClientCreateHamiltonianJob(char* resourceName,
char* interactionStr,
char* coefficientsStr);

int MQSSClientGetJobResultCounts(MQSSJobResultRef jobResult, char*** bitstreams,
int** counts, int* size);

int MQSSClientGetJobResultCompletedTimestamp(MQSSJobResultRef jobResult,
uint64_t* completedTimestamp);

int MQSSClientGetJobResultSubmittedTimestamp(MQSSJobResultRef jobResult,
uint64_t* submittedTimestamp);

int MQSSClientGetJobResultScheduledTimestamp(MQSSJobResultRef jobResult,
uint64_t* scheduledTimestamp);

#ifdef __cplusplus
}
#endif
45 changes: 45 additions & 0 deletions include/mqss-c/resource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2024 - 2026 MQSS Project
* All rights reserved.
*
* Licensed under the Apache License v2.0 with LLVM Exceptions (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://llvm.org/LICENSE.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#pragma once

#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>

typedef struct MQSSOpaqueResource* MQSSResourceRef;

typedef struct MQSSOpaqueGate* MQSSGateRef;

int MQSSClientResourceGetInfo(MQSSResourceRef resource, char** name,
unsigned* qubitCount, bool* online,
int** couplingMap, unsigned int* couplingMapSize,
MQSSGateRef** nativeGateset,
unsigned int* gateCount);

int MQSSClientResourceGetGateInfo(MQSSGateRef gate, char** name,
unsigned* qubitNumber,
unsigned* parameterNumber,
int** supportedQubits,
unsigned int* supportedQubitCount);

#ifdef __cplusplus
}
#endif
10 changes: 7 additions & 3 deletions include/mqss/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ class Gate {
mParameterNumber(parameterNumber),
mSupportedQubits(std::move(supportedQubits)) {}

Gate(const Gate&) = default;
Gate& operator=(const Gate&) = default;

Gate(Gate&&) = default;
Gate& operator=(Gate&&) = default;

const std::string& getName() const noexcept { return mName; }

const unsigned int& getQubitNumber() const noexcept { return mQubitNumber; }
Expand Down Expand Up @@ -69,9 +75,7 @@ class Resource {
return mCouplingMap;
}

const std::vector<Gate>& getNativeGateset() const noexcept {
return mNativeGateset;
}
std::vector<Gate>& getNativeGateset() { return mNativeGateset; }

private:
std::string mName;
Expand Down
Loading
Loading