adding gtest placeholder
adding discovery,group,fieldgroup,dmon,stats test

Change-Id: I71428f70345af5c8025fb66c1d411dc348daa2ef
Αυτή η υποβολή περιλαμβάνεται σε:
Divya Shikre
2020-05-01 12:21:32 -04:00
υποβλήθηκε από Chris Freehill
γονέας d30cb81fdb
υποβολή 61579371f8
19 αρχεία άλλαξαν με 954 προσθήκες και 528 διαγραφές
@@ -3,16 +3,17 @@
#
cmake_minimum_required(VERSION 3.5.0)
# TODO We will probably also have to add a RDC_DIR to pick up the
# header and library
# Required Defines on cmake command line
#
# 1) Set location of ROCm root to pick up RDC and RDC headers and RDC lib
#
# ROCM_DIR="Root for ROCM install"
#
# 2) Set RDCTST_BLD_TYPE to either "Debug" or "Release".
# 2) Set location of RDC root to pick up RDC and RDC headers and RDC lib
#
# RDC_DIR="Root for RDC install"
#
# 3) Set RDCTST_BLD_TYPE to either "Debug" or "Release".
# If not set, the default value is "Debug" is bound.
#
# RDCTST_BLD_TYPE=Debug or RDCTST_BLD_TYPE=Release
@@ -41,9 +42,10 @@ endif()
# Required Defines first:
set(RDC_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../client/include)
set(RDC_LIB_DIR ${RDC_BUILD_DIR}/client)
set(RDC_INC_DIR ${RDC_DIR}/include)
set(RDC_LIB_DIR ${RDC_DIR}/build/rdc_libs)
set(RSMI_INC_DIR ${ROCM_DIR}/rocm_smi/include)
set(RSMI_LIB_DIR ${ROCM_DIR}/rocm_smi/lib)
#
@@ -78,6 +80,7 @@ message("--------Proj Bld Dir: " ${PROJECT_BINARY_DIR})
message("--------Proj Lib Dir: " ${PROJECT_BINARY_DIR}/lib)
message("--------Proj Exe Dir: " ${PROJECT_BINARY_DIR}/bin)
message("--------RDC Lib Dir: " ${RDC_LIB_DIR})
message("--------RDC Inc Dir: " ${RDC_INC_DIR})
message("")
#
@@ -124,7 +127,7 @@ endif()
set(RDCTST_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set(RDCTST "rdctst")
set(RDCTST_LIBS "rdc_client_smi")
set(RDCTST_LIBS "rdc_bootstrap" )
# Set Name for Google Test Framework and build it as a
# static library to be linked with user test programs
@@ -142,7 +145,7 @@ aux_source_directory(${RDCTST_ROOT}/functional functionalSources)
# Specify the directory containing various libraries of ROCR
# to be linked against for building ROC Perf applications
#
link_directories(${RDC_LIB_DIR} "${GRPC_ROOT}/lib")
link_directories(${RDC_LIB_DIR})
#
# Source files for building rocrtst
#
@@ -154,7 +157,6 @@ add_executable(${RDCTST} ${rdctstSources} ${functionalSources})
# Header file include path
target_include_directories(${RDCTST} PRIVATE ${RDC_INC_DIR}
PRIVATE ${RSMI_INC_DIR}
PRIVATE ${GRPC_ROOT}/include
PRIVATE ${RDCTST_ROOT}/..
PRIVATE ${RDCTST_ROOT}/gtest/include)
@@ -1,108 +0,0 @@
/*
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include "gtest/gtest.h"
#include "rdc/rdc_client.h"
#include "rdc_tests/functional/fan_read.h"
#include "rdc_tests/test_common.h"
TestFanRead::TestFanRead() : TestBase() {
set_title("RDC Fan Read Test");
set_description("The Fan Read tests verifies that the fan monitors can be "
"read properly.");
}
TestFanRead::~TestFanRead(void) {
}
void TestFanRead::SetUp(void) {
TestBase::SetUp();
return;
}
void TestFanRead::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestFanRead::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestFanRead::Close() {
TestBase::Close();
}
void TestFanRead::Run(void) {
uint64_t val_ui64;
rdc_status_t err;
int64_t val_i64;
TestBase::Run();
err = AllocateRDCChannel();
ASSERT_EQ(err, RDC_STATUS_SUCCESS);
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(i);
IF_VERB(STANDARD) {
std::cout << "\t**Current Fan Speed: ";
}
err = rdc_dev_fan_speed_get(rdc_channel(), i, 0, &val_i64);
CHK_ERR_ASRT(err)
// Verify api support checking functionality is working
err = rdc_dev_fan_speed_get(rdc_channel(), i, 0, nullptr);
ASSERT_EQ(err, RDC_RSMI_STATUS_INVALID_ARGS);
err = rdc_dev_fan_speed_max_get(rdc_channel(), i, 0, &val_ui64);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << val_i64/static_cast<float>(val_ui64)*100;
std::cout << "% ("<< val_i64 << "/" << val_ui64 << ")" << std::endl;
}
// Verify api support checking functionality is working
err = rdc_dev_fan_speed_max_get(rdc_channel(), i, 0, nullptr);
ASSERT_EQ(err, RDC_RSMI_STATUS_INVALID_ARGS);
IF_VERB(STANDARD) {
std::cout << "\t**Current fan RPMs: ";
}
err = rdc_dev_fan_rpms_get(rdc_channel(), i, 0, &val_i64);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << val_i64 << std::endl;
}
// Verify api support checking functionality is working
err = rdc_dev_fan_rpms_get(rdc_channel(), i, 0, nullptr);
ASSERT_EQ(err, RDC_RSMI_STATUS_INVALID_ARGS);
}
}
@@ -1,104 +0,0 @@
/*
Copyright (c) 2019 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include <string>
#include "gtest/gtest.h"
#include "rdc/rdc_client.h"
#include "rocm_smi/rocm_smi.h"
#include "rdc_tests/functional/id_info_read.h"
#include "rdc_tests/test_common.h"
TestIdInfoRead::TestIdInfoRead() : TestBase() {
set_title("RDC ID Info Read Test");
set_description("This test verifies that ID information such as the "
"device, subsystem and vendor IDs can be read properly.");
}
TestIdInfoRead::~TestIdInfoRead(void) {
}
void TestIdInfoRead::SetUp(void) {
TestBase::SetUp();
return;
}
void TestIdInfoRead::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestIdInfoRead::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestIdInfoRead::Close() {
// This will close handles opened within RDC utility calls
TestBase::Close();
}
static const uint32_t kBufferLen = 80;
void TestIdInfoRead::Run(void) {
rdc_status_t err;
// uint16_t id;
// uint64_t val_ui64;
// uint32_t drm_render_minor;
// char buffer[kBufferLen];
TestBase::Run();
err = AllocateRDCChannel();
ASSERT_EQ(err, RDC_STATUS_SUCCESS);
// This test doesn't do much at all yet. Add RDC ID type tests below as we
// add those capabilities. The following commented block is left as a
// template.
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
// IF_VERB(STANDARD) {
// std::cout << "\t**Device index: " << id << std::endl;
// }
// // Get the device ID, name, vendor ID and vendor name for the device
// err = rsmi_dev_id_get(i, &id);
// if (err == RSMI_STATUS_NOT_SUPPORTED) {
// rdc_status_t ret;
// // Verify api support checking functionality is working
// ret = rsmi_dev_id_get(i, nullptr);
// ASSERT_EQ(ret, RSMI_STATUS_NOT_SUPPORTED);
// } else {
// CHK_ERR_ASRT(err)
//
// IF_VERB(STANDARD) {
// std::cout << "\t**Device ID: 0x" << std::hex << id << std::endl;
// }
// // Verify api support checking functionality is working
// err = rsmi_dev_id_get(i, nullptr);
// ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
// }
}
}
@@ -0,0 +1,137 @@
/*
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include "gtest/gtest.h"
#include "rdc_tests/functional/rdci_discovery.h"
#include "rdc_tests/test_common.h"
#include "rdc/rdc.h"
TestRdciDiscovery::TestRdciDiscovery() : TestBase() {
set_title("\tRDC Discovery Test");
set_description("\tThe Discovery tests verifies that the GPUs are discovered and identified .");
}
TestRdciDiscovery::~TestRdciDiscovery(void) {
}
void TestRdciDiscovery::SetUp(void) {
TestBase::SetUp();
rdc_status_t result = AllocateRDCChannel();
ASSERT_EQ(result, RDC_ST_OK);
return;
}
void TestRdciDiscovery::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestRdciDiscovery::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestRdciDiscovery::Close() {
TestBase::Close();
rdc_status_t result;
if(standalone_){
IF_VERB(STANDARD) {
std::cout << "\t**Disconnecting from host....\n" << std::endl;
}
result = rdc_disconnect(rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
else{
IF_VERB(STANDARD) {
std::cout << "\t**Stopping Embedded RDC Engine....\n" << std::endl;
}
result = rdc_stop_embedded(rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
result = rdc_shutdown();
ASSERT_EQ(result, RDC_ST_OK);
}
void TestRdciDiscovery::Run(void) {
TestBase::Run();
rdc_status_t result;
if(standalone_){
IF_VERB(STANDARD) {
std::cout << "\t**Connecting to host....\n" << std::endl;
}
char hostIpAddress[] = {"localhost:50051"};
result = rdc_connect(hostIpAddress, &rdc_handle, nullptr, nullptr, nullptr);
ASSERT_EQ(result, RDC_ST_OK);
}
else{
IF_VERB(STANDARD) {
std::cout << "\t**Starting embedded RDC engine....\n" << std::endl;
}
result = rdc_start_embedded(RDC_OPERATION_MODE_AUTO, &rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
uint32_t gpu_index_list[RDC_MAX_NUM_DEVICES];
uint32_t count = 0;
IF_VERB(STANDARD) {
std::cout << "\t**Getting the devices in the system\n" << std::endl;
}
result = rdc_device_get_all(0, gpu_index_list, &count);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_device_get_all(rdc_handle, gpu_index_list, 0);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_device_get_all(rdc_handle, gpu_index_list, &count);
ASSERT_EQ(result, RDC_ST_OK);
ASSERT_GT(count, 0);
IF_VERB(STANDARD) {
std::cout << "\t**Fetching attributes of every device\n" << std::endl;
}
rdc_device_attributes_t attribute;
for (uint32_t i = 0; i < count; i++) {
result = rdc_device_get_attributes(0, gpu_index_list[i], &attribute);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_device_get_attributes(rdc_handle, gpu_index_list[i], 0);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_device_get_attributes(rdc_handle,gpu_index_list[i], &attribute);
ASSERT_EQ(result, RDC_ST_OK);
std::cout << "\tGPU ID "<< i << " || " << attribute.device_name <<std::endl;
}
}
@@ -0,0 +1,50 @@
/*
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef TESTS_RDC_TESTS_FUNCTIONAL_RDCI_DISCOVERY_H_
#define TESTS_RDC_TESTS_FUNCTIONAL_RDCI_DISCOVERY_H_
#include "rdc_tests/test_base.h"
class TestRdciDiscovery : public TestBase {
public:
TestRdciDiscovery();
// @Brief: Destructor for test case of TestRdciDiscovery
virtual ~TestRdciDiscovery();
// @Brief: Setup the environment for measurement
virtual void SetUp();
// @Brief: Core measurement execution
virtual void Run();
// @Brief: Clean up and retrive the resource
virtual void Close();
// @Brief: Display results
virtual void DisplayResults() const;
// @Brief: Display information about what this test does
virtual void DisplayTestInfo(void);
};
#endif // TESTS_RDC_TESTS_FUNCTIONAL_RDCI_DISCOVERY_H_
@@ -0,0 +1,144 @@
/*
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include "gtest/gtest.h"
#include "rdc_tests/functional/rdci_dmon.h"
#include "rdc_tests/test_common.h"
#include "rdc/rdc.h"
TestRdciDmon::TestRdciDmon() : TestBase() {
set_title("\tRDC Dmon Test");
set_description("\tThe Dmon tests verifies that the GPUs metrics are being monitored. ");
}
TestRdciDmon::~TestRdciDmon(void) {
}
void TestRdciDmon::SetUp(void) {
TestBase::SetUp();
rdc_status_t result = AllocateRDCChannel();
ASSERT_EQ(result, RDC_ST_OK);
return;
}
void TestRdciDmon::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestRdciDmon::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestRdciDmon::Close() {
TestBase::Close();
rdc_status_t result;
if(standalone_){
IF_VERB(STANDARD) {
std::cout << "\t**Disconnecting from host....\n" << std::endl;
}
result = rdc_disconnect(rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
else{
IF_VERB(STANDARD) {
std::cout << "\t**Stopping Embedded RDC Engine....\n" << std::endl;
}
result = rdc_stop_embedded(rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
};
result = rdc_shutdown();
ASSERT_EQ(result, RDC_ST_OK);
}
void TestRdciDmon::Run(void) {
TestBase::Run();
rdc_status_t result;
if(standalone_){
IF_VERB(STANDARD) {
std::cout << "\t**Connecting to host....\n" << std::endl;
}
char hostIpAddress[] = {"localhost:50051"};
result = rdc_connect(hostIpAddress, &rdc_handle, nullptr, nullptr, nullptr);
ASSERT_EQ(result, RDC_ST_OK);
}
else{
IF_VERB(STANDARD) {
std::cout << "\t**Starting embedded RDC engine....\n" << std::endl;
}
result = rdc_start_embedded(RDC_OPERATION_MODE_AUTO, &rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
rdc_group_info_t group_info;
rdc_gpu_group_t group_id;
rdc_field_grp_t field_group_id;
result = rdc_group_gpu_create(rdc_handle, RDC_GROUP_EMPTY,
"GRP_DMON", &group_id);
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_group_gpu_add(rdc_handle, group_id, 0);
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_group_gpu_get_info(rdc_handle, group_id, NULL);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_group_gpu_get_info(rdc_handle, -1, NULL);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_group_gpu_get_info(rdc_handle, group_id, &group_info);
ASSERT_EQ(result, RDC_ST_OK);
ASSERT_GT(group_info.count, 0);
uint32_t field_ids[]= {150,155,203};
uint32_t fsize = sizeof(field_ids)/sizeof(field_ids[0]);
result = rdc_group_field_create(rdc_handle, fsize , &field_ids[0], "FIELD_GRP", &field_group_id);
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_field_watch(rdc_handle, -1, field_group_id, 0, 60, 10);
ASSERT_EQ(result, RDC_ST_NOT_FOUND);
result = rdc_field_watch(rdc_handle, group_id, -1, 0, 60, 10);
ASSERT_EQ(result, RDC_ST_NOT_FOUND);
result = rdc_field_watch(rdc_handle, group_id, field_group_id, 0, 60, 10);
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_field_unwatch(rdc_handle, group_id, field_group_id);
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_group_gpu_destroy(rdc_handle, group_id);
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_group_field_destroy(rdc_handle, field_group_id);
ASSERT_EQ(result, RDC_ST_OK);
}
Εκτελέσιμο αρχείο → Κανονικό αρχείο
+7 -7
Προβολή Αρχείου
@@ -19,17 +19,17 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef TESTS_RDC_TESTS_FUNCTIONAL_FAN_READ_H_
#define TESTS_RDC_TESTS_FUNCTIONAL_FAN_READ_H_
#ifndef TESTS_RDC_TESTS_FUNCTIONAL_RDCI_DMON_H_
#define TESTS_RDC_TESTS_FUNCTIONAL_RDCI_DMON_H_
#include "rdc_tests/test_base.h"
class TestFanRead : public TestBase {
class TestRdciDmon : public TestBase {
public:
TestFanRead();
TestRdciDmon();
// @Brief: Destructor for test case of TestFanRead
virtual ~TestFanRead();
// @Brief: Destructor for test case of TestRdciDmon
virtual ~TestRdciDmon();
// @Brief: Setup the environment for measurement
virtual void SetUp();
@@ -47,4 +47,4 @@ class TestFanRead : public TestBase {
virtual void DisplayTestInfo(void);
};
#endif // TESTS_RDC_TESTS_FUNCTIONAL_FAN_READ_H_
#endif // TESTS_RDC_TESTS_FUNCTIONAL_RDCI_DMON_H_
@@ -0,0 +1,147 @@
/*
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include "gtest/gtest.h"
#include "rdc_tests/functional/rdci_fieldgroup.h"
#include "rdc_tests/test_common.h"
#include "rdc/rdc.h"
TestRdciFieldgroup::TestRdciFieldgroup() : TestBase() {
set_title("\tRDC Fieldgroup Test");
set_description("\tThe Fieldgroup tests verifies the creation/deletion of fieldgroups.");
}
TestRdciFieldgroup::~TestRdciFieldgroup(void) {
}
void TestRdciFieldgroup::SetUp(void) {
TestBase::SetUp();
rdc_status_t result = AllocateRDCChannel();
ASSERT_EQ(result, RDC_ST_OK);
return;
}
void TestRdciFieldgroup::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestRdciFieldgroup::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestRdciFieldgroup::Close() {
TestBase::Close();
rdc_status_t result;
if(standalone_){
IF_VERB(STANDARD) {
std::cout << "\t**Disconnecting from host....\n" << std::endl;
}
result = rdc_disconnect(rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
else{
IF_VERB(STANDARD) {
std::cout << "\t**Stopping Embedded RDC Engine....\n" << std::endl;
}
result = rdc_stop_embedded(rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
result = rdc_shutdown();
ASSERT_EQ(result, RDC_ST_OK);
}
void TestRdciFieldgroup::Run(void) {
TestBase::Run();
rdc_status_t result;
if(standalone_){
IF_VERB(STANDARD) {
std::cout << "\t**Connecting to host....\n" << std::endl;
}
char hostIpAddress[] = {"localhost:50051"};
result = rdc_connect(hostIpAddress, &rdc_handle, nullptr, nullptr, nullptr);
ASSERT_EQ(result, RDC_ST_OK);
}
else{
IF_VERB(STANDARD) {
std::cout << "\t**Starting embedded RDC engine....\n" << std::endl;
}
result = rdc_start_embedded(RDC_OPERATION_MODE_AUTO, &rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
rdc_field_grp_t field_group_id;
uint32_t field_ids[]= {150,155};
uint32_t invalid_field_ids[]= {10,20};
uint32_t fsize = sizeof(field_ids)/sizeof(field_ids[0]);
uint32_t count = 0;
rdc_field_group_info_t group_info;
result = rdc_group_field_create(rdc_handle, fsize, &invalid_field_ids[0], "FIELD_GRP", &field_group_id);
ASSERT_EQ(result, RDC_ST_NOT_SUPPORTED);
result = rdc_group_field_create(NULL, fsize, &field_ids[0], "FIELD_GRP", &field_group_id);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_group_field_create(rdc_handle, fsize, &field_ids[0], NULL, NULL);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_group_field_create(rdc_handle, (RDC_MAX_FIELD_IDS_PER_FIELD_GROUP+1), &field_ids[0], "FIELD_GRP", NULL);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_group_field_create(rdc_handle, fsize, &field_ids[0], "FIELD_GRP", &field_group_id);
ASSERT_EQ(result, RDC_ST_OK);
rdc_field_grp_t group_id_list[RDC_MAX_NUM_FIELD_GROUPS];
result = rdc_group_field_get_all_ids(rdc_handle, group_id_list, 0);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_group_field_get_all_ids(rdc_handle, group_id_list, &count);
ASSERT_EQ(result, RDC_ST_OK);
ASSERT_GT(count, 0);
std::cout << "\tGroupID\t" << "GroupName\t" << "FieldIds\n";
for (uint32_t i = 0; i < count; i++) {
result = rdc_group_field_get_info(rdc_handle, group_id_list[i], 0);
ASSERT_EQ(result, RDC_ST_BAD_PARAMETER);
result = rdc_group_field_get_info(rdc_handle, group_id_list[i], &group_info);
ASSERT_EQ(result, RDC_ST_OK);
}
result = rdc_group_field_destroy(NULL, field_group_id);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_group_field_destroy(rdc_handle, field_group_id);
ASSERT_EQ(result, RDC_ST_OK);
}
@@ -0,0 +1,50 @@
/*
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef TESTS_RDC_TESTS_FUNCTIONAL_RDCI_FIELDGROUP_H_
#define TESTS_RDC_TESTS_FUNCTIONAL_RDCI_FIELDGROUP_H_
#include "rdc_tests/test_base.h"
class TestRdciFieldgroup : public TestBase {
public:
TestRdciFieldgroup();
// @Brief: Destructor for test case of TestRdciFieldgroup
virtual ~TestRdciFieldgroup();
// @Brief: Setup the environment for measurement
virtual void SetUp();
// @Brief: Core measurement execution
virtual void Run();
// @Brief: Clean up and retrive the resource
virtual void Close();
// @Brief: Display results
virtual void DisplayResults() const;
// @Brief: Display information about what this test does
virtual void DisplayTestInfo(void);
};
#endif // TESTS_RDC_TESTS_FUNCTIONAL_RDCI_FIELDGROUP_H_
@@ -0,0 +1,166 @@
/*
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include "gtest/gtest.h"
#include "rdc_tests/functional/rdci_group.h"
#include "rdc_tests/test_common.h"
#include "rdc/rdc.h"
TestRdciGroup::TestRdciGroup() : TestBase() {
set_title("\tRDC Group Test");
set_description("\tThe Group tests verifies creation/deletion of GPU groups");
}
TestRdciGroup::~TestRdciGroup(void) {
}
void TestRdciGroup::SetUp(void) {
TestBase::SetUp();
rdc_status_t result = AllocateRDCChannel();
ASSERT_EQ(result, RDC_ST_OK);
return;
}
void TestRdciGroup::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestRdciGroup::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestRdciGroup::Close() {
TestBase::Close();
rdc_status_t result;
if(standalone_){
IF_VERB(STANDARD) {
std::cout << "\t**Disconnecting from host....\n" << std::endl;
}
result = rdc_disconnect(rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
else{
IF_VERB(STANDARD) {
std::cout << "\t**Stopping Embedded RDC Engine....\n" << std::endl;
}
result = rdc_stop_embedded(rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
};
result = rdc_shutdown();
ASSERT_EQ(result, RDC_ST_OK);
}
void TestRdciGroup::Run(void) {
TestBase::Run();
rdc_status_t result;
if(standalone_){
IF_VERB(STANDARD) {
std::cout << "\t**Connecting to host....\n" << std::endl;
}
char hostIpAddress[] = {"localhost:50051"};
result = rdc_connect(hostIpAddress, &rdc_handle, nullptr, nullptr, nullptr);
ASSERT_EQ(result, RDC_ST_OK);
}
else{
IF_VERB(STANDARD) {
std::cout << "\t**Starting embedded RDC engine....\n" << std::endl;
}
result = rdc_start_embedded(RDC_OPERATION_MODE_AUTO, &rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
rdc_gpu_group_t group_id;
uint32_t count = 0;
rdc_group_info_t group_info;
uint32_t gpu_index_list[RDC_MAX_NUM_DEVICES];
result = rdc_group_gpu_create(0, RDC_GROUP_EMPTY,
"GRP_NAME", &group_id);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_group_gpu_create(rdc_handle, RDC_GROUP_EMPTY,
NULL, &group_id);
ASSERT_EQ(result, RDC_ST_BAD_PARAMETER);
result = rdc_group_gpu_create(rdc_handle, RDC_GROUP_EMPTY,
"GRP_NAME", NULL);
ASSERT_EQ(result, RDC_ST_BAD_PARAMETER);
result = rdc_group_gpu_create(rdc_handle, RDC_GROUP_EMPTY,
"GRP_NAME", &group_id);
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_group_gpu_add(rdc_handle,
group_id, -1);
ASSERT_EQ(result, RDC_ST_NOT_FOUND);
result = rdc_device_get_all(rdc_handle, gpu_index_list, &count);
ASSERT_EQ(result, RDC_ST_OK);
for (uint32_t i=0; i < count; i++) {
result = rdc_group_gpu_add(rdc_handle,
group_id, gpu_index_list[i]);
ASSERT_EQ(result, RDC_ST_OK);
}
rdc_gpu_group_t group_id_list[RDC_MAX_NUM_GROUPS];
result = rdc_group_get_all_ids(rdc_handle, group_id_list, NULL);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_group_get_all_ids(rdc_handle, group_id_list, &count);
ASSERT_EQ(result, RDC_ST_OK);
for (uint32_t i = 0; i < count; i++) {
result = rdc_group_gpu_get_info(rdc_handle,
group_id_list[i], NULL);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_group_gpu_get_info(rdc_handle,
group_id_list[i], &group_info);
ASSERT_EQ(result, RDC_ST_OK);
std::cout << "\tGroupID\t" << "GroupName\t" << "GPUIndex\n";
std::cout << "\t" << group_id_list[i] << "\t"
<< group_info.group_name << "\t\t";
for (uint32_t j = 0; j < group_info.count; j++) {
std::cout << group_info.entity_ids[j];
if (j < group_info.count -1) {
std::cout << ",";
}
}
std::cout << std::endl;
}
result = rdc_group_gpu_destroy(0, group_id);
ASSERT_EQ(result, RDC_ST_INVALID_HANDLER);
result = rdc_group_gpu_destroy(rdc_handle, group_id);
ASSERT_EQ(result, RDC_ST_OK);
}
Εκτελέσιμο αρχείο → Κανονικό αρχείο
+7 -7
Προβολή Αρχείου
@@ -19,17 +19,17 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef TESTS_RDC_TESTS_FUNCTIONAL_TEMP_READ_H_
#define TESTS_RDC_TESTS_FUNCTIONAL_TEMP_READ_H_
#ifndef TESTS_RDC_TESTS_FUNCTIONAL_RDCI_GROUP_H_
#define TESTS_RDC_TESTS_FUNCTIONAL_RDCI_GROUP_H_
#include "rdc_tests/test_base.h"
class TestTempRead : public TestBase {
class TestRdciGroup : public TestBase {
public:
TestTempRead();
TestRdciGroup();
// @Brief: Destructor for test case of TestTempRead
virtual ~TestTempRead();
// @Brief: Destructor for test case of TestRdciGroup
virtual ~TestRdciGroup();
// @Brief: Setup the environment for measurement
virtual void SetUp();
@@ -47,4 +47,4 @@ class TestTempRead : public TestBase {
virtual void DisplayTestInfo(void);
};
#endif // TESTS_RDC_TESTS_FUNCTIONAL_TEMP_READ_H_
#endif // TESTS_RDC_TESTS_FUNCTIONAL_RDCI_GROUP_H_
@@ -0,0 +1,137 @@
/*
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include "gtest/gtest.h"
#include "rdc_tests/functional/rdci_stats.h"
#include "rdc_tests/test_common.h"
#include "rdc/rdc.h"
TestRdciStats::TestRdciStats() : TestBase() {
set_title("\tRDC Stats Test");
set_description("\tThe Stats tests collects and verifies job statistics running on gpu groups.");
}
TestRdciStats::~TestRdciStats(void) {
}
void TestRdciStats::SetUp(void) {
TestBase::SetUp();
rdc_status_t result = AllocateRDCChannel();
ASSERT_EQ(result, RDC_ST_OK);
return;
}
void TestRdciStats::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestRdciStats::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestRdciStats::Close() {
TestBase::Close();
rdc_status_t result;
if(standalone_){
IF_VERB(STANDARD) {
std::cout << "\t**Disconnecting from host....\n" << std::endl;
}
result = rdc_disconnect(rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
else{
IF_VERB(STANDARD) {
std::cout << "\t**Stopping Embedded RDC Engine....\n" << std::endl;
}
result = rdc_stop_embedded(rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
result = rdc_shutdown();
ASSERT_EQ(result, RDC_ST_OK);
}
void TestRdciStats::Run(void) {
TestBase::Run();
rdc_status_t result;
if(standalone_){
IF_VERB(STANDARD) {
std::cout << "\t**Connecting to host....\n" << std::endl;
}
char hostIpAddress[] = {"localhost:50051"};
result = rdc_connect(hostIpAddress, &rdc_handle, nullptr, nullptr, nullptr);
ASSERT_EQ(result, RDC_ST_OK);
}
else{
IF_VERB(STANDARD) {
std::cout << "\t**Starting embedded RDC engine....\n" << std::endl;
}
result = rdc_start_embedded(RDC_OPERATION_MODE_AUTO, &rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
rdc_gpu_group_t group_id;
result = rdc_group_gpu_create(rdc_handle, RDC_GROUP_EMPTY,
"GRP_NAME", &group_id);
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_group_gpu_add(rdc_handle, group_id, 0);
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_job_start_stats(rdc_handle, group_id, "0", 1000000);
if (result == RDC_ST_NOT_SUPPORTED) {
std::cout <<
"\t** GPU Metric is not supported"
" on this machine" << std::endl;
return;
}
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_job_stop_stats(rdc_handle, "0");
ASSERT_EQ(result, RDC_ST_OK);
rdc_job_info_t job_info;
result = rdc_job_get_stats(rdc_handle, "0", &job_info);
if (result == RDC_ST_NOT_SUPPORTED) {
std::cout <<
"\t** GPU Metric is not supported"
" on this machine" << std::endl;
return;
}
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_job_remove(rdc_handle, "0");
ASSERT_EQ(result, RDC_ST_OK);
result = rdc_job_remove_all(rdc_handle);
ASSERT_EQ(result, RDC_ST_OK);
}
Εκτελέσιμο αρχείο → Κανονικό αρχείο
+8 -8
Προβολή Αρχείου
@@ -1,5 +1,5 @@
/*
Copyright (c) 2019 - Advanced Micro Devices, Inc. All rights reserved.
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -19,17 +19,17 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef TESTS_RDC_TESTS_FUNCTIONAL_ID_INFO_READ_H_
#define TESTS_RDC_TESTS_FUNCTIONAL_ID_INFO_READ_H_
#ifndef TESTS_RDC_TESTS_FUNCTIONAL_RDCI_STATS_H_
#define TESTS_RDC_TESTS_FUNCTIONAL_RDCI_STATS_H_
#include "rdc_tests/test_base.h"
class TestIdInfoRead : public TestBase {
class TestRdciStats : public TestBase {
public:
TestIdInfoRead();
TestRdciStats();
// @Brief: Destructor for test case of TestIdInfoRead
virtual ~TestIdInfoRead();
// @Brief: Destructor for test case of TestRdciStats
virtual ~TestRdciStats();
// @Brief: Setup the environment for measurement
virtual void SetUp();
@@ -47,4 +47,4 @@ class TestIdInfoRead : public TestBase {
virtual void DisplayTestInfo(void);
};
#endif // TESTS_RDC_TESTS_FUNCTIONAL_ID_INFO_READ_H_
#endif // TESTS_RDC_TESTS_FUNCTIONAL_RDCI_STATS_H_
@@ -1,140 +0,0 @@
/*
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include <string>
#include <map>
#include "gtest/gtest.h"
#include "rdc/rdc_client.h"
#include "rdc_tests/functional/temp_read.h"
#include "rdc_tests/test_common.h"
static const std::map<uint32_t, std::string> kTempSensorNameMap = {
{RSMI_TEMP_TYPE_MEMORY, "Memory"},
{RSMI_TEMP_TYPE_JUNCTION, "Junction"},
{RSMI_TEMP_TYPE_EDGE, "Edge"},
};
TestTempRead::TestTempRead() : TestBase() {
set_title("RDC Temp Read Test");
set_description("The Temperature Read tests verifies that the temperature "
"monitors can be read properly.");
}
TestTempRead::~TestTempRead(void) {
}
void TestTempRead::SetUp(void) {
TestBase::SetUp();
return;
}
void TestTempRead::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestTempRead::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestTempRead::Close() {
TestBase::Close();
}
void TestTempRead::Run(void) {
rdc_status_t err;
int64_t val_i64;
TestBase::Run();
err = AllocateRDCChannel();
ASSERT_EQ(err, RDC_STATUS_SUCCESS);
uint32_t type;
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(i);
auto print_temp_metric = [&](rsmi_temperature_metric_t met,
std::string label) {
err = rdc_dev_temp_metric_get(rdc_channel(), i, type, met, &val_i64);
if (err != RDC_STATUS_SUCCESS) {
if (err == RDC_RSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
std::cout << "\t**" << label << ": " <<
"Not supported on this machine" << std::endl;
// The following functionality only works for RSMI, so don't do
// for RDC:
// Verify api support checking functionality is working
// err = rdc_dev_temp_metric_get(rdc_channel(), i, type, met,
// nullptr);
// ASSERT_EQ(err, RDC_RSMI_STATUS_NOT_SUPPORTED);
return;
}
} else {
CHK_ERR_ASRT(err)
}
}
// Verify api support checking functionality is working
err = rdc_dev_temp_metric_get(rdc_channel(), i, type, met, nullptr);
ASSERT_EQ(err, RDC_RSMI_STATUS_INVALID_ARGS);
IF_VERB(STANDARD) {
std::cout << "\t**" << label << ": " << val_i64/1000 <<
"C" << std::endl;
}
};
for (type = RSMI_TEMP_TYPE_FIRST; type <= RSMI_TEMP_TYPE_LAST; ++type) {
IF_VERB(STANDARD) {
std::cout << "\t** **********" << kTempSensorNameMap.at(type) <<
" Temperatures **********" << std::endl;
}
print_temp_metric(RSMI_TEMP_CURRENT, "Current Temp.");
print_temp_metric(RSMI_TEMP_MAX, "Temperature max value");
print_temp_metric(RSMI_TEMP_MIN, "Temperature min value");
print_temp_metric(RSMI_TEMP_MAX_HYST,
"Temperature hysteresis value for max limit");
print_temp_metric(RSMI_TEMP_MIN_HYST,
"Temperature hysteresis value for min limit");
print_temp_metric(RSMI_TEMP_CRITICAL, "Temperature critical max value");
print_temp_metric(RSMI_TEMP_CRITICAL_HYST,
"Temperature hysteresis value for critical limit");
print_temp_metric(RSMI_TEMP_EMERGENCY,
"Temperature emergency max value");
print_temp_metric(RSMI_TEMP_EMERGENCY_HYST,
"Temperature hysteresis value for emergency limit");
print_temp_metric(RSMI_TEMP_CRIT_MIN, "Temperature critical min value");
print_temp_metric(RSMI_TEMP_CRIT_MIN_HYST,
"Temperature hysteresis value for critical min value");
print_temp_metric(RSMI_TEMP_OFFSET, "Temperature offset");
print_temp_metric(RSMI_TEMP_LOWEST, "Historical minimum temperature");
print_temp_metric(RSMI_TEMP_HIGHEST, "Historical maximum temperature");
}
}
}
+64 -40
Προβολή Αρχείου
@@ -29,14 +29,16 @@ THE SOFTWARE.
#include <fstream>
#include "gtest/gtest.h"
#include "rdc/rdc_client.h"
#include "rdc/rdc.h"
#include "rocm_smi/rocm_smi.h"
#include "rdc_tests/test_common.h"
#include "rdc_tests/test_base.h"
#include "functional/id_info_read.h"
#include "functional/temp_read.h"
#include "functional/fan_read.h"
#include "functional/rdci_discovery.h"
#include "functional/rdci_group.h"
#include "functional/rdci_dmon.h"
#include "functional/rdci_fieldgroup.h"
#include "functional/rdci_stats.h"
static RDCTstGlobals *sRDCGlvalues = nullptr;
@@ -49,6 +51,7 @@ static void SetFlags(TestBase *test) {
test->set_monitor_server_ip(sRDCGlvalues->monitor_server_ip);
test->set_monitor_server_port(sRDCGlvalues->monitor_server_port);
test->set_secure(sRDCGlvalues->secure);
test->set_mode(sRDCGlvalues->standalone);
}
static void RunCustomTestProlog(TestBase *test) {
@@ -77,27 +80,30 @@ static void RunGenericTest(TestBase *test) {
return;
}
// TEST ENTRY TEMPLATE:
// TEST(rocrtst, Perf_<test name>) {
// <Test Implementation class> <test_obj>;
//
// // Copy and modify implementation of RunGenericTest() if you need to deviate
// // from the standard pattern implemented there.
// RunGenericTest(&<test_obj>);
// }
TEST(rdctstReadOnly, TestIdInfoRead) {
TestIdInfoRead tst;
RunGenericTest(&tst);
}
TEST(rdctstReadOnly, TestTempRead) {
TestTempRead tst;
RunGenericTest(&tst);
}
TEST(rdctstReadOnly, FanRead) {
TestFanRead tst;
TEST(rdctstReadOnly, TestRdciDiscovery) {
TestRdciDiscovery tst;
RunGenericTest(&tst);
}
TEST(rdctstReadOnly, TestRdciGroup) {
TestRdciGroup tst;
RunGenericTest(&tst);
}
TEST(rdctstReadOnly, TestRdciDmon) {
TestRdciDmon tst;
RunGenericTest(&tst);
}
TEST(rdctstReadOnly, TestRdciFieldgroup) {
TestRdciFieldgroup tst;
RunGenericTest(&tst);
}
TEST(rdctstReadOnly, TestRdciStats) {
TestRdciStats tst;
RunGenericTest(&tst);
}
static int getPIDFromName(std::string name) {
int pid = -1;
@@ -171,7 +177,7 @@ static int killRDCD(int pid = 0) {
static int startRDCD(std::string *rdcd_path) {
assert(rdcd_path != nullptr);
const char *rdcd_cl[128] = {rdcd_path->c_str(), NULL};
const char *rdcd_cl[128] = {rdcd_path->c_str(), "-u", NULL};
int pid = fork();
if (pid == 0) {
@@ -199,29 +205,45 @@ int main(int argc, char** argv) {
settings.num_iterations = 1;
settings.dont_fail = false;
settings.init_options = 0;
settings.rdcd_path = "";
settings.rdcd_path = "../../../build/server/rdcd";
settings.monitor_server_ip = "";
settings.monitor_server_port = "";
settings.secure = true;
settings.secure = false;
settings.standalone = false;
if (ProcessCmdline(&settings, argc, argv)) {
return 1;
}
if (settings.monitor_server_ip == "") {
if (settings.rdcd_path != "") {
if (killRDCD()) {
return -1;
}
// Select the embedded mode and standalone mode dynamically.
std::cout << "Start rdci in: \n";
std::cout << "0 - Embedded mode \n";
std::cout << "1 - Standalone mode \n";
while (!(std::cin >> settings.standalone)) {
std::cout << "Invalid input.\n";
std::cin.clear();
std::cin.ignore();
}
std::cout << std::endl;
std::cout << (settings.standalone?
"Standalone mode selected.\n":"Embedded mode selected.\n");
rdcd_pid = startRDCD(&settings.rdcd_path);
assert(rdcd_pid == getPIDFromName("rdcd"));
} else {
if (getPIDFromName("rdcd") == -1) {
std::cout <<
"rdcd is not running. Use -d (--start_rdcd) to have rdcd started."
if (settings.standalone){
if (settings.monitor_server_ip == "") {
if (settings.rdcd_path != "") {
if (killRDCD()) {
return -1;
}
rdcd_pid = startRDCD(&settings.rdcd_path);
assert(rdcd_pid == getPIDFromName("rdcd"));
} else {
if (getPIDFromName("rdcd") == -1) {
std::cout <<
"rdcd is not running. Use -d (--start_rdcd) to have rdcd started."
" Exiting test." << std::endl;
return 1;
return 1;
}
}
}
}
@@ -243,9 +265,11 @@ int main(int argc, char** argv) {
settings.init_options = RSMI_INIT_FLAG_ALL_GPUS;
ret = RUN_ALL_TESTS();
if (rdcd_pid != -1) {
if (killRDCD(rdcd_pid)) {
return -1;
if (settings.standalone){
if (rdcd_pid != -1) {
if (killRDCD(rdcd_pid)) {
return -1;
}
}
}
return ret;
@@ -34,9 +34,11 @@ static const char kSetupLabel[] = "TEST SETUP";
static const char kRunLabel[] = "TEST EXECUTION";
static const char kCloseLabel[] = "TEST CLEAN UP";
static const char kResultsLabel[] = "TEST RESULTS";
rdc_status_t result;
TestBase::TestBase() : description_(""), rdc_channel_(0) {
/*TestBase::TestBase() : description_(""), rdc_channel_(0) {
}*/
TestBase::TestBase() : description_(""){
}
TestBase::~TestBase() {
}
@@ -58,7 +60,6 @@ void TestBase::SetUp(void) {
MakeHeaderStr(kSetupLabel, &label);
printf("\n\t%s\n", label.c_str());
return;
}
@@ -67,100 +68,23 @@ void TestBase::PrintDeviceHeader(uint32_t dv_ind) {
std::cout << "\t**Device index: " << dv_ind << std::endl;
}
// TODO(cfreehil): replace these sections with RDC equiv. as they are
// implemented
// err = rsmi_dev_id_get(dv_ind, &val_ui16);
// CHK_ERR_ASRT(err)
// IF_VERB(STANDARD) {
// std::cout << "\t**Device ID: 0x" << std::hex << val_ui16 << std::endl;
// }
// char name[128];
// err = rsmi_dev_name_get(dv_ind, name, 128);
// CHK_ERR_ASRT(err)
// IF_VERB(STANDARD) {
// std::cout << "\t**Device name: " << name << std::endl;
// }
// err = rsmi_dev_vendor_id_get(dv_ind, &val_ui16);
// CHK_ERR_ASRT(err)
// IF_VERB(STANDARD) {
// std::cout << "\t**Device Vendor ID: 0x" << std::hex << val_ui16 <<
// std::endl;
// }
// err = rsmi_dev_subsystem_id_get(dv_ind, &val_ui16);
// CHK_ERR_ASRT(err)
// IF_VERB(STANDARD) {
// std::cout << "\t**Subsystem ID: 0x" << std::hex << val_ui16 << std::endl;
// }
// err = rsmi_dev_subsystem_vendor_id_get(dv_ind, &val_ui16);
// CHK_ERR_ASRT(err)
// IF_VERB(STANDARD) {
// std::cout << "\t**Subsystem Vendor ID: 0x" << std::hex << val_ui16 <<
// std::endl;
// }
std::cout << std::setbase(10);
}
rdc_status_t
TestBase::AllocateRDCChannel(void) {
rdc_channel_t c;
rdc_status_t err;
IF_VERB(STANDARD) {
std::cout << "\t**Creating channel to host..." << std::endl;
std::cout << "\t**Initializing RDC" << std::endl;
}
rdc_status_t result = rdc_init(0);
if (result != RDC_ST_OK) {
std::cout << "Error initializing RDC.... " <<
rdc_status_string(result) << std::endl;
return result;
}
assert(rdc_channel() == 0);
err = rdc_channel_create(&c,
monitor_server_ip() == "" ? nullptr : monitor_server_ip().c_str(),
monitor_server_port() == "" ? nullptr : monitor_server_port().c_str(),
secure());
if (err != RDC_STATUS_SUCCESS) {
std::cout << "rdc_channel_create() failed" << std::endl;
return err;
}
grpc_connectivity_state grpc_state;
IF_VERB(STANDARD) {
std::cout << "\t**Channel created. Getting channel state..." << std::endl;
}
err = rdc_channel_state_get(c, true, &grpc_state);
if (err != RDC_STATUS_SUCCESS) {
std::cout << "rdc_channel_state_get() failed" << std::endl;
return err;
}
IF_VERB(STANDARD) {
std::cout << "\t**Channel state: \"" << GetGRPCChanStateStr(grpc_state) <<
"\"" << std::endl;
std::cout << "\tVerifying channel connection..." << std::endl;
}
err = rdc_channel_connection_verify(c);
if (err != RDC_STATUS_SUCCESS) {
std::cout << "rdc_channel_connection_verify() failed" << std::endl;
return err;
}
IF_VERB(STANDARD) {
std::cout << "\tConnection verified!" << std::endl;
}
set_rdc_channel(c);
err = rdc_num_gpus_get(rdc_channel(), &num_monitor_devs_);
if (err != RDC_STATUS_SUCCESS) {
std::cout << "rdc_num_gpus_get() failed" << std::endl;
return err;
}
IF_VERB(STANDARD) {
std::cout << "\t" << num_monitor_devs() << " devices found on host" <<
std::endl;
}
return RDC_STATUS_SUCCESS;
return result;
}
void TestBase::Run(void) {
@@ -172,14 +96,10 @@ void TestBase::Run(void) {
void TestBase::Close(void) {
std::string label;
rdc_status_t err;
MakeHeaderStr(kCloseLabel, &label);
printf("\n\t%s\n", label.c_str());
err = rdc_channel_destroy(rdc_channel());
ASSERT_EQ(err, RDC_STATUS_SUCCESS);
set_rdc_channel(0);
}
void TestBase::DisplayResults(void) const {
@@ -23,7 +23,7 @@ THE SOFTWARE.
#define TESTS_RDC_TESTS_TEST_BASE_H_
#include <string>
#include "rdc/rdc_client.h"
#include "rdc/rdc.h"
class TestBase {
public:
@@ -83,12 +83,7 @@ class TestBase {
uint64_t init_options(void) const {
return init_options_;
}
void set_rdc_channel(rdc_channel_t c) {
rdc_channel_ = c;
}
rdc_channel_t rdc_channel(void) const {
return rdc_channel_;
}
void set_monitor_server_ip(std::string ip) {
monitor_server_ip_ = ip;
}
@@ -107,10 +102,15 @@ class TestBase {
bool secure(void) const {
return secure_;
}
bool set_mode(bool standalone) {
standalone_ = standalone;
}
rdc_handle_t rdc_handle;
protected:
void PrintDeviceHeader(uint32_t dv_ind);
rdc_status_t AllocateRDCChannel(void);
bool standalone_;
private:
uint64_t num_monitor_devs_; ///< Number of monitor devices found
@@ -121,8 +121,8 @@ class TestBase {
uint64_t init_options_; ///< rsmi initialization options
std::string monitor_server_ip_;
std::string monitor_server_port_;
rdc_channel_t rdc_channel_;
bool secure_; // Use authenticated comms. (SSL/TSL)
};
#define IF_VERB(VB) if (verbosity() && verbosity() >= (TestBase::VERBOSE_##VB))
@@ -32,7 +32,7 @@ THE SOFTWARE.
#include "rdc_tests/test_common.h"
#include "rocm_smi/rocm_smi.h"
static const std::map<grpc_connectivity_state, const char *> kGRPCChanState = {
/*static const std::map<grpc_connectivity_state, const char *> kGRPCChanState = {
{
{GRPC_CHANNEL_IDLE, "GRPC_CHANNEL_IDLE: Channel is idle"},
{GRPC_CHANNEL_CONNECTING,
@@ -44,7 +44,7 @@ static const std::map<grpc_connectivity_state, const char *> kGRPCChanState = {
"Channel has seen a failure that it cannot recover from"},
},
};
*/
static const std::map<rsmi_gpu_block_t, const char *> kBlockNameMap = {
{RSMI_GPU_BLOCK_UMC, "UMC"},
{RSMI_GPU_BLOCK_SDMA, "SDMA"},
@@ -206,9 +206,9 @@ const char *GetBlockNameStr(rsmi_gpu_block_t id) {
const char *GetErrStateNameStr(rsmi_ras_err_state_t st) {
return kErrStateNameMap.at(st);
}
const char *GetGRPCChanStateStr(grpc_connectivity_state st) {
/*const char *GetGRPCChanStateStr(grpc_connectivity_state st) {
return kGRPCChanState.at(st);
}
}*/
const char *FreqEnumToStr(rsmi_clk_type rsmi_clk) {
static_assert(RSMI_CLK_TYPE_LAST == RSMI_CLK_TYPE_MEM,
@@ -39,6 +39,7 @@ struct RDCTstGlobals {
uint64_t init_options;
bool dont_fail;
bool secure;
bool standalone;
};
uint32_t ProcessCmdline(RDCTstGlobals* test, int arg_cnt, char** arg_list);
@@ -46,7 +47,7 @@ uint32_t ProcessCmdline(RDCTstGlobals* test, int arg_cnt, char** arg_list);
void PrintTestHeader(uint32_t dv_ind);
const char *GetBlockNameStr(rsmi_gpu_block_t id);
const char *GetErrStateNameStr(rsmi_ras_err_state_t st);
const char *GetGRPCChanStateStr(grpc_connectivity_state st);
//const char *GetGRPCChanStateStr(grpc_connectivity_state st);
const char *FreqEnumToStr(rsmi_clk_type rsmi_clk);
#if ENABLE_SMI