• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2021 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_ASCEND_RESOURCE_H_
18 #define MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_ASCEND_RESOURCE_H_
19 
20 #include <memory>
21 #include <string>
22 #include "minddata/dataset/core/device_resource.h"
23 #include "minddata/dataset/core/device_tensor.h"
24 #include "minddata/dataset/core/tensor.h"
25 
26 namespace mindspore {
27 namespace dataset {
28 
29 class AscendResource : public DeviceResource {
30  public:
31   AscendResource() = default;
32   ~AscendResource() = default;
33 
34   Status InitResource(uint32_t device_id) override;
35 
36   Status FinalizeResource() override;
37 
38   Status Sink(const mindspore::MSTensor &host_input, std::shared_ptr<DeviceTensor> *device_input) override;
39 
40   Status Pop(const std::shared_ptr<DeviceTensor> &device_output, std::shared_ptr<Tensor> *host_output) override;
41 
42   std::shared_ptr<void> GetInstance() override;
43 
44   Status DeviceDataRelease() override;
45 
46   void *GetContext() override;
47 
48   void *GetStream() override;
49 
50  private:
51   std::shared_ptr<void> processor_;
52 };
53 
54 }  // namespace dataset
55 }  // namespace mindspore
56 
57 #endif  // MINDSPORE_CCSRC_MINDDATA_DATASET_CORE_ASCEND_RESOURCE_H_
58