wrong testing result of mbw
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mbw (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
The testing result of mbw tool installed by running “apt install mbw” is shown below.
(tf2) bruce@P800002:
Long uses 8 bytes. Allocating 2*134217728 elements = 2147483648 bytes of memory.
Using 262144 bytes as blocks for memcpy block copy test.
Getting down to business... Doing 1 runs per test.
0 Method: MEMCPY Elapsed: 0.20496 MiB: 1024.00000 Copy: 4996.097 MiB/s
0 Method: DUMB Elapsed: 0.11309 MiB: 1024.00000 Copy: 9055.136 MiB/s
0 Method: MCBLOCK Elapsed: 0.18077 MiB: 1024.00000 Copy: 5664.625 MiB/s
But the testing result from newest version of mbw which is downloaded from github and built by myself is totally different with the former one.
(tf2) bruce@P800002:
Long uses 8 bytes. Allocating 2*134217728 elements = 2147483648 bytes of memory.
Using 262144 bytes as blocks for memcpy block copy test.
Getting down to business... Doing 1 runs per test.
0 Method: MEMCPY Elapsed: 0.11314 MiB: 1024.00000 Copy: 9050.334 MiB/s
0 Method: DUMB Elapsed: 0.20412 MiB: 1024.00000 Copy: 5016.632 MiB/s
0 Method: MCBLOCK Elapsed: 0.22396 MiB: 1024.00000 Copy: 4572.225 MiB/s
From the output of self-built mbw, you can see the speed of MEMCPY is about 9050.334 MiB/s (much higher than the case of DUMB), but it is only 4996.097 MiB/s in the output of apt-installed mbw (much lower than the case of DUMB).
After reading output of “git log -p mbw.c”, I believe apt repository is still using a very old version of mbw, and unfortunately this version involves a seriously issue which was fixed in the following changeset.
In this changeset, the code “if(type==1)” was changed to “if(type=
Looking forward to fix this problem in apt repository by updating to newest mbw in github.
diff --git a/mbw.c b/mbw.c
index 6251ea9..06a9d09 100644
--- a/mbw.c
+++ b/mbw.c
@@ -23,6 +23,11 @@
/* default block size for test 2, in bytes */
#define DEFAULT_BLOCK_SIZE 262144
+/* test types */
+#define TEST_MEMCPY 0
+#define TEST_DUMB 1
+#define TEST_MCBLOCK 2
+
/*
* MBW memory bandwidth benchmark
*
@@ -50,9 +55,9 @@ void usage()
printf(
printf(" -n: number of runs per test\n");
printf(" -a: Don't display average\n");
- printf(" -t0: memcpy test\n");
- printf(" -t1: dumb (b[i]=a[i] style) test\n");
- printf(" -t2 : memcpy test with fixed block size\n");
+ printf(" -t%d: memcpy test\n", TEST_MEMCPY);
+ printf(" -t%d: dumb (b[i]=a[i] style) test\n", TEST_DUMB);
+ printf(" -t%d: memcpy test with fixed block size\n", TEST_MCBLOCK);
printf(" -b <size>: block size in bytes for -t2 (default: %d)\n", DEFAULT_
printf(" -q: quiet (print statistics only)\n");
printf("(will then use two arrays, watch out for swapping)\n");
@@ -100,13 +105,13 @@ double worker(unsigned long long asize, long *a, long *b, int type, unsigned lon
/* array size in bytes */
unsigned long long array_bytes=
- if(type==1) { /* memcpy test */
+ if(type=
/* timer starts */
memcpy(b, a, array_bytes);
/* timer stops */
- } else if(type==2) { /* memcpy block test */
+ } else if(type=
char* aa = (char*)a;
char* bb = (char*)b;
@@ -117,7 +122,7 @@ double worker(unsigned long long asize, long *a, long *b, int type, unsigned lon
}
- } else { /* dumb test */
+ } else if(type==TEST_DUMB) { /* dumb test */
for(t=0; t<asize; t++) {
@@ -142,13 +147,13 @@ double worker(unsigned long long asize, long *a, long *b, int type, unsigned lon
void printout(double te, double mt, int type)
{
switch(type) {
- case 0:
+ case TEST_MEMCPY:
break;
- case 1:
+ case TEST_DUMB:
break;
- case 2:
+ case TEST_MCBLOCK:
break;
}
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: mbw 1.2.2-1build1
Uname: Linux 5.8.1inspurp8000 x86_64
ApportVersion: 2.20.9-0ubuntu7.24
Architecture: amd64
Date: Fri Jul 23 14:15:17 2021
Dependencies:
gcc-8-base 8.4.0-1ubuntu1~
libc6 2.27-3ubuntu1.4
libgcc1 1:8.4.0-
InstallationDate: Installed on 2021-07-07 (15 days ago)
InstallationMedia: Ubuntu 18.04.5 LTS "Bionic Beaver" - Release amd64 (20200806.1)
SourcePackage: mbw
UpgradeStatus: No upgrade log present (probably fresh install)