-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cu
70 lines (59 loc) · 2.14 KB
/
main.cu
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "pmm.cu"
//#include "monolitic_mm.cu"
#include "pmm-utils.cuh"
using namespace std;
int main(int argc, char *argv[]){
size_t instant_size = 16 * 1024ULL * 1024ULL * 1024ULL;
//size_t instant_size = 8 * 1024ULL * 1024ULL * 1024ULL;
//size_t instant_size = 7 * 1024ULL * 1024ULL * 1024ULL;
int size_to_alloc = 32;
int iteration_num = 1;
int kernel_iter_num = 1;
int mono = 0;
int device_id = 0;
int block_size = 1024;
int cb_number = 100;
if (argc > 1){
size_to_alloc = atoi(argv[1]);
}
if (argc > 2){
mono = atoi(argv[2]);
}
if (argc > 3){
iteration_num = atoi(argv[3]);
}
if (argc > 4){
block_size = atoi(argv[4]);
}
if (argc > 5){
device_id = atoi(argv[5]);
}
if (argc > 6){
kernel_iter_num = atoi(argv[6]);
}
if (argc > 7){
cb_number = atoi(argv[7]);
}
printf("./a.out <B to alloc> <mono?> <#iters> <block_size> <device id> <kernel iters> <callback num>\n");
printf("./a.out %d %d %d %d %d %d %d\n",
size_to_alloc, mono, iteration_num, block_size, device_id, kernel_iter_num, cb_number);
cudaDeviceProp deviceProp;
GUARD_CU(cudaGetDeviceProperties(&deviceProp, 0));
int SMs = deviceProp.multiProcessorCount;
printf("max block number %d\n", SMs);
printf("instant size %ld\n", instant_size);
int size = (SMs-2)*(SMs-3)*(SMs-4);
int* sm_app = (int*)malloc(sizeof(int)*size);
int* sm_mm = (int*)malloc(sizeof(int)*size);
int* sm_gc = (int*)malloc(sizeof(int)*size);
int* allocs_size = (int*)malloc(sizeof(int)*size);
float* uni_req_per_sec = (float*)malloc(sizeof(float)*size);
int* array_size = new int(0);
pmm_init(mono, kernel_iter_num, size_to_alloc, &instant_size,
iteration_num, SMs, sm_app, sm_mm, sm_gc, allocs_size,
uni_req_per_sec, array_size, block_size, device_id, cb_number);
GUARD_CU(cudaDeviceReset());
GUARD_CU(cudaPeekAtLastError());
printf("DONE!\n");
return 0;
}