You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ascend_profiling.h 2.0 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #ifndef MINDSPORE_CCSRC_PROFILER_DEVICE_ASCEND_PROFILING_H
  16. #define MINDSPORE_CCSRC_PROFILER_DEVICE_ASCEND_PROFILING_H
  17. #include <string>
  18. #include <memory>
  19. #include "profiler/device/profiling.h"
  20. #include "acl/acl_prof.h"
  21. namespace mindspore {
  22. namespace profiler {
  23. namespace ascend {
  24. class AscendProfiler : public Profiler {
  25. public:
  26. static std::shared_ptr<AscendProfiler> &GetInstance();
  27. AscendProfiler() : profiling_options_("") {}
  28. ~AscendProfiler() = default;
  29. AscendProfiler(const AscendProfiler &) = delete;
  30. AscendProfiler &operator=(const AscendProfiler &) = delete;
  31. void Init(const std::string &profileDataPath) { return; }
  32. void InitProfiling(const std::string &profiling_path, uint32_t device_id, const std::string &profiling_options);
  33. void Stop();
  34. void StepProfilingEnable(const bool enable_flag) override;
  35. void OpDataProducerEnd() { return; }
  36. void Start();
  37. bool GetProfilingEnableFlag() const { return enable_flag_; }
  38. std::string GetProfilingOptions() const { return profiling_options_; }
  39. void SaveProfileData() { return; }
  40. void ClearInst() { return; }
  41. uint64_t GetOptionsMask() const;
  42. aclprofAicoreMetrics GetAicMetrics() const;
  43. void Finalize() const;
  44. private:
  45. static std::shared_ptr<AscendProfiler> ascend_profiler_;
  46. std::string profiling_options_;
  47. uint32_t device_id_;
  48. aclprofConfig *acl_config_;
  49. };
  50. } // namespace ascend
  51. } // namespace profiler
  52. } // namespace mindspore
  53. #endif