forked from hvcl-old/hetero13
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwbInit.cpp
49 lines (33 loc) · 861 Bytes
/
wbInit.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <wb.h>
#include <wbCUDA.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cuda_runtime_api.h>
#ifndef WB_DEFAULT_HEAP_SIZE
#define WB_DEFAULT_HEAP_SIZE (1024*1024*120)
#endif /* WB_DEFAULT_HEAP_SIZE */
static bool _initializedQ = wbFalse;
#ifndef _MSC_VER
__attribute__ ((__constructor__))
#endif /* _MSC_VER */
void wb_init(void) {
if (_initializedQ == wbTrue) {
return ;
}
// cuInit(0);
#ifdef WB_USE_CUSTOM_MALLOC
wbMemoryManager_new(WB_DEFAULT_HEAP_SIZE);
#endif /* WB_USE_CUSTOM_MALLOC */
#ifdef _MSC_VER
QueryPerformanceFrequency((LARGE_INTEGER*) &_hrtime_frequency);
#endif
_timer = wbTimer_new();
_logger = wbLogger_new();
_initializedQ = wbTrue;
wbFile_init();
#ifdef WB_USE_SANDBOX
wbSandbox_new();
#endif
solutionJSON = NULL;
atexit(wb_atExit);
}