Skip to content

Commit 8110cfc

Browse files
committed
Changed macro names: START_RANGE -> PUSH_RANGE and END_RANGE -> POP_RANGE to be less confusing
1 parent a981654 commit 8110cfc

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

posts/nvtx/manual_nvtx.cu

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const uint32_t colors[] = { 0x0000ff00, 0x000000ff, 0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x00ff0000, 0x00ffffff };
77
const int num_colors = sizeof(colors)/sizeof(uint32_t);
88

9-
#define START_RANGE(name,cid) { \
9+
#define PUSH_RANGE(name,cid) { \
1010
int color_id = cid; \
1111
color_id = color_id%num_colors;\
1212
nvtxEventAttributes_t eventAttrib = {0}; \
@@ -18,10 +18,10 @@ const int num_colors = sizeof(colors)/sizeof(uint32_t);
1818
eventAttrib.message.ascii = name; \
1919
nvtxRangePushEx(&eventAttrib); \
2020
}
21-
#define END_RANGE nvtxRangePop();
21+
#define POP_RANGE nvtxRangePop();
2222
#else
23-
#define START_RANGE(name,cid)
24-
#define END_RANGE
23+
#define PUSH_RANGE(name,cid)
24+
#define POP_RANGE
2525
#endif
2626

2727
__global__ void init_data_kernel( int n, double* x)
@@ -57,17 +57,17 @@ __global__ void check_results_kernel( int n, double correctvalue, double * x )
5757

5858
void init_host_data( int n, double * x )
5959
{
60-
START_RANGE("init_host_data",1)
60+
PUSH_RANGE("init_host_data",1)
6161
for (int i=0; i<n; ++i)
6262
{
6363
x[i] = i;
6464
}
65-
END_RANGE
65+
POP_RANGE
6666
}
6767

6868
void init_data(int n, double* x, double* x_d, double* y_d)
6969
{
70-
START_RANGE("init_data",2)
70+
PUSH_RANGE("init_data",2)
7171
cudaStream_t copy_stream;
7272
cudaStream_t compute_stream;
7373
cudaStreamCreate(&copy_stream);
@@ -81,27 +81,27 @@ void init_data(int n, double* x, double* x_d, double* y_d)
8181

8282
cudaStreamDestroy(compute_stream);
8383
cudaStreamDestroy(copy_stream);
84-
END_RANGE
84+
POP_RANGE
8585
}
8686

8787
void daxpy(int n, double a, double* x_d, double* y_d)
8888
{
89-
START_RANGE("daxpy",3)
89+
PUSH_RANGE("daxpy",3)
9090
daxpy_kernel<<<ceil(n/256),256>>>(n,a,x_d,y_d);
9191
cudaDeviceSynchronize();
92-
END_RANGE
92+
POP_RANGE
9393
}
9494

9595
void check_results( int n, double correctvalue, double* x_d )
9696
{
97-
START_RANGE("check_results",4)
97+
PUSH_RANGE("check_results",4)
9898
check_results_kernel<<<ceil(n/256),256>>>(n,correctvalue,x_d);
99-
END_RANGE
99+
POP_RANGE
100100
}
101101

102102
void run_test(int n)
103103
{
104-
START_RANGE("run_test",0)
104+
PUSH_RANGE("run_test",0)
105105
double* x;
106106
double* x_d;
107107
double* y_d;
@@ -122,7 +122,7 @@ void run_test(int n)
122122
cudaFree(x_d);
123123
cudaFreeHost(x);
124124
cudaDeviceSynchronize();
125-
END_RANGE
125+
POP_RANGE
126126
}
127127

128128
int main()

0 commit comments

Comments
 (0)