Skip to content

Commit

Permalink
Unify MarkerAPI names, LIKWID_NVMARKER_* -> NVMON_MARKER_*
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTheBear committed Nov 13, 2024
1 parent 8b0d8ff commit 42f2b7d
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 57 deletions.
16 changes: 8 additions & 8 deletions doc/likwid-perfctr.1
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ This runs the application in NvMarkerAPI mode on GPUs 0 and 1 and measures the s
#include <likwid-marker.h>

/* Initialize the library and add configured eventset */
LIKWID_NVMARKER_INIT;
NVMON_MARKER_INIT;

/* If you run the code region only once, register
* the region tag previously to reduce the overhead
Expand All @@ -315,12 +315,12 @@ LIKWID_NVMARKER_INIT;
* Note: No whitespace characters are allowed in the region tags
* This call is optional but RECOMMENDED, START will do the same operations.
*/
LIKWID_NVMARKER_REGISTER("name");
NVMON_MARKER_REGISTER("name");

/* Start measurement on Nvidia GPUs
* Note: No whitespace characters are allowed in the region tags
*/
LIKWID_NVMARKER_START("name");
NVMON_MARKER_START("name");
/*
* Your code to be measured is here
* You can also nest named regions
Expand All @@ -329,12 +329,12 @@ LIKWID_NVMARKER_START("name");
/* Stop measurment on Nvidia GPUs
* No whitespaces are allowed in the region names!
*/
LIKWID_NVMARKER_STOP("name");
NVMON_MARKER_STOP("name");

/* If you want to measure multiple groups/event sets
* Switches through groups in round-robin fashion.
*/
LIKWID_NVMARKER_SWITCH;
NVMON_MARKER_SWITCH;

/* If you want to get the data of a region inside your application
* nevents in an (int*) and used as input length of the events array. After the
Expand All @@ -343,14 +343,14 @@ LIKWID_NVMARKER_SWITCH;
* retrieve the measured runtime of the region and count is a pointer to int
* and is filled with the call count of the region.
*/
LIKWID_NVMARKER_GET("name", ngpus, nevents, events, time, count);
NVMON_MARKER_GET("name", ngpus, nevents, events, time, count);

/* If you want to reset the counts for a region
*/
LIKWID_NVMARKER_RESET("name");
NVMON_MARKER_RESET("name");

/* Finally */
LIKWID_NVMARKER_CLOSE;
NVMON_MARKER_CLOSE;
.fi


Expand Down
60 changes: 30 additions & 30 deletions src/includes/likwid-marker.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,43 +107,43 @@ Shortcut for likwid_markerWriteFile() if compiled with -DLIKWID_PERFMON. Otherwi
* @{
*/
/*!
\def LIKWID_NVMARKER_INIT
\def NVMON_MARKER_INIT
Shortcut for nvmon_markerInit() if compiled with -DLIKWID_PERFMON. Otherwise no operation is performed
*/
/*!
\def LIKWID_NVMARKER_THREADINIT
\def NVMON_MARKER_THREADINIT
No operation is performed, this macro exists only to be similar as CPU MarkerAPI
*/
/*!
\def LIKWID_NVMARKER_REGISTER(regionTag)
\def NVMON_MARKER_REGISTER(regionTag)
Shortcut for nvmon_markerRegisterRegion() with \a regionTag if compiled with -DLIKWID_NVMON. Otherwise no operation is performed
*/
/*!
\def LIKWID_NVMARKER_START(regionTag)
\def NVMON_MARKER_START(regionTag)
Shortcut for nvmon_markerStartRegion() with \a regionTag if compiled with -DLIKWID_NVMON. Otherwise no operation is performed
*/
/*!
\def LIKWID_NVMARKER_STOP(regionTag)
\def NVMON_MARKER_STOP(regionTag)
Shortcut for nvmon_markerStopRegion() with \a regionTag if compiled with -DLIKWID_NVMON. Otherwise no operation is performed
*/
/*!
\def LIKWID_NVMARKER_GET(regionTag, ngpus, nevents, events, time, count)
\def NVMON_MARKER_GET(regionTag, ngpus, nevents, events, time, count)
Shortcut for nvmon_markerGetRegion() for \a regionTag if compiled with -DLIKWID_NVMON. Otherwise no operation is performed
*/
/*!
\def LIKWID_NVMARKER_SWITCH
\def NVMON_MARKER_SWITCH
Shortcut for nvmon_markerNextGroup() if compiled with -DLIKWID_NVMON. Otherwise no operation is performed
*/
/*!
\def LIKWID_NVMARKER_RESET(regionTag)
\def NVMON_MARKER_RESET(regionTag)
Shortcut for nvmon_markerResetRegion() if compiled with -DLIKWID_NVMON. Otherwise no operation is performed
*/
/*!
\def LIKWID_NVMARKER_CLOSE
\def NVMON_MARKER_CLOSE
Shortcut for nvmon_markerClose() if compiled with -DLIKWID_NVMON. Otherwise no operation is performed
*/
/*!
\def LIKWID_NVMARKER_WRITE_FILE
\def NVMON_MARKER_WRITE_FILE
Shortcut for nvmon_markerWriteFile() with \a filename if compiled with -DLIKWID_NVMON. Otherwise no operation is performed
*/
/** @}*/
Expand All @@ -153,29 +153,29 @@ Shortcut for nvmon_markerWriteFile() with \a filename if compiled with -DLIKWID_
#define LIKWID_WITH_NVMON
#endif
#include <likwid.h>
#define LIKWID_NVMARKER_INIT nvmon_markerInit()
#define LIKWID_NVMARKER_THREADINIT
#define LIKWID_NVMARKER_SWITCH nvmon_markerNextGroup()
#define LIKWID_NVMARKER_REGISTER(regionTag) nvmon_markerRegisterRegion(regionTag)
#define LIKWID_NVMARKER_START(regionTag) nvmon_markerStartRegion(regionTag)
#define LIKWID_NVMARKER_STOP(regionTag) nvmon_markerStopRegion(regionTag)
#define LIKWID_NVMARKER_CLOSE nvmon_markerClose()
#define LIKWID_NVMARKER_RESET(regionTag) nvmon_markerResetRegion(regionTag)
#define LIKWID_NVMARKER_GET(regionTag, ngpus, nevents, events, time, count) \
#define NVMON_MARKER_INIT nvmon_markerInit()
#define NVMON_MARKER_THREADINIT
#define NVMON_MARKER_SWITCH nvmon_markerNextGroup()
#define NVMON_MARKER_REGISTER(regionTag) nvmon_markerRegisterRegion(regionTag)
#define NVMON_MARKER_START(regionTag) nvmon_markerStartRegion(regionTag)
#define NVMON_MARKER_STOP(regionTag) nvmon_markerStopRegion(regionTag)
#define NVMON_MARKER_CLOSE nvmon_markerClose()
#define NVMON_MARKER_RESET(regionTag) nvmon_markerResetRegion(regionTag)
#define NVMON_MARKER_GET(regionTag, ngpus, nevents, events, time, count) \
nvmon_markerGetRegion(regionTag, ngpus, nevents, events, time, count)
#define LIKWID_NVMARKER_WRITE_FILE(markerfile) \
#define NVMON_MARKER_WRITE_FILE(markerfile) \
nvmon_markerWriteFile(markerfile)
#else /* LIKWID_NVMON */
#define LIKWID_NVMARKER_INIT
#define LIKWID_NVMARKER_THREADINIT
#define LIKWID_NVMARKER_SWITCH
#define LIKWID_NVMARKER_REGISTER(regionTag)
#define LIKWID_NVMARKER_START(regionTag)
#define LIKWID_NVMARKER_STOP(regionTag)
#define LIKWID_NVMARKER_CLOSE
#define LIKWID_NVMARKER_GET(regionTag, nevents, events, time, count)
#define LIKWID_NVMARKER_RESET(regionTag)
#define LIKWID_NVMARKER_WRITE_FILE(markerfile)
#define NVMON_MARKER_INIT
#define NVMON_MARKER_THREADINIT
#define NVMON_MARKER_SWITCH
#define NVMON_MARKER_REGISTER(regionTag)
#define NVMON_MARKER_START(regionTag)
#define NVMON_MARKER_STOP(regionTag)
#define NVMON_MARKER_CLOSE
#define NVMON_MARKER_GET(regionTag, nevents, events, time, count)
#define NVMON_MARKER_RESET(regionTag)
#define NVMON_MARKER_WRITE_FILE(markerfile)
#endif /* LIKWID_NVMON */


Expand Down
28 changes: 14 additions & 14 deletions test/stream.cu
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ int main(int argn, char** argc)
printf("Using likwid\n");
#endif

LIKWID_NVMARKER_INIT;
NVMON_MARKER_INIT;

dim3 dimBlock(blockSize);
dim3 dimGrid(SIZE/dimBlock.x );
Expand All @@ -159,52 +159,52 @@ int main(int argn, char** argc)
initKernel<<<dimGrid,dimBlock>>>(d, 1.0, SIZE);
cudaDeviceSynchronize();

LIKWID_NVMARKER_REGISTER("copy");
LIKWID_NVMARKER_REGISTER("scale");
LIKWID_NVMARKER_REGISTER("add");
LIKWID_NVMARKER_REGISTER("triad");
NVMON_MARKER_REGISTER("copy");
NVMON_MARKER_REGISTER("scale");
NVMON_MARKER_REGISTER("add");
NVMON_MARKER_REGISTER("triad");


time_start(&timer);
for (int k=0; k<ITER; k++)
{
LIKWID_NVMARKER_START("copy");
NVMON_MARKER_START("copy");
Copykernel<<<dimGrid,dimBlock>>>(a, c, SIZE);
cudaDeviceSynchronize();
LIKWID_NVMARKER_STOP("copy");
NVMON_MARKER_STOP("copy");
}
time_stop(&timer);
copy_time = time_print(&timer)/(double)ITER;

time_start(&timer);
for (int k=0; k<ITER; k++)
{
LIKWID_NVMARKER_START("scale");
NVMON_MARKER_START("scale");
Scalekernel<<<dimGrid,dimBlock>>>(b, c, scalar, SIZE);
cudaDeviceSynchronize();
LIKWID_NVMARKER_STOP("scale");
NVMON_MARKER_STOP("scale");
}
time_stop(&timer);
scale_time = time_print(&timer)/(double)ITER;

time_start(&timer);
for (int k=0; k<ITER; k++)
{
LIKWID_NVMARKER_START("add");
NVMON_MARKER_START("add");
Addkernel<<<dimGrid,dimBlock>>>(a, b, c, SIZE);
cudaDeviceSynchronize();
LIKWID_NVMARKER_STOP("add");
NVMON_MARKER_STOP("add");
}
time_stop(&timer);
add_time = time_print(&timer)/(double)ITER;

time_start(&timer);
for (int k=0; k<ITER; k++)
{
LIKWID_NVMARKER_START("triad");
NVMON_MARKER_START("triad");
Triadkernel<<<dimGrid,dimBlock>>>(a, b, c, scalar, SIZE);
cudaDeviceSynchronize();
LIKWID_NVMARKER_STOP("triad");
NVMON_MARKER_STOP("triad");
}
time_stop(&timer);
triad_time = time_print(&timer)/(double)ITER;
Expand All @@ -230,7 +230,7 @@ int main(int argn, char** argc)
1E-6*((2*SIZE)/triad_time));


LIKWID_NVMARKER_CLOSE;
NVMON_MARKER_CLOSE;
cudaFree(a);
cudaFree(b);
cudaFree(c);
Expand Down
10 changes: 5 additions & 5 deletions test/triad.cu
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ int main(int argc, char **argv) {
int deviceCount = 0;
GPU_ERROR(cudaGetDeviceCount(&deviceCount));

LIKWID_NVMARKER_INIT;
LIKWID_NVMARKER_REGISTER("triad");
NVMON_MARKER_INIT;
NVMON_MARKER_REGISTER("triad");

#pragma omp parallel num_threads(deviceCount)
{
Expand Down Expand Up @@ -124,10 +124,10 @@ int main(int argc, char **argv) {
GPU_ERROR(cudaDeviceSynchronize());
double t1 = dtime();
for (int i = 0; i < iters; i++) {
LIKWID_NVMARKER_START("triad");
NVMON_MARKER_START("triad");
sch_triad_kernel<double>
<<<max_blocks, block_size>>>(dA, dB, dC, dD, buffer_size);
LIKWID_NVMARKER_STOP("triad");
NVMON_MARKER_STOP("triad");
}
GPU_ERROR(cudaGetLastError());
GPU_ERROR(cudaDeviceSynchronize());
Expand All @@ -145,6 +145,6 @@ int main(int argc, char **argv) {
GPU_ERROR(cudaFree(dC));
GPU_ERROR(cudaFree(dD));
}
LIKWID_NVMARKER_CLOSE;
NVMON_MARKER_CLOSE;
return 0;
}

0 comments on commit 42f2b7d

Please sign in to comment.