MCPcopy Create free account
hub / github.com/apache/singa / TEST

Function TEST

test/singa/test_memory.cc:69–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67*/
68
69TEST(MemPool, CompareCudaCnmem) {
70 singa::CudaMemPool cudaPool;
71 singa::CnMemPool cnPool;
72
73 int numOfTests = 5000;
74 int allocSize = 32;
75
76 singa::DeviceMemPool* pool = NULL;
77 pool = &cnPool;
78
79 CUDA_CHECK(cudaSetDevice(0));
80 singa::Timer tick;
81 for (int i = 0; i < numOfTests; i++) {
82 int* memPtrs = NULL;
83 pool->Malloc((void**)&memPtrs, allocSize);
84 pool->Free(memPtrs);
85 }
86 tick.Tick();
87 int cn_time = tick.Elapsed();
88
89 pool = &cudaPool;
90 for (int i = 0; i < numOfTests; i++) {
91 int* memPtrs = NULL;
92 pool->Malloc((void**)&memPtrs, allocSize);
93 pool->Free(memPtrs);
94 }
95 tick.Tick();
96 int cuda_time = tick.Elapsed();
97 EXPECT_GE(cuda_time, cn_time);
98}
99#endif // USE_CUDA

Callers

nothing calls this directly

Calls 4

TickMethod · 0.80
ElapsedMethod · 0.80
MallocMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected