Przemek:
>I've just fixed above problems in thread.c.
>If possible please try to recompile Harbour once again
>and try to build tests/mt/*.prg programs using libhbvmmt instead
>of libhbvm. If everything is correct then they should work.
I used
set C_USR=-DHB_FM_STATISTICS_OFF
It build hbvmmt.a without warnings, thanks
Now Harbour is multithread in OS/2 ? :-)
>It's yet another C compiler which needs better memory manager.
>The one located by Mindaugas seems to be very good choice for
>such situations.
:-(
Below are results of some tests:
a) memtst.prg
ST: Fail with hb_xrealloc error
MT: Does not fail. Why ?
b) speedtst.prg
ST without HB_FM_STATISTICS_OFF and using hbrun speedtst.prg
total application time: 53.30
total real time: 53.30
ST
total application time: 46.77
total real time: 46.78
MT
total application time: 135.88
total real time: 135.88
does not show too much difference between both ST but large with MT
c) mt\mttest01.prg - 07.prg
No one failed
David Macias
AMD Athlon 2200+ 2.0GHz, 1 Gb RAM, gcc 3.3.5
a) memtst.prg
------------------------
[E:\harbour809mt\harbour\tests] memtst_st.exe
09/17/08 02:13:57 Harbour 1.1.0dev (Rev. 9421), OS/2 4.50
testing single large memory blocks allocation and freeing...
CPU time: 1.22 sec.
real time: 1.22 sec.
testing many large memory blocks allocation and freeing...
CPU time: 9.72 sec.
real time: 9.72 sec.
testing large memory block reallocation with intermediate allocations...
Warning!!! some compilers may badly fail here
Press any key to continue... 1000 2000 3000 4000
5000
6000 7000 8000 9000 10000 11000 12000
13000
14000 15000 16000 17000 18000 19000 20000
21000
22000 23000 24000 25000 26000 27000 28000
29000
30000 31000 32000 33000 34000 35000 36000
37000
38000 39000 40000 41000 42000 43000 44000
45000
46000 47000 48000 49000 50000 51000 52000
53000
54000 55000 56000 57000 58000 59000 60000
61000
62000 63000 64000
Unrecoverable error 9009: hb_xrealloc can't reallocate memory
Called from AADD(0)
Called from MAIN(67) in memtst.prg
------------------------
[E:\harbour809mt\harbour\tests] memtst_mt.exe
09/17/08 02:16:58 Harbour 1.1.0dev (Rev. 9421) (MT), OS/2 4.50
testing single large memory blocks allocation and freeing...
CPU time: 1.30 sec.
real time: 1.30 sec.
testing many large memory blocks allocation and freeing...
CPU time: 10.06 sec.
real time: 10.06 sec.
testing large memory block reallocation with intermediate allocations...
Warning!!! some compilers may badly fail here
Press any key to continue... 1000 2000 3000 4000
5000
6000 7000 8000 9000 10000 11000 12000
13000
14000 15000 16000 17000 18000 19000 20000
21000
22000 23000 24000 25000 26000 27000 28000
29000
30000 31000 32000 33000 34000 35000 36000
37000
38000 39000 40000 41000 42000 43000 44000
45000
46000 47000 48000 49000 50000 51000 52000
53000
54000 55000 56000 57000 58000 59000 60000
61000
62000 63000 64000 65000 66000 67000 68000
69000
70000 71000 72000 73000 74000 75000 76000
77000
78000 79000 80000 81000 82000 83000 84000
85000
86000 87000 88000 89000 90000 91000 92000
93000
94000 95000 96000 97000 98000 99000 100000
CPU time: 1.09 sec.
real time: 1.09 sec.
Press any key to continue...
------------------------
b) speedtst.prg
speedtst_st.exe
------------------------
Startup loop to increase CPU clock...
09/16/08 23:42:14 Harbour 1.1.0dev (Rev. 9421), OS/2 4.50
ARR_LEN = 16
N_LOOPS = 1000000
empty loops overhead = 0.14
CPU usage -> secondsCPU()
c:=L_C -> 0.10
n:=L_N -> 0.09
d:=L_D -> 0.09
c:=M_C -> 0.12
n:=M_N -> 0.10
d:=M_D -> 0.10
(sh) c:=F_C -> 0.51
(sh) n:=F_N -> 0.33
(sh) d:=F_D -> 0.21
(ex) c:=F_C -> 0.52
(ex) n:=F_N -> 0.34
(ex) d:=F_D -> 0.21
n:=o:GenCode -> 0.32
n:=o[8] -> 0.21
round(i/1000,2) -> 0.45
str(i/1000) -> 1.37
val(a3[i%ARR_LEN+1]) -> 0.91
dtos(j+i%10000-5000) -> 1.14
eval({||i%ARR_LEN}) -> 0.45
eval({|x|x%ARR_LEN},i) -> 0.48
eval({|x|f1(x)},i) -> 0.69
&('f1('+str(i)+')') -> 8.05
eval([&('{|x|f1(x)}')]) -> 0.71
j := valtype(a)+valtype(i) -> 0.90
j := str(i%100,2) $ a2[i%ARR_LEN+1] -> 1.81
j := val(a2[i%ARR_LEN+1]) -> 0.91
j := a2[i%ARR_LEN+1] == s -> 0.63
j := a2[i%ARR_LEN+1] = s -> 0.70
j := a2[i%ARR_LEN+1] >= s -> 0.65
j := a2[i%ARR_LEN+1] < s -> 0.64
aadd(aa,{i,j,s,a,a2,t,bc}) -> 2.32
f0() -> 0.29
f1(i) -> 0.41
f2(c[8]) -> 0.32
f2(c[40000]) -> 0.31
f2(@c[40000]) -> 0.31
f2(c[40000]); c2:=c -> 0.43
f2(@c[40000]); c2:=c -> 0.43
f3(a,a2,c,i,j,t,bc) -> 0.72
f2(a2) -> 0.32
s:=f4() -> 1.39
s:=f5() -> 0.77
ascan(a,i%ARR_LEN) -> 0.61
ascan(a2,c+chr(i%64+64)) -> 2.39
ascan(a,{|x|x==i%ARR_LEN}) -> 5.50
============================================================
total application time: 46.77
total real time: 46.78
------------------------
speedtst_mt.exe
Startup loop to increase CPU clock...
09/16/08 23:43:24 Harbour 1.1.0dev (Rev. 9421) (MT), OS/2 4.50
ARR_LEN = 16
N_LOOPS = 1000000
empty loops overhead = 0.23
CPU usage -> secondsCPU()
c:=L_C -> 1.19
n:=L_N -> 0.15
d:=L_D -> 0.15
c:=M_C -> 1.20
n:=M_N -> 0.16
d:=M_D -> 0.16
(sh) c:=F_C -> 1.08
(sh) n:=F_N -> 0.42
(sh) d:=F_D -> 0.25
(ex) c:=F_C -> 1.08
(ex) n:=F_N -> 0.42
(ex) d:=F_D -> 0.26
n:=o:GenCode -> 1.51
n:=o[8] -> 1.33
round(i/1000,2) -> 0.61
str(i/1000) -> 2.52
val(a3[i%ARR_LEN+1]) -> 3.48
dtos(j+i%10000-5000) -> 2.10
eval({||i%ARR_LEN}) -> 1.81
eval({|x|x%ARR_LEN},i) -> 1.88
eval({|x|f1(x)},i) -> 2.23
&('f1('+str(i)+')') -> 11.07
eval([&('{|x|f1(x)}')]) -> 2.24
j := valtype(a)+valtype(i) -> 3.01
j := str(i%100,2) $ a2[i%ARR_LEN+1] -> 5.35
j := val(a2[i%ARR_LEN+1]) -> 3.64
j := a2[i%ARR_LEN+1] == s -> 3.90
j := a2[i%ARR_LEN+1] = s -> 4.02
j := a2[i%ARR_LEN+1] >= s -> 4.00
j := a2[i%ARR_LEN+1] < s -> 4.01
aadd(aa,{i,j,s,a,a2,t,bc}) -> 11.43
f0() -> 0.41
f1(i) -> 0.60
f2(c[8]) -> 1.52
f2(c[40000]) -> 1.52
f2(@c[40000]) -> 0.46
f2(c[40000]); c2:=c -> 2.76
f2(@c[40000]); c2:=c -> 1.74
f3(a,a2,c,i,j,t,bc) -> 5.07
f2(a2) -> 1.53
s:=f4() -> 2.28
s:=f5() -> 1.69
ascan(a,i%ARR_LEN) -> 1.90
ascan(a2,c+chr(i%64+64)) -> 5.78
ascan(a,{|x|x==i%ARR_LEN}) -> 21.54
============================================================
total application time: 135.88
total real time: 135.88
------------------------
[E:\harbour809mt\harbour\tests\mt]mttest01.exe
Harbour 1.1.0dev (Rev. 9421)
join: .T.
result: Hello World!!! Hello World!!! Hello World!!!
static var type: B
12345.678
12346.678
------------------------
[E:\harbour809mt\harbour\tests\mt]mttest02.exe
Harbour 1.1.0dev (Rev. 9421)
Main start
Thread ID: 0x233ce94
===================
M
Thread begin
Parameters: A B C
tttMttM
Thread QUIT
Thread ALWAYS section
MMMMMMM
===================
Main QUIT
Main ALWAYS section
I'm EXIT procedure
------------------------
[E:\harbour809mt\harbour\tests\mt]mttest03.exe
Harbour 1.1.0dev (Rev. 9421)
Main start
Thread ID: 0x233ce94
===================
MThread begin
Parameters: A B C
tMtttMttMttMtt
Main QUIT
Main ALWAYS section
Thread ALWAYS section
I'm EXIT procedure
------------------------
[E:\harbour809mt\harbour\tests\mt]mttest04.exe
Harbour 1.1.0dev (Rev. 9421)
Main start
Starting threads: <1><2><3><4><5>
Wait 5 seconds or hit any key...
Waiting for threads...
Threads joined
Sum of thread local counters: 139247
Protected item result.......: 139247 OK
Unprotected item result.....: 139247 *
* - can be different then local sum on real multi-CPU systems
End of main
------------------------
[E:\harbour809mt\harbour\tests\mt]mttest05.exe
Harbour 1.1.0dev (Rev. 9421)
Starting threads: <1><2><3><4><5>
Waiting for threads...
Threads joined
Sum of results: 5000500
should be: 5000500 OK
------------------------
[E:\harbour809mt\harbour\tests\mt]mttest06.exe
Harbour 1.1.0dev (Rev. 9421)
Starting threads: <1><2><3><4><5>
Waiting for threads...
Threads joined
Sum of results: 5000500
should be: 5000500 OK
------------------------
[E:\harbour809mt\harbour\tests\mt]mttest07.exe
Harbour 1.1.0dev (Rev. 9421)
Main start
Starting threads: <1><2><3><4><5>
Sending jobs...
Sending terminate values...<1><2><3><4><5>
Collecting results...
Waiting for threads...
Threads joined
OK, final sum: 16698333.33
End of main
------------------------
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour