Skip to content

Commit 463fb4b

Browse files
committed
Updated the performance comparison hip
1 parent 7db63a8 commit 463fb4b

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

modules/module1/examples/05_performance_comparison_hip.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
#include <chrono>
55
#include <math.h>
66

7+
// HIP error checking macro
8+
#define HIP_CHECK(call) \
9+
do { \
10+
hipError_t error = call; \
11+
if (error != hipSuccess) { \
12+
fprintf(stderr, "HIP error at %s:%d - %s\n", __FILE__, __LINE__, \
13+
hipGetErrorString(error)); \
14+
exit(EXIT_FAILURE); \
15+
} \
16+
} while(0)
17+
718
// CPU version of vector addition
819
void addVectorsCPU(float *a, float *b, float *c, int n) {
920
for (int i = 0; i < n; i++) {
@@ -64,16 +75,6 @@ class CpuTimer {
6475
}
6576
};
6677

67-
#define HIP_CHECK(call) \
68-
do { \
69-
hipError_t error = call; \
70-
if (error != hipSuccess) { \
71-
fprintf(stderr, "HIP error at %s:%d - %s\n", __FILE__, __LINE__, \
72-
hipGetErrorString(error)); \
73-
exit(EXIT_FAILURE); \
74-
} \
75-
} while(0)
76-
7778
int main() {
7879
// Get device information
7980
int device;

0 commit comments

Comments
 (0)