Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rocprofiler-sdk support for ROCMON #644

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
63ea8de
Add check for ROCM >= 6.2
TomTheBear Oct 8, 2024
90b84be
Split ROCM backends in 'v1' and 'sdk'
TomTheBear Oct 8, 2024
5ec039f
Filter files based on ROCM version check
TomTheBear Oct 8, 2024
90b6b2a
Rename defines in rocmon_v1_types
TomTheBear Oct 8, 2024
032ad5d
Rename groups for v1 and add groups for sdk
TomTheBear Oct 8, 2024
ae0c4e4
Add skeleton for rocmon sdk
TomTheBear Oct 8, 2024
abc8001
Update Rocprofiler SDK support. Not working yet
TomTheBear Oct 22, 2024
47b230e
Add check for ROCM >= 6.2
TomTheBear Oct 8, 2024
4c877e2
Split ROCM backends in 'v1' and 'sdk'
TomTheBear Oct 8, 2024
42ef30c
Filter files based on ROCM version check
TomTheBear Oct 8, 2024
bc1b8d0
Rename defines in rocmon_v1_types
TomTheBear Oct 8, 2024
ffa9338
Rename groups for v1 and add groups for sdk
TomTheBear Oct 8, 2024
82c33e9
Add skeleton for rocmon sdk
TomTheBear Oct 8, 2024
eac1c64
Update Rocprofiler SDK support. Not working yet
TomTheBear Oct 22, 2024
09a94f2
Delete group directory for amd_gpu_sdk, no differentiation required
TomTheBear Oct 31, 2024
100fb54
Check error code when initializing ROCm topology
TomTheBear Oct 31, 2024
a4eb7ee
Fix ERROR_PRINTS
TomTheBear Oct 31, 2024
3a782a4
Fix ERROR_PRINTS
TomTheBear Oct 31, 2024
0fff85f
Fix ERROR_PRINTS
TomTheBear Oct 31, 2024
df147a1
Fix ERROR_PRINTS
TomTheBear Oct 31, 2024
3a54fe6
Guard debug levels with ifdefs
TomTheBear Oct 31, 2024
0af128e
Rename groups again to amd_gpu
TomTheBear Oct 31, 2024
edb835d
Update Rocmon code
TomTheBear Oct 31, 2024
647b607
Always compile rocprofiler v1 support
TomTheBear Oct 31, 2024
b60e2f6
Fix uninitialized variable warnings
TomTheBear Oct 31, 2024
5a1de25
Update build config file
TomTheBear Oct 31, 2024
741c2ad
Merge branch 'rocm_sdk_update' of github.com:RRZE-HPC/likwid into roc…
TomTheBear Oct 31, 2024
d3e1eb8
Update code to work again but only v1 and smi, sdk still fails to init
TomTheBear Nov 10, 2024
1f4f9e1
Use typedef for bool only if not C99+
TomTheBear Nov 10, 2024
6277c48
Remove typedef for bool
TomTheBear Nov 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update Rocprofiler SDK support. Not working yet
TomTheBear committed Oct 22, 2024
commit abc80014fb83097b571b176d3d6e8c1f6693eaa3
8 changes: 8 additions & 0 deletions src/includes/rocmon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef LIKWID_INTERNAL_ROCMON_H
#define LIKWID_INTERNAL_ROCMON_H

#include <likwid.h>

GroupInfo* rocmon_get_group(int gid);

#endif
228 changes: 228 additions & 0 deletions src/includes/rocmon_common_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
/*
* =======================================================================================
*
* Filename: rocmon_common_types.h
*
* Description: Header File of rocmon for v1 and sdk backend.
*
* Version: <VERSION>
* Released: <DATE>
*
* Author: Thomas Gruber (tg), [email protected]
* Project: likwid
*
* Copyright (C) 2019 RRZE, University Erlangen-Nuremberg
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* =======================================================================================
*/
#ifndef LIKWID_ROCMON_COMMON_TYPES_H
#define LIKWID_ROCMON_COMMON_TYPES_H

#include <map.h>

#include <amd_smi/amdsmi.h>
#if AMDSMI_LIB_VERSION_YEAR == 23 && AMDSMI_LIB_VERSION_MAJOR == 4 && AMDSMI_LIB_VERSION_MINOR == 0 && AMDSMI_LIB_VERSION_RELEASE == 0
typedef struct metrics_table_header_t metrics_table_header_t;
#endif
#include <rocm_smi/rocm_smi.h>
#include <hsa.h>
#include <hsa/hsa_ext_amd.h>
#ifdef ROCPROFILER_EXPORT
#undef ROCPROFILER_EXPORT
#endif
#ifdef ROCPROFILER_IMPORT
#undef ROCPROFILER_IMPORT
#endif
#ifdef ROCPROFILER_VERSION_MAJOR
#undef ROCPROFILER_VERSION_MAJOR
#endif
#ifdef ROCPROFILER_VERSION_MINOR
#undef ROCPROFILER_VERSION_MINOR
#endif
#ifdef ROCPROFILER_API
#undef ROCPROFILER_API
#endif
#include <rocprofiler/rocprofiler.h>
#ifdef LIKWID_ROCPROF_SDK
#ifdef ROCPROFILER_EXPORT
#undef ROCPROFILER_EXPORT
#endif
#ifdef ROCPROFILER_IMPORT
#undef ROCPROFILER_IMPORT
#endif
#ifdef ROCPROFILER_VERSION_MAJOR
#undef ROCPROFILER_VERSION_MAJOR
#endif
#ifdef ROCPROFILER_VERSION_MINOR
#undef ROCPROFILER_VERSION_MINOR
#endif
#ifdef ROCPROFILER_API
#undef ROCPROFILER_API
#endif
#include <rocprofiler-sdk/rocprofiler.h>
/*#ifdef ROCPROFILER_EXPORT*/
/*#undef ROCPROFILER_EXPORT*/
/*#endif*/
/*#ifdef ROCPROFILER_IMPORT*/
/*#undef ROCPROFILER_IMPORT*/
/*#endif*/
/*#ifdef ROCPROFILER_VERSION_MAJOR*/
/*#undef ROCPROFILER_VERSION_MAJOR*/
/*#endif*/
/*#ifdef ROCPROFILER_VERSION_MINOR*/
/*#undef ROCPROFILER_VERSION_MINOR*/
/*#endif*/
/*#ifdef ROCPROFILER_API*/
/*#undef ROCPROFILER_API*/
/*#endif*/
#include <rocprofiler-sdk/registration.h>
#endif



#ifndef ROCMWEAK
#define ROCMWEAK __attribute__(( weak ))
#endif
#ifndef FREE_IF_NOT_NULL
#define FREE_IF_NOT_NULL(var) if ( var ) { free( var ); var = NULL; }
#endif
/*#ifndef ARRAY_COUNT*/
/*#define ARRAY_COUNT(arr) (sizeof(arr) / sizeof((arr)[0]))*/
/*#endif*/
/*#ifndef SIZEOF_STRUCT_MEMBER*/
/*#define SIZEOF_STRUCT_MEMBER(type, member) (sizeof(((type *) NULL)->member))*/
/*#endif*/

typedef struct {
double lastValue;
double fullValue;
} RocmonEventResult;

typedef struct {
RocmonEventResult* results; // First rocprofiler results, then SMI results
int numResults;
} RocmonEventResultList;

#include <rocmon_smi_types.h>
#include <rocmon_sdk_types.h>

typedef struct {
bstring tag;
int groupID;
int gpuCount;
int eventCount;
double* time;
uint32_t* count;
int* gpulist;
double** counters;
} LikwidRocmResults;

typedef struct {
int deviceId; // LIKWID device id
int rocprof_v1;
int activeGroup;

// Rocprofiler V1
hsa_agent_t hsa_agent; // HSA agent handle for this device
rocprofiler_t* v1_context; // Rocprofiler context (has activeEvents configured)
#ifdef LIKWID_ROCPROF_SDK
// Rocprofiler SDK
rocprofiler_agent_t agent;
rocprofiler_context_id_t sdk_context; // Rocprofiler context (has activeEvents configured)
rocprofiler_buffer_id_t buffer;
rocprofiler_callback_thread_t thread;
#endif

// Available rocprofiler metrics
rocprofiler_info_data_t* v1_rocMetrics;
#ifdef LIKWID_ROCPROF_SDK
rocprofiler_counter_info_v0_t* sdk_rocMetrics;
#endif
int numRocMetrics;

// Available ROCm SMI events
Map_t smiMetrics;

// Currently configured rocprofiler events (bound to context)
rocprofiler_feature_t* v1_activeRocEvents;
#ifdef LIKWID_ROCPROF_SDK
rocprofiler_counter_info_v0_t* sdk_activeRocEvents;
#endif
int numActiveRocEvents;

// Currently configured ROCm SMI events
RocmonSmiEvent* activeSmiEvents;
int numActiveSmiEvents;

// Results for all events in all event sets
RocmonEventResultList* groupResults;
int numGroupResults;

#ifdef LIKWID_ROCPROF_SDK
rocprofiler_profile_config_id_t* profiles;
int numProfiles;
#endif

// Timestamps in ns
struct {
uint64_t start;
uint64_t read;
uint64_t stop;
} time;

// buffer?
} RocmonDevice;

typedef enum {
ROCMON_STATE_FINALIZED = 0,
ROCMON_STATE_INITIALIZED,
ROCMON_STATE_SETUP,
ROCMON_STATE_RUNNING,
ROCMON_STATE_STOPPED,
MAX_ROCMON_STATE,
} RocmonContextState;
#define MIN_ROCMON_STATE ROCMON_STATE_FINALIZED

typedef struct {
int numGroups; // Number of allocated groups
int numActiveGroups; // Number of used groups
int activeGroup; // Currently active group
GroupInfo *groups;

// Devices (HSA agents)
RocmonDevice *devices;
int numDevices;

// System information
long double hsa_timestamp_factor; // hsa_timestamp * hsa_timestamp_factor = timestamp_in_ns

// Rocprofiler SDK agents with buffers
#ifdef LIKWID_ROCPROF_SDK
int num_sdk_agents;
RocprofilerSdkAgentData* agents;
#endif

// ROCm SMI events
Map_t smiEvents;

// Use legacy rocprofiler v1
int use_rocprofiler_v1:1;
RocmonContextState state;
} RocmonContext;

//extern static RocmonContext* rocmon_context;


#endif /* LIKWID_ROCMON_COMMON_TYPES_H */
1,183 changes: 1,155 additions & 28 deletions src/includes/rocmon_sdk.h

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions src/includes/rocmon_sdk_types.h
Original file line number Diff line number Diff line change
@@ -30,6 +30,41 @@
#ifndef LIKWID_ROCMON_SDK_TYPES_H
#define LIKWID_ROCMON_SDK_TYPES_H

#include <likwid.h>
/*#ifdef ROCPROFILER_EXPORT*/
/*#undef ROCPROFILER_EXPORT*/
/*#endif*/
/*#ifdef ROCPROFILER_IMPORT*/
/*#undef ROCPROFILER_IMPORT*/
/*#endif*/
/*#ifdef ROCPROFILER_VERSION_MAJOR*/
/*#undef ROCPROFILER_VERSION_MAJOR*/
/*#endif*/
/*#ifdef ROCPROFILER_VERSION_MINOR*/
/*#undef ROCPROFILER_VERSION_MINOR*/
/*#endif*/
/*#ifdef ROCPROFILER_API*/
/*#undef ROCPROFILER_API*/
/*#endif*/
#include <rocprofiler-sdk/rocprofiler.h>
/*#ifdef ROCPROFILER_API*/
/*#undef ROCPROFILER_API*/
/*#endif*/
#include <rocprofiler-sdk/registration.h>


typedef struct {
rocprofiler_agent_t* agent;
rocprofiler_buffer_id_t buffer;
rocprofiler_context_id_t context;
RocmonEventResultList *result;
} RocprofilerSdkAgentData;

typedef struct {
int num_agents;
RocprofilerSdkAgentData* agents;
} RocprofilerSdkData;



#endif /* LIKWID_ROCMON_SDK_TYPES_H */
1,181 changes: 1,181 additions & 0 deletions src/includes/rocmon_smi.h

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions src/includes/rocmon_smi_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* =======================================================================================
*
* Filename: rocmon_smi_types.h
*
* Description: Header File of rocmon for smi backend.
*
* Version: <VERSION>
* Released: <DATE>
*
* Author: Thomas Gruber (tg), thomas.gruber@googlemail.com
* Project: likwid
*
* Copyright (C) 2019 RRZE, University Erlangen-Nuremberg
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* =======================================================================================
*/
#ifndef LIKWID_ROCMON_SMI_TYPES_H
#define LIKWID_ROCMON_SMI_TYPES_H

#include <amd_smi/amdsmi.h>
#if AMDSMI_LIB_VERSION_YEAR == 23 && AMDSMI_LIB_VERSION_MAJOR == 4 && AMDSMI_LIB_VERSION_MINOR == 0 && AMDSMI_LIB_VERSION_RELEASE == 0
typedef struct metrics_table_header_t metrics_table_header_t;
#endif
#include <rocm_smi/rocm_smi.h>
#ifdef ROCPROFILER_EXPORT
#undef ROCPROFILER_EXPORT
#endif
#ifdef ROCPROFILER_IMPORT
#undef ROCPROFILER_IMPORT
#endif
#ifdef ROCPROFILER_VERSION_MAJOR
#undef ROCPROFILER_VERSION_MAJOR
#endif
#ifdef ROCPROFILER_VERSION_MINOR
#undef ROCPROFILER_VERSION_MINOR
#endif
#ifdef ROCPROFILER_API
#undef ROCPROFILER_API
#endif
#include <rocmon_common_types.h>

struct RocmonSmiEvent_struct;
typedef int (*RocmonSmiMeasureFunc)(int deviceId, struct RocmonSmiEvent_struct* event, RocmonEventResult* result);

typedef enum {
ROCMON_SMI_EVENT_TYPE_NORMAL = 0,
ROCMON_SMI_EVENT_TYPE_VARIANT,
ROCMON_SMI_EVENT_TYPE_SUBVARIANT,
ROCMON_SMI_EVENT_TYPE_INSTANCES
} RocmonSmiEventType;

#define MAX_ROCMON_SMI_EVENT_NAME 40
typedef struct RocmonSmiEvent_struct {
char name[MAX_ROCMON_SMI_EVENT_NAME];
uint64_t variant;
uint64_t subvariant;
uint64_t extra;
int instances;
RocmonSmiEventType type;
RocmonSmiMeasureFunc measureFunc;
} RocmonSmiEvent;

typedef struct {
RocmonSmiEvent* entries;
int numEntries;
} RocmonSmiEventList;

#endif /* LIKWID_ROCMON_SMI_TYPES_H */
985 changes: 957 additions & 28 deletions src/includes/rocmon_v1.h

Large diffs are not rendered by default.

120 changes: 15 additions & 105 deletions src/includes/rocmon_v1_types.h
Original file line number Diff line number Diff line change
@@ -32,118 +32,28 @@

#include <likwid.h>
// #include <hsa.h>
#ifndef ROCPROFILER_VERSION_MAJOR
#ifdef HSA_VEN_AMD_AQLPROFILE_LEGACY_PM4_PACKET_SIZE
#undef HSA_VEN_AMD_AQLPROFILE_LEGACY_PM4_PACKET_SIZE
#endif
#include <rocprofiler/rocprofiler.h>
#ifdef ROCPROFILER_EXPORT
#undef ROCPROFILER_EXPORT
#endif
#include <amd_smi/amdsmi.h>
#if AMDSMI_LIB_VERSION_YEAR == 23 && AMDSMI_LIB_VERSION_MAJOR == 4 && AMDSMI_LIB_VERSION_MINOR == 0 && AMDSMI_LIB_VERSION_RELEASE == 0
typedef struct metrics_table_header_t metrics_table_header_t;
#ifdef ROCPROFILER_IMPORT
#undef ROCPROFILER_IMPORT
#endif
#include <rocm_smi/rocm_smi.h>
#include <map.h>

typedef struct {
double lastValue;
double fullValue;
} RocmonEventResult;

typedef struct {
RocmonEventResult* results; // First rocprofiler results, then SMI results
int numResults;
} RocmonEventResultList;



struct RocmonSmiEvent_struct;
typedef int (*RocmonSmiMeasureFunc)(int deviceId, struct RocmonSmiEvent_struct* event, RocmonEventResult* result);

typedef enum {
ROCMON_SMI_EVENT_TYPE_NORMAL = 0,
ROCMON_SMI_EVENT_TYPE_VARIANT,
ROCMON_SMI_EVENT_TYPE_SUBVARIANT,
ROCMON_SMI_EVENT_TYPE_INSTANCES
} RocmonSmiEventType;

typedef struct RocmonSmiEvent_struct {
char name[40];
uint64_t variant;
uint64_t subvariant;
uint64_t extra;
int instances;
RocmonSmiEventType type;
RocmonSmiMeasureFunc measureFunc;
} RocmonSmiEvent;

typedef struct {
RocmonSmiEvent* entries;
int numEntries;
} RocmonSmiEventList;

typedef struct {
int deviceId; // LIKWID device id

hsa_agent_t hsa_agent; // HSA agent handle for this device
rocprofiler_t* context; // Rocprofiler context (has activeEvents configured)

// Available rocprofiler metrics
rocprofiler_info_data_t* rocMetrics;
int numRocMetrics;

// Available ROCm SMI events
Map_t smiMetrics;

// Currently configured rocprofiler events (bound to context)
rocprofiler_feature_t* activeRocEvents;
int numActiveRocEvents;

// Currently configured ROCm SMI events
RocmonSmiEvent* activeSmiEvents;
int numActiveSmiEvents;

// Results for all events in all event sets
RocmonEventResultList* groupResults;
int numGroupResults;

// Timestamps in ns
struct {
uint64_t start;
uint64_t read;
uint64_t stop;
} time;
} RocmonDevice;

typedef struct {
// Event Groups
GroupInfo *groups;
int numGroups; // Number of allocated groups
int numActiveGroups; // Number of used groups
int activeGroup; // Currently active group

// Devices (HSA agents)
RocmonDevice *devices;
int numDevices;

// System information
long double hsa_timestamp_factor; // hsa_timestamp * hsa_timestamp_factor = timestamp_in_ns
#ifdef ROCPROFILER_VERSION_MAJOR
#undef ROCPROFILER_VERSION_MAJOR
#endif
#ifdef ROCPROFILER_VERSION_MINOR
#undef ROCPROFILER_VERSION_MINOR
#endif
#ifdef ROCPROFILER_API
#undef ROCPROFILER_API
#endif
#include <rocprofiler/rocprofiler.h>

// ROCm SMI events
Map_t smiEvents;
} RocmonContext;

extern RocmonContext *rocmon_context;
#include <rocmon_common_types.h>


typedef struct {
bstring tag;
int groupID;
int gpuCount;
int eventCount;
double* time;
uint32_t* count;
int* gpulist;
double** counters;
} LikwidRocmResults;
#endif /* LIKWID_ROCMON_V1_TYPES_H */
891 changes: 736 additions & 155 deletions src/rocmon.c

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions src/rocmon_marker.c
Original file line number Diff line number Diff line change
@@ -39,11 +39,21 @@
#include <types.h>

#include <likwid.h>
#ifndef LIKWID_ROCPROF_SDK
#include <rocmon.h>
#include <rocmon_common_types.h>
#include <rocmon_v1_types.h>
#ifdef LIKWID_ROCPROF_SDK
#include <rocmon_sdk_types.h>
#endif
#include <rocmon_smi_types.h>

#ifndef FREE_IF_NOT_NULL
#define FREE_IF_NOT_NULL(x) if (x != NULL) { free(x); x = NULL; }
#endif

#ifndef gettid
#define gettid() syscall(SYS_gettid)
#endif

#ifndef NAN
#define NAN (0.0/0.0)
@@ -202,8 +212,6 @@ _rocmon_saveToFile(const char* markerfile)
static void
_rocmon_finalize(void)
{
#define FREE_IF_NOT_NULL(x) if (x != NULL) { free(x); x = NULL; }

// Ensure markers were initialized
if (!rocmon_marker_initialized)
{
@@ -316,7 +324,7 @@ rocmon_markerInit(void)
ret = rocmon_addEventSet(bdata(gEventStrings->entry[i]), &gpu_groups[i]);
if (ret < 0)
{
fprintf(stderr,"Error setting up Rocmon Marker API.\n");
fprintf(stderr,"Error setting up Rocmon Marker API: %d\n", ret);
free(gpu_ids);
free(gpu_maps);
free(gpu_groups);
@@ -337,7 +345,7 @@ rocmon_markerInit(void)
ret = rocmon_setupCounters(gpu_groups[active_group]);
if (ret)
{
fprintf(stderr,"Error setting up Rocmon Marker API.\n");
fprintf(stderr,"Error setting up Rocmon Marker API: %d\n", ret);
free(gpu_ids);
free(gpu_maps);
free(gpu_groups);
@@ -349,7 +357,7 @@ rocmon_markerInit(void)
ret = rocmon_startCounters();
if (ret)
{
fprintf(stderr,"Error starting up Rocmon Marker API.\n");
fprintf(stderr,"Error starting up Rocmon Marker API: %d\n", ret);
free(gpu_ids);
free(gpu_maps);
free(gpu_groups);
@@ -1066,8 +1074,8 @@ rocmon_getMetricOfRegionGpu(int region, int metricId, int gpuId)
{
return NAN;
}
GroupInfo* ginfo = &rocmon_context->groups[rocmMarkerResults[region].groupID];
if (metricId < 0 || metricId >= ginfo->nmetrics)
GroupInfo* ginfo = rocmon_get_group(rocmMarkerResults[region].groupID);
if ((!ginfo) || (metricId < 0) || (metricId >= ginfo->nmetrics))
{
return NAN;
}
251 changes: 0 additions & 251 deletions src/rocmon_sdk.c

This file was deleted.

2,275 changes: 0 additions & 2,275 deletions src/rocmon_v1.c

This file was deleted.

72 changes: 72 additions & 0 deletions test/test_rocmon.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#include <stdlib.h>
#include <stdio.h>


#include <likwid.h>





int main(int argc, char* argv[])
{
int gpuId = 0;
int ret = 0;
int gid = -1;
rocmon_setVerbosity(DEBUGLEV_DEVELOP);
ret = rocmon_init(1, &gpuId);
if (ret < 0)
{
printf("rocmon_init failed with %d\n", ret);
return ret;
}
ret = rocmon_addEventSet("ROCP_SQ_WAVES:ROCM0", &gid);
if (ret < 0)
{
printf("rocmon_addEventSet failed with %d\n", ret);
rocmon_finalize();
return ret;
}
printf("test_rocmon -- Event set ID %d\n", gid);
ret = rocmon_setupCounters(gid);
if (ret < 0)
{
printf("rocmon_setupCounters failed with %d\n", ret);
rocmon_finalize();
return ret;
}
ret = rocmon_startCounters();
if (ret < 0)
{
printf("rocmon_startCounters failed with %d\n", ret);
rocmon_finalize();
return ret;
}
printf("test_rocmon -- Counters running\n");
ret = rocmon_readCounters();
if (ret < 0)
{
printf("rocmon_startCounters failed with %d\n", ret);
rocmon_finalize();
return ret;
}
printf("test_rocmon -- Counters running\n");
ret = rocmon_readCounters();
if (ret < 0)
{
printf("rocmon_startCounters failed with %d\n", ret);
rocmon_finalize();
return ret;
}
printf("test_rocmon -- Counters running\n");
ret = rocmon_stopCounters();
if (ret < 0)
{
printf("rocmon_stopCounters failed with %d\n", ret);
rocmon_finalize();
return ret;
}
printf("test_rocmon -- Counters stopped\n");
rocmon_finalize();
return 0;
}