qcor.hpp 2 KB
Newer Older
Mccaskey, Alex's avatar
Mccaskey, Alex committed
1
2
3
#ifndef RUNTIME_QCOR_HPP_
#define RUNTIME_QCOR_HPP_

4
#include <future>
Mccaskey, Alex's avatar
Mccaskey, Alex committed
5

6
7
#include "Optimizer.hpp"
#include "Algorithm.hpp"
Mccaskey, Alex's avatar
Mccaskey, Alex committed
8

9
10
#include "Observable.hpp"

Mccaskey, Alex's avatar
Mccaskey, Alex committed
11
namespace xacc {
12
13
class Function;
class AcceleratorBuffer;
14
15
class Accelerator;
} // namespace xacc
Mccaskey, Alex's avatar
Mccaskey, Alex committed
16
17
18
19
20

using namespace xacc;

namespace qcor {

21
class qpu_handler;
22

23
using HandlerLambda = std::function<void(qpu_handler &)>;
24

25
extern std::map<std::string, InstructionParameter> runtimeMap;
26

27
void Initialize(int argc, char **argv);
28
void Initialize(std::vector<std::string> argv);
Mccaskey, Alex's avatar
Mccaskey, Alex committed
29
30
31

// Persist the given function to file, return
// the file name
32
33
const std::string persistCompiledCircuit(std::shared_ptr<Function> function,
                                         std::shared_ptr<Accelerator> acc);
Mccaskey, Alex's avatar
Mccaskey, Alex committed
34
35
std::shared_ptr<Function> loadCompiledCircuit(const std::string &fileName);

36
37
// void storeRuntimeVariable(const std::string name, int param);
void storeRuntimeVariable(const std::string name, InstructionParameter param);
38
39
std::map<std::string, InstructionParameter> getRuntimeMap();

Mccaskey, Alex's avatar
Mccaskey, Alex committed
40
// Submit an asynchronous job to the QPU
41
std::future<std::shared_ptr<AcceleratorBuffer>> submit(HandlerLambda &&lambda);
42
43
std::future<std::shared_ptr<AcceleratorBuffer>> submit(HandlerLambda &&lambda, std::shared_ptr<AcceleratorBuffer> buffer);

44
// std::shared_ptr<AcceleratorBuffer> submit(HandlerLambda &&lambda);
Mccaskey, Alex's avatar
Mccaskey, Alex committed
45

46
47
48
49
50
51
52
53
54
std::shared_ptr<Optimizer> getOptimizer(const std::string &name);
std::shared_ptr<Optimizer>
getOptimizer(const std::string &name,
             std::map<std::string, InstructionParameter> &&options);

std::shared_ptr<Observable> getObservable(const std::string &type,
                                          const std::string &representation);
std::shared_ptr<Observable> getObservable();
std::shared_ptr<Observable> getObservable(const std::string &representation);
55
std::shared_ptr<Observable> getObservable(const std::string &type, std::map<std::string, InstructionParameter> &&options);
56

57
std::shared_ptr<Algorithm> getAlgorithm(const std::string name);
Mccaskey, Alex's avatar
Mccaskey, Alex committed
58
59
} // namespace qcor

60
61
#include "qpu_handler.hpp"

Mccaskey, Alex's avatar
Mccaskey, Alex committed
62
#endif