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.

event_pool.h 611 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include "megbrain/comp_node.h"
  3. namespace mgb {
  4. namespace imperative {
  5. class EventPool : CompNodeDepedentObject {
  6. CompNode::UnorderedMap<CompNode::EventPool> m_cn2pool;
  7. Spinlock m_lock;
  8. size_t m_flags;
  9. EventPool(size_t flags = 0);
  10. public:
  11. static EventPool& with_timer();
  12. static EventPool& without_timer();
  13. CompNode::Event* alloc(CompNode cn);
  14. std::shared_ptr<CompNode::Event> alloc_shared(CompNode cn);
  15. void free(CompNode::Event* event);
  16. std::shared_ptr<void> on_comp_node_finalize();
  17. ~EventPool();
  18. };
  19. } // namespace imperative
  20. } // namespace mgb

MegEngine 安装包中集成了使用 GPU 运行代码所需的 CUDA 环境,不用区分 CPU 和 GPU 版。 如果想要运行 GPU 程序,请确保机器本身配有 GPU 硬件设备并安装好驱动。 如果你想体验在云端 GPU 算力平台进行深度学习开发的感觉,欢迎访问 MegStudio 平台