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.

megbrain_config.h 2.2 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * \file python_module/src/cpp/megbrain_config.h
  3. *
  4. * This file is part of MegBrain, a deep learning framework developed by Megvii.
  5. *
  6. * \copyright Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
  7. *
  8. */
  9. #ifndef SWIG
  10. #pragma once
  11. #include "megbrain_build_config.h"
  12. #include "./megbrain_wrap.h"
  13. #include <Python.h>
  14. using mgb::cg::SymbolVar;
  15. #endif
  16. //! wrap by a class so swig can put the functions in a namespace
  17. class _config {
  18. public:
  19. static bool set_comp_graph_option(
  20. CompGraph &cg, const std::string &name, int val_int);
  21. static bool comp_graph_is_eager(CompGraph &cg);
  22. static void add_extra_vardep(
  23. const SymbolVar &var, const SymbolVar &dep);
  24. static void begin_set_opr_priority(
  25. CompGraph &cg, int priority);
  26. static void end_set_opr_priority(CompGraph &cg);
  27. static void begin_set_exc_opr_tracker(
  28. CompGraph &cg, PyObject *tracker);
  29. static void end_set_exc_opr_tracker(CompGraph &cg);
  30. //! return (opr_msg, fwd tracker, grad tracker) or None
  31. static PyObject* get_opr_tracker(CompGraph &cg, size_t var_id);
  32. static void set_opr_sublinear_memory_endpoint(const SymbolVar &var);
  33. static void set_fork_cuda_warning_flag(int flag);
  34. static bool is_cuda_ctx_set();
  35. //! get cuda gencode strings for local devices
  36. static std::string get_cuda_gencode();
  37. //! get cuda lib paths.
  38. static std::vector<std::string> get_cuda_lib_path();
  39. //! get cuda include paths.
  40. static std::vector<std::string> get_cuda_include_path();
  41. //! get cuda version
  42. static int get_cuda_version();
  43. static bool is_compiled_with_cuda();
  44. static void load_opr_library(
  45. const char* self_path, const char* lib_path);
  46. static std::vector<std::pair<uint64_t, std::string>>
  47. dump_registered_oprs();
  48. static int create_mm_server(const std::string& server_addr, int port);
  49. static void group_barrier(const std::string& server_addr,
  50. int port, uint32_t size, uint32_t rank);
  51. };
  52. // vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}

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