forked from ekondis/mixbench
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain-hip.cpp
More file actions
44 lines (33 loc) · 981 Bytes
/
main-hip.cpp
File metadata and controls
44 lines (33 loc) · 981 Bytes
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
/**
* main-hip.cpp: This file is part of the mixbench GPU micro-benchmark suite.
*
* Contact: Elias Konstantinidis <ekondis@gmail.com>
**/
#include <stdio.h>
#include <stdlib.h>
#include <hip/hip_runtime.h>
#include <string.h>
#include "lhiputil.h"
#include "mix_kernels_hip.h"
#include "version_info.h"
#define VECTOR_SIZE (8*1024*1024)
void init_vector(double *v, size_t datasize){
for(int i=0; i<(int)datasize; i++)
v[i] = i;
}
int main(int argc, char* argv[]) {
printf("mixbench-hip/alternating (%s)\n", VERSION_INFO);
unsigned int datasize = VECTOR_SIZE*sizeof(double);
hipSetDevice(0);
StoreDeviceInfo(stdout);
size_t freeCUDAMem, totalCUDAMem;
hipMemGetInfo(&freeCUDAMem, &totalCUDAMem);
printf("Total GPU memory %lu, free %lu\n", totalCUDAMem, freeCUDAMem);
printf("Buffer size: %dMB\n", datasize/(1024*1024));
double *c;
c = (double*)malloc(datasize);
init_vector(c, VECTOR_SIZE);
mixbenchGPU(c, VECTOR_SIZE);
free(c);
return 0;
}