Skip to contentSkip to conversation

realtime:matrix_multi: main function to return exit status

PATCH In review Bogdan Lezhepekov 4 participants 4 messages Sep 13, 2021 – Nov 12, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 realtime:matrix_multi: main function to return exit status

The original version always returned 0.

---
 testcases/realtime/func/matrix_mult/matrix_mult.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
testcases/realtime/func/matrix_mult/matrix_mult.c +5 -5
index 61ab887fc..e702c0ff9 100644
@@ -188,7 +188,7 @@ void *concurrent_thread(void *thread)
 	return NULL;
 }
 
-void main_thread(void)
+int main_thread(void)
 {
 	int ret, i, j;
 	nsec_t start, end;
@@ -308,7 +308,7 @@ void main_thread(void)
 	     criteria);
 	printf("Result: %s\n", ret ? "FAIL" : "PASS");
 
-	return;
+	return ret;
 }
 
 int main(int argc, char *argv[])
@@ -319,7 +319,7 @@ int main(int argc, char *argv[])
 	numcpus = sysconf(_SC_NPROCESSORS_ONLN);
 	/* the minimum avg concurrent multiplier to pass */
 	criteria = pass_criteria * numcpus;
-	int new_iterations;
+	int new_iterations, ret;
 
 	if (iterations <= 0) {
 		fprintf(stderr, "iterations must be greater than zero\n");
@@ -348,7 +348,7 @@ int main(int argc, char *argv[])
 	printf("Number of CPUs: %u\n", numcpus);
 
 	set_priority(PRIO);
-	main_thread();
+	ret = main_thread();
 
-	return 0;
+	return ret;
 }
Signature · 1 line
2.32.0
#1 lore raw

PATCH 1/1 realtime:matrix_multi: main function to return exit status

Hi Bogdan,

Quoted 1 line

The original version always returned 0.

Good catch, merged!

Kind regards,
Petr

#2 lore raw
In reply to Bogdan Lezhepekov

Hi,

is the test even returning any valid results anywhere?
I don't know if systems are running too fast for the test nowadays,
but in my tests, they always divide by 0, even with very high iteration counts even in qemu.

e.g:

$ matrix_mult -i10000000

---------------------------------------
Matrix Multiplication (SMP Performance)
---------------------------------------

Running 10000000 iterations
Matrix Dimensions: 100x100
Calculations per iteration: 8
Number of CPUs: 4

Running sequential operations
Min: 0 us
Max: 160 us
Avg: 0.0000 us
StdDev: 0.2082 us

Running concurrent operations
Min: 0 us
Max: 1693 us
Avg: 0.0000 us
StdDev: 0.6652 us

Concurrent Multipliers:
Min: -nan
Max: 0.0945
Avg: -nan

Criteria: 3.00 * average concurrent time < average sequential time
Result: FAIL

If this is not a result of my test system, we should probably remove the test from the profile, at least as long as it was not fixed.

Joerg

Quoted 48 lines · Bogdan Lezhepekov via ltp

The original version always returned 0.

---
  testcases/realtime/func/matrix_mult/matrix_mult.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
testcases/realtime/func/matrix_mult/matrix_mult.c +5 -5
index 61ab887fc..e702c0ff9 100644
@@ -188,7 +188,7 @@ void *concurrent_thread(void *thread)
  	return NULL;
  }
 
-void main_thread(void)
+int main_thread(void)
  {
  	int ret, i, j;
  	nsec_t start, end;
@@ -308,7 +308,7 @@ void main_thread(void)
  	     criteria);
  	printf("Result: %s\n", ret ? "FAIL" : "PASS");
 
-	return;
+	return ret;
  }
 
  int main(int argc, char *argv[])
@@ -319,7 +319,7 @@ int main(int argc, char *argv[])
  	numcpus = sysconf(_SC_NPROCESSORS_ONLN);
  	/* the minimum avg concurrent multiplier to pass */
  	criteria = pass_criteria * numcpus;
-	int new_iterations;
+	int new_iterations, ret;
 
  	if (iterations <= 0) {
  		fprintf(stderr, "iterations must be greater than zero\n");
@@ -348,7 +348,7 @@ int main(int argc, char *argv[])
  	printf("Number of CPUs: %u\n", numcpus);
 
  	set_priority(PRIO);
-	main_thread();
+	ret = main_thread();
 
-	return 0;
+	return ret;
  }
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Hi Joerg,

​​No, this is a braindead test. Our results are pretty consistent with ours and that's why we excluded one from the regression loop.

The return value was fixed just because I was fixing it everywhere wherever it caught my eye 🙂

-Bogdan
________________________________
From: Joerg Vehlow <[email protected]>
Sent: Friday, November 12, 2021 14:07
To: Bogdan Lezhepekov <[email protected]>; [email protected] <[email protected]>
Subject: Re: [LTP] [PATCH v1] realtime:matrix_multi: main function to return exit status

Hi,

is the test even returning any valid results anywhere?
I don't know if systems are running too fast for the test nowadays, but in my tests, they always divide by 0, even with very high iteration counts even in qemu.

e.g:

$ matrix_mult -i10000000

---------------------------------------
Matrix Multiplication (SMP Performance)
---------------------------------------

Running 10000000 iterations
Matrix Dimensions: 100x100
Calculations per iteration: 8
Number of CPUs: 4

Running sequential operations
Min: 0 us
Max: 160 us
Avg: 0.0000 us
StdDev: 0.2082 us

Running concurrent operations
Min: 0 us
Max: 1693 us
Avg: 0.0000 us
StdDev: 0.6652 us

Concurrent Multipliers:
Min: -nan
Max: 0.0945
Avg: -nan

Criteria: 3.00 * average concurrent time < average sequential time
Result: FAIL

If this is not a result of my test system, we should probably remove the test from the
profile, at least as long as it was not fixed.

Joerg

Quoted 48 lines · Bogdan Lezhepekov via ltp

The original version always returned 0.

---
  testcases/realtime/func/matrix_mult/matrix_mult.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
testcases/realtime/func/matrix_mult/matrix_mult.c +5 -5
index 61ab887fc..e702c0ff9 100644
@@ -188,7 +188,7 @@ void *concurrent_thread(void *thread)
       return NULL;
  }
 
-void main_thread(void)
+int main_thread(void)
  {
       int ret, i, j;
       nsec_t start, end;
@@ -308,7 +308,7 @@ void main_thread(void)
            criteria);
       printf("Result: %s\n", ret ? "FAIL" : "PASS");
 
-     return;
+     return ret;
  }
 
  int main(int argc, char *argv[])
@@ -319,7 +319,7 @@ int main(int argc, char *argv[])
       numcpus = sysconf(_SC_NPROCESSORS_ONLN);
       /* the minimum avg concurrent multiplier to pass */
       criteria = pass_criteria * numcpus;
-     int new_iterations;
+     int new_iterations, ret;
 
       if (iterations <= 0) {
               fprintf(stderr, "iterations must be greater than zero\n");
@@ -348,7 +348,7 @@ int main(int argc, char *argv[])
       printf("Number of CPUs: %u\n", numcpus);
 
       set_priority(PRIO);
-     main_thread();
+     ret = main_thread();
 
-     return 0;
+     return ret;
  }
Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp