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

Function TEST

dnn/test/common/megcore/device.cpp:5–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <gtest/gtest.h>
4#include "test/common/utils.h"
5TEST(MegcoreCPU, DEVICE) {
6 megcoreDeviceHandle_t handle;
7 megcoreCreateDeviceHandle(&handle, megcorePlatformCPU, -1, 0);
8
9 int deviceID;
10 megcoreGetDeviceID(handle, &deviceID);
11 ASSERT_EQ(-1, deviceID);
12
13 megcorePlatform_t platform;
14 megcoreGetPlatform(handle, &platform);
15 ASSERT_EQ(megcorePlatformCPU, platform);
16
17 unsigned int flags;
18 megcoreGetDeviceFlags(handle, &flags);
19 ASSERT_EQ(0u, flags);
20
21 size_t memAlignmentInBytes;
22 megcoreGetMemAlignment(handle, &memAlignmentInBytes);
23
24 megcoreActivate(handle);
25
26 void* ptr;
27 megcoreMalloc(handle, &ptr, 256);
28 megcoreFree(handle, ptr);
29
30 megcoreDestroyDeviceHandle(handle);
31}
32// vim: syntax=cpp.doxygen

Callers

nothing calls this directly

Calls 9

megcoreGetDeviceIDFunction · 0.85
megcoreGetPlatformFunction · 0.85
megcoreGetDeviceFlagsFunction · 0.85
megcoreGetMemAlignmentFunction · 0.85
megcoreActivateFunction · 0.85
megcoreMallocFunction · 0.85
megcoreFreeFunction · 0.85

Tested by

no test coverage detected