MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / CompNode

Class CompNode

src/core/include/megbrain/comp_node.h:53–670  ·  view source on GitHub ↗

! * \brief abstraction of a streaming computing resource on localhost (a * thread on CPU, a cuda stream, etc.) * * Note that most of the operations are asynchronous with respect to the caller * thread */

Source from the content-addressed store, hash-verified

51 * thread
52 */
53class CompNode {
54public:
55 //! computing device type
56 enum class DeviceType {
57 //! for "xpu" comp node that would mapped to available cn on
58 //! current system
59 UNSPEC = 0,
60
61 CUDA = 1,
62 CPU = 2,
63 CAMBRICON = 3,
64 ROCM = 8,
65 ATLAS = 9,
66 MULTITHREAD = 11,
67 MAX_DEVICE_ID,
68 };
69 static constexpr size_t NR_DEVICE_TYPE =
70 static_cast<size_t>(DeviceType::MAX_DEVICE_ID);
71
72 struct DeviceProperties {
73 DeviceProperties() {
74 name = "unspec";
75 total_memory = major = minor = 0;
76 }
77
78 std::string name;
79 size_t total_memory;
80
81 //! for cuda
82 int major;
83 int minor;
84 };
85
86 /*!
87 * \brief an identifier to specify a computing node
88 *
89 * Note: logical locator is directly parsed from a string identifier
90 * given by user; it should be translated to physical locator by calling
91 * to_physical() before actual use.
92 *
93 * Unless explicitly specified otherwise, all locators are physical
94 * locators.
95 */
96 struct Locator {
97 /*!
98 * \brief special device number for the "cpu default" comp node,
99 * which dispatches all tasks in the caller thread
100 */
101 static constexpr int DEVICE_CPU_DEFAULT = -1024;
102 /*!
103 * \brief special device number for the "multithread_default"
104 * comp node, which dispatches all tasks to thread pool and the
105 * caller thread is the main thread of thread pool
106 */
107 static constexpr int DEVICE_MULTITHREAD_DEFAULT = -1025;
108
109 DeviceType type = DeviceType::UNSPEC;
110

Callers 15

get_mem_status_bytesFunction · 0.85
get_allocated_memoryFunction · 0.85
get_reserved_memoryFunction · 0.85
get_max_reserved_memoryFunction · 0.85
get_max_allocated_memoryFunction · 0.85
_log_cn_mem_pool_detailsFunction · 0.85
__init__Method · 0.85
convert_params_to_xlaMethod · 0.85
executeMethod · 0.85
test_gaussian_opFunction · 0.85
test_uniform_opFunction · 0.85

Calls

no outgoing calls

Tested by 10

test_gaussian_opFunction · 0.68
test_uniform_opFunction · 0.68
test_gamma_opFunction · 0.68
test_beta_opFunction · 0.68
test_poisson_opFunction · 0.68
test_multinomial_opFunction · 0.68
test_exponential_opFunction · 0.68
test_subgraphFunction · 0.68