Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
common_DFE.h
Go to the documentation of this file.
1 /*
2 Created on Fri Jun 26 14:13:26 2020
3 Copyright 2020 Peter Rakyta, Ph.D.
4 
5 Licensed under the Apache License, Version 2.0 (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  http://www.apache.org/licenses/LICENSE-2.0
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,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 
17 
18 @author: Peter Rakyta, Ph.D.
19 */
24 #ifndef common_DFE_H
25 #define common_DFE_H
26 
27 
28 #include <omp.h>
29 #include "QGDTypes.h"
30 #include "dot.h"
31 
32 
33 #include <string>
34 #include <stdio.h>
35 #include <iostream>
36 #include <cmath>
37 #include <vector>
38 #include <cstring>
39 #include <sstream>
40 #include <tbb/queuing_rw_mutex.h>
41 
42 
43 #define DFE_LIB_9QUBITS "libqgdDFE.so"
44 #define DFE_LIB_10QUBITS "libqgdDFE_10qubits.so"
45 #define DFE_LIB_SIM "libqgdDFE_SIM.so"
46 
47 
48 extern "C"
49 {
50 
51 
62 typedef struct {
63  int32_t ThetaOver2;
64  int32_t Phi;
65  int32_t Lambda;
66  int8_t target_qbit;
67  int8_t control_qbit;
68  int8_t gate_type;
69  uint8_t metadata;
71 
72 
73 }
74 
75 
76 
82 
83 
89 
94 int get_initialize_id();
95 
107 int calcqgdKernelDFE(size_t rows, size_t cols, DFEgate_kernel_type* gates, int gatesNum, int gateSetNum, int traceOffset, double* trace);
108 
109 
115 
116 
118 public:
121 
122 private:
123  tbb::queuing_rw_mutex::scoped_lock lock;
124 };
125 
126 
127 
128 
133 void uploadMatrix2DFE( Matrix& input );
134 
135 
136 
140 void unload_dfe_lib();
141 
142 
150 int init_dfe_lib( const int accelerator_num, int qbit_num, int initialize_id_in);
151 
152 
156 void init_dfe_lib_and_upload(const int accelerator_num, int qbit_num, int initialize_id_in, Matrix& input);
157 
158 
159 
160 
161 #endif
size_t get_accelerator_free_num()
Call to get the number of free accelerators.
Definition: common_DFE.cpp:206
void unload_dfe_lib()
Call to unload the DFE libarary and release the allocated devices.
Definition: common_DFE.cpp:110
size_t get_accelerator_avail_num()
Call to get the available number of accelerators.
Definition: common_DFE.cpp:195
void init_dfe_lib_and_upload(const int accelerator_num, int qbit_num, int initialize_id_in, Matrix &input)
Initialize the DFE library if needed and upload the input matrix while holding the writer lock...
Definition: common_DFE.cpp:178
int calcqgdKernelDFE(size_t rows, size_t cols, DFEgate_kernel_type *gates, int gatesNum, int gateSetNum, int traceOffset, double *trace)
Call to execute the calculation on the reserved DFE engines.
Definition: common_DFE.cpp:233
Custom types for the SQUANDER package.
int init_dfe_lib(const int accelerator_num, int qbit_num, int initialize_id_in)
Call to initialize the DFE library support and allocate the requested devices.
Definition: common_DFE.cpp:129
Double-precision complex matrix (float64).
Definition: matrix.h:38
tbb::queuing_rw_mutex::scoped_lock lock
Definition: common_DFE.h:123
int get_initialize_id()
Call to get the identification number of the inititalization of the library.
Definition: common_DFE.cpp:216
Fixed point data related to a gate operation.
Definition: common_DFE.h:62
int get_chained_gates_num()
Call to retrieve the number of gates that should be chained up during the execution of the DFE librar...
Definition: common_DFE.cpp:246
void uploadMatrix2DFE(Matrix &input)
Call to upload the input matrix to the DFE engine.
Definition: common_DFE.cpp:76