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.

base.h 21 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. /**
  2. * \file dnn/include/megdnn/oprs/base.h
  3. * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  4. *
  5. * Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
  6. *
  7. * Unless required by applicable law or agreed to in writing,
  8. * software distributed under the License is distributed on an
  9. * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or
  10. * implied.
  11. */
  12. #pragma once
  13. #include <type_traits>
  14. #include "megdnn/basic_types.h"
  15. #include "megdnn/handle.h"
  16. #include "megdnn/internal/visibility_prologue.h"
  17. namespace megdnn {
  18. class Handle;
  19. /**
  20. * \brief base class for all operators
  21. *
  22. * This is an helper class. Users should not use OperatorBase directly.
  23. * Operators should be created by handle->create_opr<>().
  24. *
  25. * Each operator must provides the following constexpr values:
  26. *
  27. * * NR_INPUTS: number of input vars
  28. * * NR_OUTPUTS: number of output vars
  29. * * OPERATOR_TYPE: operator type as an enum
  30. *
  31. * If the operator has dynamic inputs or in_out param, the corresponding
  32. * NR_INPUTS is -1.
  33. *
  34. * For an operator whose NR_INPUTS >= 0 and NR_OUTPUTS >= 0, the operator must
  35. * also provide following methods:
  36. *
  37. * * void exec(_megdnn_in inputs..., _megdnn_tensor_out outputs...,
  38. * _megdnn_workspace workspace)
  39. * * void deduce_layout(const TensorLayout& inputs...,
  40. * TensorLayout& outputs...)
  41. * * size_t get_workspace_in_bytes(const TensorLayout &inputs...,
  42. * const TensorLayout &outputs)
  43. */
  44. class OperatorBase {
  45. public:
  46. explicit OperatorBase(Handle* handle) : m_handle(handle) {}
  47. virtual ~OperatorBase();
  48. //! get the handle from which this operator is created
  49. Handle* handle() const { return m_handle; }
  50. //! whether this opr guarantees that its exec() is thread-safe
  51. virtual bool is_thread_safe() const { return false; }
  52. /*!
  53. * \brief set the tracker to be used with MegcoreAsyncErrorInfo
  54. *
  55. * Most operators do not have async errors so this function has a
  56. * default empty implementation.
  57. */
  58. virtual void set_error_tracker(void*) {}
  59. private:
  60. Handle* m_handle;
  61. };
  62. namespace detail {
  63. /**
  64. * \brief AlgoSelectionStrategy is the advance information for selecting
  65. * algo
  66. */
  67. enum class AlgoSelectionStrategy {
  68. HEURISTIC = 0, //!< heristic to select the algos
  69. FAST_RUN = 1,
  70. FULL_RUN = 2,
  71. };
  72. /**
  73. * \brief separate algo by datatype for Matmul and conv
  74. */
  75. enum class AlgoDataType : uint32_t {
  76. FLOAT32 = 1 << 0,
  77. FLOAT16 = 1 << 1,
  78. QINT8X8X32 = 1 << 2,
  79. QUINT8X8X32 = 1 << 3,
  80. INT8X8X16 = 1 << 4,
  81. INT16X16X32 = 1 << 5,
  82. INT4X4X16 = 1 << 6,
  83. };
  84. /*!
  85. * \brief Abstract representation of an algorithm for implementing
  86. * the operator
  87. */
  88. class Algorithm {
  89. public:
  90. static constexpr uint32_t INVALID_ALGO_TYPE = static_cast<uint32_t>(-1);
  91. /**
  92. * \brief the attribe of the algo, such as REPRODUCIBLE, NAIVE
  93. *
  94. */
  95. enum class Attribute : uint32_t {
  96. /**
  97. * \brief general algo.
  98. */
  99. DEFAULT = 0,
  100. /**
  101. * \brief whether the execution result is
  102. * reproducible across multiple runs.
  103. */
  104. REPRODUCIBLE = 1 << 0,
  105. /**
  106. * \brief whether the algo is naive
  107. * Mark algorithms with simple implementation as NAIVE, so we can filter
  108. * these algorithms to speed up fastrun.
  109. * */
  110. NAIVE = 1 << 1,
  111. };
  112. /**
  113. * \brief Algorithm information, we can get real algo from
  114. * AlgorithmInfo::Info::Desc
  115. */
  116. struct Info {
  117. struct Desc {
  118. //! backend of the algo belonging to
  119. Handle::HandleType handle_type;
  120. //! indicate the real algo implementation
  121. uint32_t type = INVALID_ALGO_TYPE;
  122. //! serialized param of the algo type
  123. std::string param;
  124. bool valid() const { return type != INVALID_ALGO_TYPE; }
  125. void reset() { type = INVALID_ALGO_TYPE; }
  126. bool operator==(const Desc& rhs) const {
  127. return handle_type == rhs.handle_type && type == rhs.type &&
  128. param == rhs.param;
  129. }
  130. } desc;
  131. //! algorithm name
  132. std::string name;
  133. Attribute attribute;
  134. bool valid() const { return desc.valid(); }
  135. void reset() { desc.reset(); }
  136. //! desc donate the algo
  137. bool operator==(const Info& rhs) const { return desc == rhs.desc; }
  138. };
  139. virtual ~Algorithm() = default;
  140. /**
  141. * \brief get the attribute of the algo
  142. */
  143. virtual Attribute attribute() const = 0;
  144. virtual const char* name() const = 0;
  145. //! serialized param
  146. virtual std::string param() const { return {}; }
  147. virtual uint32_t type() const = 0;
  148. //! if algo contain all of the attribute in attr
  149. bool contain_attribute_all(const Attribute& attr) const;
  150. //! if algo contain any attribute in attr
  151. bool contain_attribute_any(const Attribute& attr) const;
  152. void check_attribute(
  153. const Attribute& positive_attr = Attribute::DEFAULT,
  154. const Attribute& negative_attr = Attribute::DEFAULT) const;
  155. static std::string attribute_str(const Attribute& attr);
  156. Handle::HandleType handle_type() const { return m_handle_type; }
  157. Info info() const {
  158. return {{handle_type(), type(), param()}, name(), attribute()};
  159. }
  160. Info::Desc desc() const { return {handle_type(), type(), param()}; }
  161. template <typename T>
  162. static void serialize_write_pod(const T& val, std::string& result) {
  163. static_assert(std::is_trivially_copyable<T>::value,
  164. "type should be trivially copyable");
  165. static_assert(!std::is_pointer<T>::value,
  166. "serialize pointer is unsafe in eager execution mode");
  167. result.append(reinterpret_cast<const char*>(&val), sizeof(T));
  168. }
  169. static void serialize_write_pod(const char* val, std::string& result) {
  170. result.append(val, strlen(val));
  171. }
  172. template <typename T>
  173. static T deserialize_read_pod(const std::string& data, size_t offset = 0) {
  174. static_assert(std::is_trivially_copyable<T>::value, "invalid type");
  175. T ret;
  176. //! A pointer to an object or incomplete type may be converted to a
  177. //! pointer to a different object or incomplete type. If the resulting
  178. //! pointer is not correctly aligned for the pointed-to type, the
  179. //! behavior is undefined.
  180. //!
  181. //! so here we should use memcpy instead of
  182. //! *reinterpret_cast<const T*>(&data[offset]);
  183. memcpy(&ret, data.data() + offset, sizeof(T));
  184. return ret;
  185. }
  186. template <typename T>
  187. static T deserialize_read_pod(const char* data, size_t offset = 0) {
  188. static_assert(std::is_trivially_copyable<T>::value, "invalid type");
  189. T ret;
  190. //! A pointer to an object or incomplete type may be converted to a
  191. //! pointer to a different object or incomplete type. If the resulting
  192. //! pointer is not correctly aligned for the pointed-to type, the
  193. //! behavior is undefined.
  194. //!
  195. //! so here we should use memcpy instead of
  196. //! *reinterpret_cast<const T*>(&data[offset]);
  197. memcpy(&ret, data + offset, sizeof(T));
  198. return ret;
  199. }
  200. enum class OprType : uint32_t {
  201. MATRIX_MUL_FORWARD,
  202. BATCHED_MATRIX_MUL_FORWARD,
  203. CONVOLUTION_FORWARD,
  204. CONVOLUTION_BACKWARD_DATA,
  205. CONVOLUTION_BACKWARD_FILTER,
  206. CONVOLUTION3D_FORWARD,
  207. CONVOLUTION3D_BACKWARD_DATA,
  208. CONVOLUTION3D_BACKWARD_FILTER,
  209. LOCAL_SHARE_FORWARD,
  210. LOCAL_SHARE_BACKWARD_DATA,
  211. LOCAL_SHARE_BACKWARD_FILTER,
  212. DEFORMABLE_CONV_FORWARD,
  213. DEFORMABLE_CONV_BACKWARD_DATA,
  214. DEFORMABLE_CONV_BACKWARD_FILTER,
  215. CONVBIAS_FORWARD,
  216. BATCH_CONV_FORWARD,
  217. };
  218. struct SearchItem {
  219. OprType opr_type;
  220. //! serialized param
  221. std::string param;
  222. TensorLayoutArray layouts;
  223. };
  224. /**
  225. * \brief get subopr list of the algo
  226. *
  227. * \param layouts origin layouts of the parent opr
  228. * \param opr parent opr
  229. */
  230. virtual std::vector<SearchItem> get_subopr_list(const TensorLayoutArray&,
  231. const OperatorBase*) const {
  232. return {};
  233. }
  234. protected:
  235. Handle::HandleType m_handle_type = Handle::HandleType::NAIVE;
  236. };
  237. MEGDNN_DEF_ENUM_CLASS_BIT_OPR(Algorithm::Attribute)
  238. //! policy for executing the operator
  239. struct ExecutionPolicy {
  240. //! INVALID_ALGO_TYPE algo_type means using heuristic
  241. Algorithm::Info::Desc algo;
  242. std::vector<ExecutionPolicy> sub_policy;
  243. };
  244. /*!
  245. * \brief define Algorithm and ExecutionPolicy for oprs that have
  246. * multiple impl algos
  247. *
  248. * \tparam Opr the operator class
  249. * \tparam nargs number of arguments
  250. */
  251. template <class Opr, int nargs>
  252. class MultiAlgoOpr;
  253. //! base def
  254. template <class Opr>
  255. class MultiAlgoOpr<Opr, -1> {
  256. public:
  257. using AlgorithmInfo = detail::Algorithm::Info;
  258. using AlgorithmDesc = detail::Algorithm::Info::Desc;
  259. using Algorithm = detail::Algorithm;
  260. /*!
  261. * \brief get a string representation for current algorithm set;
  262. *
  263. * get_all_algorithms() may return different algorithms only if
  264. * algorithm set name differs. This is used for checking cache
  265. * validity.
  266. */
  267. virtual const char* get_algorithm_set_name() const = 0;
  268. ExecutionPolicy& execution_policy() { return m_execution_policy; }
  269. const ExecutionPolicy& execution_policy() const {
  270. return m_execution_policy;
  271. }
  272. virtual Algorithm* get_algorithm_from_desc(const AlgorithmDesc&) = 0;
  273. protected:
  274. ~MultiAlgoOpr() = default;
  275. private:
  276. ExecutionPolicy m_execution_policy;
  277. };
  278. //! specialize for nargs == 3
  279. template <class Opr>
  280. class MultiAlgoOpr<Opr, 3> : public MultiAlgoOpr<Opr, -1> {
  281. public:
  282. using Algorithm = detail::Algorithm;
  283. using AlgorithmInfo = detail::Algorithm::Info;
  284. using AlgoAttribute = detail::Algorithm::Attribute;
  285. //! get all possible algorithm decriptions for the specified layouts
  286. std::vector<AlgorithmInfo> get_all_algorithms_info(const TensorLayout& p0,
  287. const TensorLayout& p1,
  288. const TensorLayout& p2) {
  289. std::vector<AlgorithmInfo> ret;
  290. for (auto&& algo : get_all_algorithms(p0, p1, p2)) {
  291. ret.emplace_back(algo->info());
  292. }
  293. return ret;
  294. }
  295. /**
  296. * \brief Returns the best algorithm information which indicate the
  297. * algorithm by heuristic.
  298. *
  299. * The selected algorithm should not use workspace more than
  300. * \p workspace_limit_in_bytes.
  301. */
  302. AlgorithmInfo get_algorithm_info_heuristic(
  303. const TensorLayout& p0, const TensorLayout& p1,
  304. const TensorLayout& p2,
  305. size_t workspace_limit_in_bytes =
  306. std::numeric_limits<size_t>::max(),
  307. const AlgoAttribute& positive_attr = AlgoAttribute::DEFAULT,
  308. const AlgoAttribute& negative_attr = AlgoAttribute::DEFAULT) {
  309. return get_algorithm_heuristic(p0, p1, p2, workspace_limit_in_bytes,
  310. positive_attr, negative_attr)
  311. ->info();
  312. }
  313. protected:
  314. ~MultiAlgoOpr() = default;
  315. //! get all possible algorithms for the specified layouts
  316. virtual std::vector<Algorithm*> get_all_algorithms(
  317. const TensorLayout& p0, const TensorLayout& p1,
  318. const TensorLayout& p2) = 0;
  319. /**
  320. * \brief Returns the best algorithm by heuristic.
  321. *
  322. * The selected algorithm should not use workspace more than
  323. * \p workspace_limit_in_bytes.
  324. */
  325. virtual Algorithm* get_algorithm_heuristic(
  326. const TensorLayout& p0, const TensorLayout& p1,
  327. const TensorLayout& p2,
  328. size_t workspace_limit_in_bytes =
  329. std::numeric_limits<size_t>::max(),
  330. const AlgoAttribute& positive_attr = AlgoAttribute::DEFAULT,
  331. const AlgoAttribute& negative_attr = AlgoAttribute::DEFAULT) = 0;
  332. };
  333. //! specializae for nargs == 4
  334. template <class Opr>
  335. class MultiAlgoOpr<Opr, 4> : public MultiAlgoOpr<Opr, -1> {
  336. public:
  337. using Algorithm = detail::Algorithm;
  338. using AlgorithmInfo = detail::Algorithm::Info;
  339. using AlgoAttribute = detail::Algorithm::Attribute;
  340. //! get all possible algorithm decriptions for the specified layouts
  341. std::vector<AlgorithmInfo> get_all_algorithms_info(const TensorLayout& p0,
  342. const TensorLayout& p1,
  343. const TensorLayout& p2,
  344. const TensorLayout& p3) {
  345. std::vector<AlgorithmInfo> ret;
  346. for (auto&& algo : get_all_algorithms(p0, p1, p2, p3)) {
  347. ret.emplace_back(algo->info());
  348. }
  349. return ret;
  350. }
  351. /**
  352. * \brief Returns the best algorithm information which indicate the
  353. * algorithm by heuristic.
  354. *
  355. * The selected algorithm should not use workspace more than
  356. * \p workspace_limit_in_bytes.
  357. */
  358. AlgorithmInfo get_algorithm_info_heuristic(
  359. const TensorLayout& p0, const TensorLayout& p1,
  360. const TensorLayout& p2, const TensorLayout& p3,
  361. size_t workspace_limit_in_bytes =
  362. std::numeric_limits<size_t>::max(),
  363. const AlgoAttribute& positive_attr = AlgoAttribute::DEFAULT,
  364. const AlgoAttribute& negative_attr = AlgoAttribute::DEFAULT) {
  365. return get_algorithm_heuristic(p0, p1, p2, p3, workspace_limit_in_bytes,
  366. positive_attr, negative_attr)
  367. ->info();
  368. }
  369. protected:
  370. ~MultiAlgoOpr() = default;
  371. //! get all possible algorithms for the specified layouts
  372. virtual std::vector<Algorithm*> get_all_algorithms(
  373. const TensorLayout& p0, const TensorLayout& p1,
  374. const TensorLayout& p2, const TensorLayout& p3) = 0;
  375. /**
  376. * \brief Returns the best algorithm by heuristic.
  377. *
  378. * The selected algorithm should not use workspace more than
  379. * \p workspace_limit_in_bytes.
  380. */
  381. virtual Algorithm* get_algorithm_heuristic(
  382. const TensorLayout& p0, const TensorLayout& p1,
  383. const TensorLayout& p2, const TensorLayout& p3,
  384. size_t workspace_limit_in_bytes =
  385. std::numeric_limits<size_t>::max(),
  386. const AlgoAttribute& positive_attr = AlgoAttribute::DEFAULT,
  387. const AlgoAttribute& negative_attr = AlgoAttribute::DEFAULT) = 0;
  388. };
  389. //! specializae for nargs == 5
  390. template <class Opr>
  391. class MultiAlgoOpr<Opr, 5> : public MultiAlgoOpr<Opr, -1> {
  392. public:
  393. using Algorithm = detail::Algorithm;
  394. using AlgorithmInfo = detail::Algorithm::Info;
  395. using AlgoAttribute = detail::Algorithm::Attribute;
  396. //! get all possible algorithm decriptions for the specified layouts
  397. std::vector<AlgorithmInfo> get_all_algorithms_info(const TensorLayout& p0,
  398. const TensorLayout& p1,
  399. const TensorLayout& p2,
  400. const TensorLayout& p3,
  401. const TensorLayout& p4) {
  402. std::vector<AlgorithmInfo> ret;
  403. for (auto&& algo : get_all_algorithms(p0, p1, p2, p3, p4)) {
  404. ret.emplace_back(algo->info());
  405. }
  406. return ret;
  407. }
  408. /**
  409. * \brief Returns the best algorithm information which indicate the
  410. * algorithm by heuristic.
  411. *
  412. * The selected algorithm should not use workspace more than
  413. * \p workspace_limit_in_bytes.
  414. */
  415. AlgorithmInfo get_algorithm_info_heuristic(
  416. const TensorLayout& p0, const TensorLayout& p1,
  417. const TensorLayout& p2, const TensorLayout& p3,
  418. const TensorLayout& p4,
  419. size_t workspace_limit_in_bytes =
  420. std::numeric_limits<size_t>::max(),
  421. const AlgoAttribute& positive_attr = AlgoAttribute::DEFAULT,
  422. const AlgoAttribute& negative_attr = AlgoAttribute::DEFAULT) {
  423. return get_algorithm_heuristic(p0, p1, p2, p3, p4,
  424. workspace_limit_in_bytes, positive_attr,
  425. negative_attr)
  426. ->info();
  427. }
  428. protected:
  429. ~MultiAlgoOpr() = default;
  430. //! get all possible algorithms for the specified layouts
  431. virtual std::vector<Algorithm*> get_all_algorithms(
  432. const TensorLayout& p0, const TensorLayout& p1,
  433. const TensorLayout& p2, const TensorLayout& p3,
  434. const TensorLayout& p4) = 0;
  435. /**
  436. * \brief Returns the best algorithm by heuristic.
  437. *
  438. * The selected algorithm should not use workspace more than
  439. * \p workspace_limit_in_bytes.
  440. */
  441. virtual Algorithm* get_algorithm_heuristic(
  442. const TensorLayout& p0, const TensorLayout& p1,
  443. const TensorLayout& p2, const TensorLayout& p3,
  444. const TensorLayout& p4,
  445. size_t workspace_limit_in_bytes =
  446. std::numeric_limits<size_t>::max(),
  447. const AlgoAttribute& positive_attr = AlgoAttribute::DEFAULT,
  448. const AlgoAttribute& negative_attr = AlgoAttribute::DEFAULT) = 0;
  449. };
  450. //! specializae for nargs == 8
  451. template <class Opr>
  452. class MultiAlgoOpr<Opr, 8> : public MultiAlgoOpr<Opr, -1> {
  453. public:
  454. using Algorithm = detail::Algorithm;
  455. using AlgorithmInfo = detail::Algorithm::Info;
  456. using AlgoAttribute = detail::Algorithm::Attribute;
  457. //! get all possible algorithm decriptions for the specified layouts
  458. std::vector<AlgorithmInfo> get_all_algorithms_info(
  459. const TensorLayout& p0, const TensorLayout& p1,
  460. const TensorLayout& p2, const TensorLayout& p3,
  461. const TensorLayout& p4, const TensorLayout& p5,
  462. const TensorLayout& p6, const TensorLayout& p7) {
  463. std::vector<AlgorithmInfo> ret;
  464. for (auto&& algo : get_all_algorithms(p0, p1, p2, p3, p4, p5, p6, p7)) {
  465. ret.emplace_back(algo->info());
  466. }
  467. return ret;
  468. }
  469. /**
  470. * \brief Returns the best algorithm information which indicate the
  471. * algorithm by heuristic.
  472. *
  473. * The selected algorithm should not use workspace more than
  474. */
  475. AlgorithmInfo get_algorithm_info_heuristic(
  476. const TensorLayout& p0, const TensorLayout& p1,
  477. const TensorLayout& p2, const TensorLayout& p3,
  478. const TensorLayout& p4, const TensorLayout& p5,
  479. const TensorLayout& p6, const TensorLayout& p7,
  480. size_t workspace_limit_in_bytes =
  481. std::numeric_limits<size_t>::max(),
  482. const AlgoAttribute& positive_attr = AlgoAttribute::DEFAULT,
  483. const AlgoAttribute& negative_attr = AlgoAttribute::DEFAULT) {
  484. return get_algorithm_heuristic(p0, p1, p2, p3, p4, p5, p6, p7,
  485. workspace_limit_in_bytes, positive_attr,
  486. negative_attr)
  487. ->info();
  488. }
  489. protected:
  490. ~MultiAlgoOpr() = default;
  491. //! get all possible algorithms for the specified layouts
  492. virtual std::vector<Algorithm*> get_all_algorithms(
  493. const TensorLayout& p0, const TensorLayout& p1,
  494. const TensorLayout& p2, const TensorLayout& p3,
  495. const TensorLayout& p4, const TensorLayout& p5,
  496. const TensorLayout& p6, const TensorLayout& p7) = 0;
  497. /**
  498. * \brief Returns the best algorithm by heuristic.
  499. *
  500. * The selected algorithm should not use workspace more than
  501. * \p workspace_limit_in_bytes.
  502. */
  503. virtual Algorithm* get_algorithm_heuristic(
  504. const TensorLayout& p0, const TensorLayout& p1,
  505. const TensorLayout& p2, const TensorLayout& p3,
  506. const TensorLayout& p4, const TensorLayout& p5,
  507. const TensorLayout& p6, const TensorLayout& p7,
  508. size_t workspace_limit_in_bytes =
  509. std::numeric_limits<size_t>::max(),
  510. const AlgoAttribute& positive_attr = AlgoAttribute::DEFAULT,
  511. const AlgoAttribute& negative_attr = AlgoAttribute::DEFAULT) = 0;
  512. };
  513. } // namespace detail
  514. using Algorithm = detail::Algorithm;
  515. using AlgoAttribute = Algorithm::Attribute;
  516. using ExecutionPolicy = detail::ExecutionPolicy;
  517. } // namespace megdnn
  518. #include "megdnn/internal/visibility_epilogue.h"
  519. // vim: syntax=cpp.doxygen

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