Fix an intermittent failure in "tool flushing test"

The test (MatrixTranspose) and the tracer tool both write to stdout
which sometime causes a trace corruption.

Change the test to emit info messages to stderr instead of stdout,
leaving stdout for the tracer tool's exclusive use.

Change-Id: I18047dbcd9039b70dd24ef6e7e8e9d89b40bedd2


[ROCm/roctracer commit: bbe1db3810]
这个提交包含在:
Laurent Morichetti
2022-05-11 15:27:01 -07:00
提交者 Laurent Morichetti
父节点 10d27fb4a7
当前提交 1eef82000d
修改 3 个文件,包含 13 行新增13 行删除
@@ -67,7 +67,7 @@ int main() {
hipDeviceProp_t devProp;
hipGetDeviceProperties(&devProp, 0);
std::cout << "Device name " << devProp.name << std::endl;
std::cerr << "Device name " << devProp.name << std::endl;
int i;
int errors;
@@ -87,7 +87,7 @@ int main() {
uint32_t iterations = 100;
while (iterations-- > 0) {
std::cout << "## Iteration (" << iterations << ") #################" << std::endl;
std::cerr << "## Iteration (" << iterations << ") #################" << std::endl;
// Memory transfer from host to device
hipMemcpy(gpuMatrix, Matrix, NUM * sizeof(float), hipMemcpyHostToDevice);
@@ -124,9 +124,9 @@ int main() {
}
}
if (errors != 0) {
printf("FAILED: %d errors\n", errors);
fprintf(stderr, "FAILED: %d errors\n", errors);
} else {
printf("PASSED!\n");
fprintf(stderr, "PASSED!\n");
}
}
@@ -126,7 +126,7 @@ int main() {
int gpuCount = 1;
#if MGPU_TEST
hipGetDeviceCount(&gpuCount);
printf("Number of GPUs: %d\n", gpuCount);
fprintf(stderr, "Number of GPUs: %d\n", gpuCount);
#endif
iterations *= gpuCount;
#endif
@@ -141,7 +141,7 @@ int main() {
hipDeviceProp_t devProp;
HIP_CALL(hipGetDeviceProperties(&devProp, 0));
printf("Device %d name: %s\n", devIndex, devProp.name);
fprintf(stderr, "Device %d name: %s\n", devIndex, devProp.name);
#endif
Matrix = (float*)malloc(NUM * sizeof(float));
@@ -206,10 +206,10 @@ int main() {
}
}
if ((HIP_TEST != 0) && (errors != 0)) {
printf("FAILED: %d errors\n", errors);
fprintf(stderr, "FAILED: %d errors\n", errors);
} else {
errors = 0;
printf("PASSED!\n");
fprintf(stderr, "PASSED!\n");
}
// free the resources on device side
@@ -325,7 +325,7 @@ void activity_callback(const char* begin, const char* end, void* arg) {
} else if (record->domain == ACTIVITY_DOMAIN_EXT_API) {
SPRINT(" external_id(%lu)", record->external_id);
} else {
fprintf(stderr, "Bad domain %d\n\n", record->domain);
fprintf(stdout, "Bad domain %d\n\n", record->domain);
abort();
}
SPRINT("\n");
@@ -337,7 +337,7 @@ void activity_callback(const char* begin, const char* end, void* arg) {
// Init tracing routine
void init_tracing() {
printf("# INIT #############################\n");
fprintf(stderr, "# INIT #############################\n");
// roctracer properties
roctracer_set_properties(ACTIVITY_DOMAIN_HIP_API, NULL);
// Allocating tracing pool
@@ -361,7 +361,7 @@ void init_tracing() {
// Start tracing routine
void start_tracing() {
printf("# START (%d) #############################\n", iterations);
fprintf(stderr, "# START (%d) #############################\n", iterations);
// Start
if ((iterations & 1) == 1)
roctracer_start();
@@ -379,7 +379,7 @@ void stop_tracing() {
ROCTRACER_CALL(roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HSA_OPS));
ROCTRACER_CALL(roctracer_disable_domain_callback(ACTIVITY_DOMAIN_ROCTX));
ROCTRACER_CALL(roctracer_flush_activity());
printf("# STOP #############################\n");
fprintf(stderr, "# STOP #############################\n");
}
#else
void init_tracing() {}
+1 -1
查看文件
@@ -80,7 +80,7 @@ eval_test() {
echo "test $test_number: $test_name \"$label\""
echo "CMD: \"$cmdline\""
test_runnum=$((test_runnum + 1))
eval "$cmdline" >$test_trace 2>&1
eval "$cmdline" 1>$test_trace 2>$test_name.err
is_failed=$?
if [ $is_failed != 0 ] ; then
cat $test_trace