SWDEV-387560 rocprofiler changes for CI test scripts

Change-Id: Ie727424eae47502395e0779614bd5e863ed9a197


[ROCm/rocprofiler commit: a56b32e4eb]
Bu işleme şunda yer alıyor:
gobhardw
2023-04-05 14:38:11 +05:30
ebeveyn b130d67bb8
işleme 56437acbd1
6 değiştirilmiş dosya ile 153 ekleme ve 49 silme
+63 -37
Dosyayı Görüntüle
@@ -34,23 +34,53 @@ THE SOFTWARE.
#include "utils/test_utils.h"
#include "utils/csv_parser.h"
std::string running_path;
std::string lib_path;
std::string golden_trace_path;
std::string test_app_path;
std::string metrics_path;
std::string binary_path;
static void init_test_path() {
if (is_installed_path()) {
running_path = "share/rocprofiler/tests/runFeatureTests";
lib_path = "lib/librocprofiler_tool.so";
golden_trace_path = "share/rocprofiler/tests/featuretests/profiler/apps/goldentraces/";
test_app_path = "share/rocprofiler/tests/featuretests/profiler/apps/";
metrics_path = "lib/rocprofiler/gfx_metrics.xml";
binary_path = "bin/rocprofv2";
} else {
running_path = "tests/featuretests/profiler/runFeatureTests";
lib_path = "librocprofiler_tool.so";
golden_trace_path = "tests/featuretests/profiler/apps/goldentraces/";
test_app_path = "tests/featuretests/profiler/apps/";
metrics_path = "gfx_metrics.xml";
binary_path = "rocprofv2";
}
}
/**
* Sets application enviornment by seting HSA_TOOLS_LIB.
*/
void ApplicationParser::SetApplicationEnv(const char* app_name) {
std::string app_path = GetRunningPath("tests/featuretests/profiler/runFeatureTests");
std::string app_path;
// set global path
init_test_path();
app_path = GetRunningPath(running_path);
std::stringstream counter_path;
std::stringstream metrics_path;
counter_path << app_path << "tests/featuretests/profiler/apps/goldentraces/input.txt";
counter_path << app_path << golden_trace_path << "input.txt";
setenv("COUNTERS_PATH", counter_path.str().c_str(), true);
std::stringstream hsa_tools_lib_path;
hsa_tools_lib_path << app_path << "librocprofiler_tool.so";
hsa_tools_lib_path << app_path << lib_path;
setenv("LD_PRELOAD", hsa_tools_lib_path.str().c_str(), true);
std::stringstream os;
os << app_path << "tests/featuretests/profiler/apps/" << app_name;
os << app_path << test_app_path << app_name;
ProcessApplication(os);
}
@@ -111,9 +141,9 @@ void ApplicationParser::GetKernelInfoForRunningApplication(
void ApplicationParser::GetKernelInfoForGoldenOutput(const char* app_name, std::string file_name,
std::vector<KernelInfo>* kernel_info_output) {
std::string entry;
std::string path = GetRunningPath("runFeatureTests");
entry = path.append("apps/goldentraces/") + file_name;
// parse kernel info fields for golden output
std::string path = GetRunningPath(running_path);
entry = path.append(golden_trace_path) + file_name;
// parse kernel info fields for golden output
ParseKernelInfoFields(entry, kernel_info_output);
}
@@ -459,7 +489,7 @@ class MPITest : public ProfilerTest {
};
void MPITest::ProcessMPIApplication(const char* app_name) {
std::string app_path = GetRunningPath("tests/featuretests/profiler/runFeatureTests");
std::string app_path = GetRunningPath(running_path);
std::string lib_path = app_path;
std::stringstream hsa_tools_lib_path;
@@ -658,11 +688,6 @@ class ATTCollection : public ::testing::Test {
hipDeviceProp_t devProp;
hipGetDeviceProperties(&devProp, 0);
// std::cout << " System minor " << devProp.minor << std::endl;
// std::cout << " System major " << devProp.major << std::endl;
// std::cout << " agent prop name " << devProp.name << std::endl;
// std::cout << "hip Device prop succeeded " << std::endl;
int i;
int errors;
@@ -835,10 +860,14 @@ class ProfilerAPITest : public ::testing::Test {
};
TEST_F(ProfilerAPITest, WhenRunningMultipleThreadsProfilerAPIsWorkFine) {
std::string app_path = GetRunningPath("tests/featuretests/profiler/runFeatureTests");
std::stringstream metrics_path;
metrics_path << app_path << "gfx_metrics.xml";
setenv("ROCPROFILER_METRICS_PATH", metrics_path.str().c_str(), true);
// set global path
init_test_path();
std::string app_path = GetRunningPath(running_path);
std::stringstream gfx_path;
gfx_path << app_path << metrics_path;
setenv("ROCPROFILER_METRICS_PATH", gfx_path.str().c_str(), true);
// Get the system cores
int num_cpu_cores = GetNumberOfCores();
@@ -963,11 +992,6 @@ class ProfilerSPMTest : public ::testing::Test {
hipDeviceProp_t devProp;
hipGetDeviceProperties(&devProp, 0);
// std::cout << " System minor " << devProp.minor << std::endl;
// std::cout << " System major " << devProp.major << std::endl;
// std::cout << " agent prop name " << devProp.name << std::endl;
// std::cout << "hip Device prop succeeded " << std::endl;
int i;
int errors;
@@ -1100,7 +1124,7 @@ class MTBinaryTest : public ::testing::Test {
}
}
}
// clear entries
counter_map.clear();
@@ -1110,7 +1134,7 @@ class MTBinaryTest : public ::testing::Test {
return 0;
}
return 0; // Fix CSV parser, until return 0
return 0; // Fix CSV parser, until return 0
}
std::string ReadProfilerBuffer(const char* cmd) {
@@ -1129,11 +1153,12 @@ class MTBinaryTest : public ::testing::Test {
std::string InitCounterTest() {
std::string input_path;
std::string rocprofv2_path = GetRunningPath("tests/featuretests/profiler/runFeatureTests");
std::string app_path = GetRunningPath(running_path);
std::stringstream command;
input_path = rocprofv2_path + "tests/featuretests/profiler/apps/";
command << rocprofv2_path + "./rocprofv2 -i " << input_path + "basic_metrics.txt "
<< input_path + "multithreaded_testapp";
input_path = app_path + golden_trace_path;
command << app_path + binary_path + " -i " << input_path + "basic_metrics.txt "
<< app_path + test_app_path + "multithreaded_testapp";
std::string result = ReadProfilerBuffer(command.str().c_str());
return result;
}
@@ -1182,7 +1207,7 @@ class ProfilerMQTest : public ::testing::Test {
if (dispatch_counter == dispatch_count) {
return 0;
}
return 0; //Fix CSV parser, until return 0
return 0; // Fix CSV parser, until return 0
}
std::string ReadProfilerBuffer(const char* cmd) {
@@ -1200,20 +1225,21 @@ class ProfilerMQTest : public ::testing::Test {
}
std::string InitMultiQueueTest() {
std::string rocprofv2_path = GetRunningPath("tests/featuretests/profiler/runFeatureTests");
std::string app_path = GetRunningPath(running_path);
std::string input_path;
input_path = rocprofv2_path + "tests/featuretests/profiler/apps/";
input_path = app_path + "share/rocprofiler/tests/featuretests/profiler/apps/goldentraces/";
std::stringstream command;
command << rocprofv2_path + "./rocprofv2 -i " << input_path + "input.txt "
<< input_path + "multiqueue_testapp";
command << app_path + binary_path + " -i " << input_path + "basic_metrics.txt "
<< app_path + test_app_path + "multiqueue_testapp";
std::string result = ReadProfilerBuffer(command.str().c_str());
return result;
}
};
TEST_F(ProfilerMQTest, WhenRunningMultiProcessTestItPasses) {
TEST_F(ProfilerMQTest, DISBALED_WhenRunningMultiProcessTestItPasses) {
int test_status = -1;
std::string profiler_output;
@@ -1234,8 +1260,8 @@ TEST_F(ProfilerMQTest, WhenRunningMultiProcessTestItPasses) {
void KernelLaunch() {
// run empty kernel
//kernel<<<1, 1>>>(); //TODO: Check the hang
//hipDeviceSynchronize();
// kernel<<<1, 1>>>(); //TODO: Check the hang
// hipDeviceSynchronize();
}
TEST(ProfilerMPTest, WhenRunningMultiProcessTestItPasses) {