Scanner C++ API
python_kernel.h
1 #include "scanner/api/kernel.h"
2 #include "scanner/api/op.h"
3 #include "scanner/util/memory.h"
4 #include "scanner/metadata.pb.h"
5 
6 namespace scanner {
7 
9  public:
10  PythonKernel(const KernelConfig& config,
11  const std::string& op_name,
12  const std::string& kernel_code,
13  const bool can_batch,
14  const bool con_stencil);
15 
16  ~PythonKernel();
17 
18  void new_stream(const std::vector<u8>& args) override;
19 
20  void execute(const StenciledBatchedElements& input_columns,
21  BatchedElements& output_columns) override;
22 
23  void reset() override;
24 
25  void fetch_resources(proto::Result* result) override;
26 
27  void setup_with_resources(proto::Result* result) override;
28 
29  private:
30  KernelConfig config_;
31  DeviceHandle device_;
32  bool can_batch_;
33  bool can_stencil_;
34  std::string op_name_;
35  std::string process_name_;
36  std::string send_pipe_name_;
37  std::string recv_pipe_name_;
38  std::string kernel_name_;
39 };
40 
41 }
void fetch_resources(proto::Result *result) override
Downloads any resources necessary for the kernel to run.
Definition: python_kernel.cpp:131
Kernel parameters provided at instantiation.
Definition: kernel.h:118
void setup_with_resources(proto::Result *result) override
Runs any setup code that relies on fetched resources.
Definition: python_kernel.cpp:149
Interface for a unit of computation in a pipeline.
Definition: kernel.h:222
void new_stream(const std::vector< u8 > &args) override
Called when the Kernel is about to process a new stream.
Definition: python_kernel.cpp:166
Definition: common.h:53
Definition: database.cpp:36
void execute(const StenciledBatchedElements &input_columns, BatchedElements &output_columns) override
Runs the op on input elements and produces equal number of output elements.
Definition: python_kernel.cpp:189
void reset() override
Requests that kernel resets its logical state.
Definition: python_kernel.cpp:116
Definition: python_kernel.h:8