QDMI v1.4.0
Quantum Device Management Interface
Loading...
Searching...
No Matches
client.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 - 2026 QDMI Maintainers
3 * All rights reserved.
4 *
5 * Licensed under the Apache License v2.0 with LLVM Exceptions (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://llvm.org/LICENSE.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 *
17 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
18 */
19
23
24#pragma once
25
26#include "qdmi/constants.h" // IWYU pragma: export
27#include "qdmi/export.h" // IWYU pragma: export
28#include "qdmi/types.h" // IWYU pragma: export
29
30#ifdef __cplusplus
31#include <cstddef>
32
33extern "C" {
34#else
35#include <stddef.h>
36#endif
37
38// The following clang-tidy warning cannot be addressed because this header is
39// used from both C and C++ code.
40// NOLINTBEGIN(performance-enum-size, modernize-use-using)
41
69
75#define QDMI_CLIENT_ABI_VERSION QDMI_MAKE_VERSION(1, 4, 0)
76
87QDMI_DRIVER_EXPORT uint32_t QDMI_driver_get_client_abi_version(void);
88
97typedef struct QDMI_Device_impl_d *QDMI_Device;
98
119
125typedef struct QDMI_Session_impl_d *QDMI_Session;
126
145QDMI_DRIVER_EXPORT int QDMI_session_alloc(QDMI_Session *session);
146
231
234
284QDMI_DRIVER_EXPORT int QDMI_session_set_parameter(QDMI_Session session,
286 size_t size,
287 const void *value);
288
309QDMI_DRIVER_EXPORT int QDMI_session_init(QDMI_Session session);
310
347
350
405QDMI_DRIVER_EXPORT int
407 QDMI_Session_Property prop, size_t size,
408 void *value, size_t *size_ret);
409
418QDMI_DRIVER_EXPORT void QDMI_session_free(QDMI_Session session);
419 // end of client_session_interface
421
431
480QDMI_DRIVER_EXPORT int
482 size_t size, void *value, size_t *size_ret);
483
535QDMI_DRIVER_EXPORT int QDMI_device_query_site_property(QDMI_Device device,
536 QDMI_Site site,
538 size_t size, void *value,
539 size_t *size_ret);
540
624 QDMI_Device device, QDMI_Operation operation, size_t num_sites,
625 const QDMI_Site *sites, size_t num_params, const double *params,
626 QDMI_Operation_Property prop, size_t size, void *value, size_t *size_ret);
627 // end of client_query_interface
629
652
664typedef struct QDMI_Job_impl_d *QDMI_Job;
665
683QDMI_DRIVER_EXPORT int QDMI_device_create_job(QDMI_Device device,
684 QDMI_Job *job);
685
721QDMI_DRIVER_EXPORT int QDMI_session_retrieve_job_by_id(QDMI_Device device,
722 const char *job_id,
723 QDMI_Job *job);
724
762
765
818QDMI_DRIVER_EXPORT int QDMI_job_set_parameter(QDMI_Job job,
819 QDMI_Job_Parameter param,
820 size_t size, const void *value);
821
878QDMI_DRIVER_EXPORT int QDMI_job_set_programs(QDMI_Job job,
879 QDMI_Program_Format format,
880 size_t count, const size_t *sizes,
881 const void *const *programs);
882
905QDMI_DRIVER_EXPORT int QDMI_job_get_program(QDMI_Job job, size_t program_index,
906 size_t size, void *data,
907 size_t *size_ret);
908
928QDMI_DRIVER_EXPORT int QDMI_job_get_program_status(QDMI_Job job,
929 size_t program_index,
930 QDMI_Job_Status *status);
931
1012
1015
1066QDMI_DRIVER_EXPORT int QDMI_job_query_property(QDMI_Job job,
1067 QDMI_Job_Property prop,
1068 size_t size, void *value,
1069 size_t *size_ret);
1070
1087QDMI_DRIVER_EXPORT int QDMI_job_submit(QDMI_Job job);
1088
1102QDMI_DRIVER_EXPORT int QDMI_job_cancel(QDMI_Job job);
1103
1118QDMI_DRIVER_EXPORT int QDMI_job_check(QDMI_Job job, QDMI_Job_Status *status);
1119
1141QDMI_DRIVER_EXPORT int QDMI_job_wait(QDMI_Job job, size_t timeout);
1142
1193QDMI_DRIVER_EXPORT int QDMI_job_get_results(QDMI_Job job, size_t program_index,
1194 QDMI_Job_Result result, size_t size,
1195 void *data, size_t *size_ret);
1196
1205QDMI_DRIVER_EXPORT void QDMI_job_free(QDMI_Job job);
1206 // end of client_job_interface
1208 // end of client_interface
1210
1211// NOLINTEND(performance-enum-size, modernize-use-using)
1212
1213#ifdef __cplusplus
1214} // extern "C"
1215#endif
Defines all enums used within QDMI across the QDMI Client Interface and the QDMI Device Interface.
enum QDMI_JOB_STATUS_T QDMI_Job_Status
Job status type.
Definition constants.h:925
enum QDMI_PROGRAM_FORMAT_T QDMI_Program_Format
Program format type.
Definition constants.h:1089
enum QDMI_JOB_RESULT_T QDMI_Job_Result
Job result type.
Definition constants.h:1199
enum QDMI_SITE_PROPERTY_T QDMI_Site_Property
Site property type.
Definition constants.h:747
enum QDMI_OPERATION_PROPERTY_T QDMI_Operation_Property
Operation property type.
Definition constants.h:897
enum QDMI_DEVICE_PROPERTY_T QDMI_Device_Property
Device property type.
Definition constants.h:512
Defines macros for controlling the visibility of symbols.
struct QDMI_Device_impl_d * QDMI_Device
A handle for a device implementing the QDMI Device Interface.
Definition client.h:97
uint32_t QDMI_driver_get_client_abi_version(void)
Return the Client Interface ABI implemented by the driver.
enum QDMI_JOB_PROPERTY_T QDMI_Job_Property
Job property type.
Definition client.h:1014
int QDMI_job_submit(QDMI_Job job)
Submit a job to the device.
int QDMI_job_get_results(QDMI_Job job, size_t program_index, QDMI_Job_Result result, size_t size, void *data, size_t *size_ret)
Retrieve one program's results from a job.
QDMI_JOB_PARAMETER_T
Enum of the job parameters that can be set.
Definition client.h:730
enum QDMI_JOB_PARAMETER_T QDMI_Job_Parameter
Job parameter type.
Definition client.h:764
int QDMI_session_retrieve_job_by_id(QDMI_Device device, const char *job_id, QDMI_Job *job)
Retrieve an existing job by its ID.
int QDMI_job_wait(QDMI_Job job, size_t timeout)
Wait for a job to finish.
QDMI_JOB_PROPERTY_T
Enum of the job properties that can be queried via QDMI_job_query_property as part of the client inte...
Definition client.h:939
int QDMI_job_set_parameter(QDMI_Job job, QDMI_Job_Parameter param, size_t size, const void *value)
Set a parameter for a job.
void QDMI_job_free(QDMI_Job job)
Free a job.
int QDMI_device_create_job(QDMI_Device device, QDMI_Job *job)
Create a job.
struct QDMI_Job_impl_d * QDMI_Job
A handle for a client-side job.
Definition client.h:664
int QDMI_job_set_programs(QDMI_Job job, QDMI_Program_Format format, size_t count, const size_t *sizes, const void *const *programs)
Set one or more programs for a job.
int QDMI_job_get_program(QDMI_Job job, size_t program_index, size_t size, void *data, size_t *size_ret)
Retrieve one program in input order.
int QDMI_job_cancel(QDMI_Job job)
Cancel an already submitted job.
int QDMI_job_get_program_status(QDMI_Job job, size_t program_index, QDMI_Job_Status *status)
Query the current status of one program in a job.
int QDMI_job_check(QDMI_Job job, QDMI_Job_Status *status)
Check the status of a job.
int QDMI_job_query_property(QDMI_Job job, QDMI_Job_Property prop, size_t size, void *value, size_t *size_ret)
Query a job property.
@ QDMI_JOB_PARAMETER_CUSTOM1
This enum value is reserved for a custom parameter.
Definition client.h:752
@ QDMI_JOB_PARAMETER_CUSTOM4
Definition client.h:758
@ QDMI_JOB_PARAMETER_SHOTSNUM
size_t The number of shots to execute for each program in a job.
Definition client.h:737
@ QDMI_JOB_PARAMETER_CUSTOM3
Definition client.h:756
@ QDMI_JOB_PARAMETER_CUSTOM5
Definition client.h:760
@ QDMI_JOB_PARAMETER_CUSTOM2
Definition client.h:754
@ QDMI_JOB_PARAMETER_MAX
The maximum value of the enum.
Definition client.h:745
@ QDMI_JOB_PROPERTY_CUSTOM5
Definition client.h:1010
@ QDMI_JOB_PROPERTY_CUSTOM1
This enum value is reserved for a custom parameter.
Definition client.h:1002
@ QDMI_JOB_PROPERTY_MAX
The maximum value of the enum.
Definition client.h:995
@ QDMI_JOB_PROPERTY_PROGRAMSNUM
size_t The number of programs in the job.
Definition client.h:986
@ QDMI_JOB_PROPERTY_SHOTSNUM
Value 2 is reserved for the removed program property; do not reuse it.
Definition client.h:964
@ QDMI_JOB_PROPERTY_ID
char* (string) The job's ID.
Definition client.h:949
@ QDMI_JOB_PROPERTY_PROGRAMFORMAT
QDMI_Program_Format The format of the program to be executed.
Definition client.h:957
@ QDMI_JOB_PROPERTY_CUSTOM2
Definition client.h:1004
@ QDMI_JOB_PROPERTY_QUEUEPOSITION
size_t The current number of jobs ahead of this job in its queue.
Definition client.h:979
@ QDMI_JOB_PROPERTY_CUSTOM3
Definition client.h:1006
@ QDMI_JOB_PROPERTY_CUSTOM4
Definition client.h:1008
int QDMI_device_query_device_property(QDMI_Device device, QDMI_Device_Property prop, size_t size, void *value, size_t *size_ret)
Query a device property.
int QDMI_device_query_operation_property(QDMI_Device device, QDMI_Operation operation, size_t num_sites, const QDMI_Site *sites, size_t num_params, const double *params, QDMI_Operation_Property prop, size_t size, void *value, size_t *size_ret)
Query an operation property.
int QDMI_device_query_site_property(QDMI_Device device, QDMI_Site site, QDMI_Site_Property prop, size_t size, void *value, size_t *size_ret)
Query a site property.
void QDMI_session_free(QDMI_Session session)
Free a session.
int QDMI_session_set_parameter(QDMI_Session session, QDMI_Session_Parameter param, size_t size, const void *value)
Set a parameter for a session.
struct QDMI_Session_impl_d * QDMI_Session
A handle for a session.
Definition client.h:125
int QDMI_session_query_session_property(QDMI_Session session, QDMI_Session_Property prop, size_t size, void *value, size_t *size_ret)
Query a property of a session.
QDMI_SESSION_PROPERTY_T
Enum of the session properties that can be queried via QDMI_session_query_session_property.
Definition client.h:317
int QDMI_session_alloc(QDMI_Session *session)
Allocate a new session.
QDMI_SESSION_PARAMETER_T
Enum of the session parameters that can be set via QDMI_session_set_parameter.
Definition client.h:153
enum QDMI_SESSION_PARAMETER_T QDMI_Session_Parameter
Session parameter type.
Definition client.h:233
enum QDMI_SESSION_PROPERTY_T QDMI_Session_Property
Session property type.
Definition client.h:349
int QDMI_session_init(QDMI_Session session)
Initialize a session.
@ QDMI_SESSION_PROPERTY_CUSTOM3
Definition client.h:341
@ QDMI_SESSION_PROPERTY_CUSTOM2
Definition client.h:339
@ QDMI_SESSION_PROPERTY_CUSTOM1
This enum value is reserved for a custom property.
Definition client.h:337
@ QDMI_SESSION_PROPERTY_CUSTOM5
Definition client.h:345
@ QDMI_SESSION_PROPERTY_MAX
The maximum value of the enum.
Definition client.h:330
@ QDMI_SESSION_PROPERTY_DEVICES
QDMI_Device* (QDMI_Device list) The devices the client has access to.
Definition client.h:322
@ QDMI_SESSION_PROPERTY_CUSTOM4
Definition client.h:343
@ QDMI_SESSION_PARAMETER_CUSTOM1
This enum value is reserved for a custom parameter.
Definition client.h:221
@ QDMI_SESSION_PARAMETER_AUTHURL
char* (string) The URL to an authentication server used as part of the authentication procedure.
Definition client.h:184
@ QDMI_SESSION_PARAMETER_CUSTOM3
Definition client.h:225
@ QDMI_SESSION_PARAMETER_PASSWORD
char* (string) The password to use for the session.
Definition client.h:198
@ QDMI_SESSION_PARAMETER_MAX
The maximum value of the enum.
Definition client.h:214
@ QDMI_SESSION_PARAMETER_CUSTOM5
Definition client.h:229
@ QDMI_SESSION_PARAMETER_CUSTOM2
Definition client.h:223
@ QDMI_SESSION_PARAMETER_CUSTOM4
Definition client.h:227
@ QDMI_SESSION_PARAMETER_USERNAME
char* (string) The username to use for the session.
Definition client.h:191
@ QDMI_SESSION_PARAMETER_TOKEN
char* (string) The token to use for the session.
Definition client.h:160
@ QDMI_SESSION_PARAMETER_PROJECTID
char* (string) The project ID to use for the session.
Definition client.h:205
@ QDMI_SESSION_PARAMETER_AUTHFILE
char* (string) A file path to a file containing authentication information.
Definition client.h:170
Defines all types used within QDMI across the QDMI Client Interface and the QDMI Device Interface.
struct QDMI_Site_impl_d * QDMI_Site
A handle for a site.
Definition types.h:54
struct QDMI_Operation_impl_d * QDMI_Operation
A handle for an operation.
Definition types.h:73