|
Boost : |
From: Michael van der Westhuizen (r1mikey_at_[hidden])
Date: 2006-07-03 10:58:45
Hi,
On 7/3/06, Tomas Puverle <Tomas.Puverle_at_[hidden]> wrote:
> > > You may want to reconsider this fix. The assembly code in the
> > > previous post will work on v8 or v9. The original test is correct.
> >
> > Unfortunately, I'm told that the default for g++ is V7 and the code is being
> > rejected. I don't have access to a Sparc and am unable to test it myself.
>
> For 32bit compilation, consider this:
>
> g++ -mcpu=v8 -mtune=ultrasparc3 <file>
>
> For 64bit compilation, try this
>
> g++ -mcpu=v9 -mtune=ultrasparc3 -m64 <file>
>
> I think this should work.
>
> Tom
This is confirmed to work with changes (you actually need v8plus, but
gcc didn't grok that, so I used ultrasparc instead), and with Peter's
include guard changes this looks like a solid solution.
Here are test results for shared_ptr_mt_test and weak_ptr_mt_test
using sp_counted_base_gcc_sparc. I've run tests in both 32 bit
(sparcv8plus) and 64 bit (sparcv9) flavours.
These tests were run on a dual CPU Sun Fire 280 (2x750MHz UltraSPARC
III) which is so old it's already desupported by Sun...
[michael_at_hawk test]$ uname -a; g++ -v
SunOS hawk 5.9 Generic_118558-21 sun4u sparc SUNW,Sun-Fire-280R
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3/specs
Configured with: ../configure --disable-nls --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld
Thread model: posix
gcc version 3.3
Anyway, test results appended.
Michael
*************************
** 32 bit tests
*************************
[michael_at_hawk test]$ g++ -DBOOST_SP_USE_PTHREADS -pthreads -m32
-mcpu=ultrasparc -mtune=ultrasparc3 -O2 -Wall -ftemplate-depth-255
-Wno-non-virtual-dtor -I "/export/home/michael/boost_cvs/boost" -o
shared_ptr_mt_test shared_ptr_mt_test.cpp
[michael_at_hawk test]$ file shared_ptr_mt_test
shared_ptr_mt_test: ELF 32-bit MSB executable SPARC32PLUS Version
1, V8+ Required, UltraSPARC1 Extensions Required, dynamically linked,
not stripped
[michael_at_hawk test]$ LD_LIBRARY_PATH=/usr/local/lib timex ./shared_ptr_mt_test
Using POSIX threads: 16 threads, 1048576 iterations:
71.740 seconds.
real 39.29
user 1:02.11
sys 9.64
[michael_at_hawk test]$ g++ -pthreads -m32 -mcpu=ultrasparc
-mtune=ultrasparc3 -O2 -Wall -ftemplate-depth-255
-Wno-non-virtual-dtor -I "/export/home/michael/boost_cvs/boost" -o
shared_ptr_mt_test shared_ptr_mt_test.cpp
[michael_at_hawk test]$ file shared_ptr_mt_test
shared_ptr_mt_test: ELF 32-bit MSB executable SPARC32PLUS Version
1, V8+ Required, UltraSPARC1 Extensions Required, dynamically linked,
not stripped
[michael_at_hawk test]$ LD_LIBRARY_PATH=/usr/local/lib timex ./shared_ptr_mt_test
Using POSIX threads: 16 threads, 1048576 iterations:
31.090 seconds.
real 16.20
user 29.58
sys 1.53
[michael_at_hawk test]$ g++ -DBOOST_SP_USE_PTHREADS -pthreads -m32
-mcpu=ultrasparc -mtune=ultrasparc3 -O2 -Wall -ftemplate-depth-255
-Wno-non-virtual-dtor -I "/export/home/michael/boost_cvs/boost" -o
weak_ptr_mt_test weak_ptr_mt_test.cpp
[michael_at_hawk test]$ file weak_ptr_mt_test
weak_ptr_mt_test: ELF 32-bit MSB executable SPARC32PLUS Version
1, V8+ Required, UltraSPARC1 Extensions Required, dynamically linked,
not stripped
[michael_at_hawk test]$ LD_LIBRARY_PATH=/usr/local/lib timex ./weak_ptr_mt_test
Using POSIX threads: 16 threads, 16384 * 512 iterations:
382300 locks, 182933 forced rebinds, 8022692 normal rebinds.
364167 locks, 173352 forced rebinds, 8040825 normal rebinds.
379800 locks, 181960 forced rebinds, 8025192 normal rebinds.
377893 locks, 180638 forced rebinds, 8027099 normal rebinds.
384408 locks, 183885 forced rebinds, 8020584 normal rebinds.
383262 locks, 183571 forced rebinds, 8021730 normal rebinds.
409346 locks, 196148 forced rebinds, 7995646 normal rebinds.
387171 locks, 185867 forced rebinds, 8017821 normal rebinds.
392784 locks, 188247 forced rebinds, 8012208 normal rebinds.
372941 locks, 178030 forced rebinds, 8032051 normal rebinds.
372678 locks, 177818 forced rebinds, 8032314 normal rebinds.
370134 locks, 176891 forced rebinds, 8034858 normal rebinds.
384430 locks, 184190 forced rebinds, 8020562 normal rebinds.
375437 locks, 179117 forced rebinds, 8029555 normal rebinds.
391604 locks, 187686 forced rebinds, 8013388 normal rebinds.
360062 locks, 172281 forced rebinds, 8044930 normal rebinds.
60.330 seconds.
real 31.12
user 1:00.31
sys 0.03
[michael_at_hawk test]$ g++ -pthreads -m32 -mcpu=ultrasparc
-mtune=ultrasparc3 -O2 -Wall -ftemplate-depth-255
-Wno-non-virtual-dtor -I "/export/home/michael/boost_cvs/boost" -o
weak_ptr_mt_test weak_ptr_mt_test.cpp
[michael_at_hawk test]$ file weak_ptr_mt_test
weak_ptr_mt_test: ELF 32-bit MSB executable SPARC32PLUS Version
1, V8+ Required, UltraSPARC1 Extensions Required, dynamically linked,
not stripped
[michael_at_hawk test]$ LD_LIBRARY_PATH=/usr/local/lib timex ./weak_ptr_mt_test
Using POSIX threads: 16 threads, 16384 * 512 iterations:
384712 locks, 184139 forced rebinds, 8020280 normal rebinds.
383976 locks, 183671 forced rebinds, 8021016 normal rebinds.
366409 locks, 175521 forced rebinds, 8038583 normal rebinds.
379393 locks, 181134 forced rebinds, 8025599 normal rebinds.
382390 locks, 183082 forced rebinds, 8022602 normal rebinds.
383288 locks, 183024 forced rebinds, 8021704 normal rebinds.
372383 locks, 178038 forced rebinds, 8032609 normal rebinds.
371368 locks, 177416 forced rebinds, 8033624 normal rebinds.
371369 locks, 177616 forced rebinds, 8033623 normal rebinds.
382172 locks, 183196 forced rebinds, 8022820 normal rebinds.
384192 locks, 184367 forced rebinds, 8020800 normal rebinds.
393082 locks, 188548 forced rebinds, 8011910 normal rebinds.
381293 locks, 182481 forced rebinds, 8023699 normal rebinds.
405369 locks, 194527 forced rebinds, 7999623 normal rebinds.
371669 locks, 177506 forced rebinds, 8033323 normal rebinds.
377079 locks, 180282 forced rebinds, 8027913 normal rebinds.
59.540 seconds.
real 30.21
user 59.53
sys 0.03
*************************
** 64 bit tests
*************************
[michael_at_hawk test]$ g++ -DBOOST_SP_USE_PTHREADS -pthreads -m64
-mcpu=ultrasparc -mtune=ultrasparc3 -O2 -Wall -ftemplate-depth-255
-Wno-non-virtual-dtor -I "/export/home/michael/boost_cvs/boost" -o
shared_ptr_mt_test shared_ptr_mt_test.cpp
[michael_at_hawk test]$ file shared_ptr_mt_test
shared_ptr_mt_test: ELF 64-bit MSB executable SPARCV9 Version 1,
UltraSPARC1 Extensions Required, dynamically linked, not stripped
[michael_at_hawk test]$ LD_LIBRARY_PATH=/usr/local/lib/sparcv9 timex
./shared_ptr_mt_test
Using POSIX threads: 16 threads, 1048576 iterations:
83.140 seconds.
real 45.19
user 1:09.11
sys 14.05
[michael_at_hawk test]$ g++ -pthreads -m64 -mcpu=ultrasparc
-mtune=ultrasparc3 -O2 -Wall -ftemplate-depth-255
-Wno-non-virtual-dtor -I "/export/home/michael/boost_cvs/boost" -o
shared_ptr_mt_test shared_ptr_mt_test.cpp
[michael_at_hawk test]$ file shared_ptr_mt_test
shared_ptr_mt_test: ELF 64-bit MSB executable SPARCV9 Version 1,
UltraSPARC1 Extensions Required, dynamically linked, not stripped
[michael_at_hawk test]$ LD_LIBRARY_PATH=/usr/local/lib/sparcv9 timex
./shared_ptr_mt_test
Using POSIX threads: 16 threads, 1048576 iterations:
30.560 seconds.
real 16.28
user 27.99
sys 2.58
[michael_at_hawk test]$ g++ -DBOOST_SP_USE_PTHREADS -pthreads -m64
-mcpu=ultrasparc -mtune=ultrasparc3 -O2 -Wall -ftemplate-depth-255
-Wno-non-virtual-dtor -I "/export/home/michael/boost_cvs/boost" -o
weak_ptr_mt_test weak_ptr_mt_test.cpp
[michael_at_hawk test]$ file weak_ptr_mt_test
weak_ptr_mt_test: ELF 64-bit MSB executable SPARCV9 Version 1,
UltraSPARC1 Extensions Required, dynamically linked, not stripped
[michael_at_hawk test]$ LD_LIBRARY_PATH=/usr/local/lib/sparcv9 timex
./weak_ptr_mt_test
Using POSIX threads: 16 threads, 16384 * 512 iterations:
364959 locks, 174877 forced rebinds, 8040033 normal rebinds.
382668 locks, 183003 forced rebinds, 8022324 normal rebinds.
394876 locks, 189060 forced rebinds, 8010116 normal rebinds.
380618 locks, 181686 forced rebinds, 8024374 normal rebinds.
362100 locks, 172931 forced rebinds, 8042892 normal rebinds.
372930 locks, 178306 forced rebinds, 8032062 normal rebinds.
386203 locks, 184726 forced rebinds, 8018789 normal rebinds.
369316 locks, 176145 forced rebinds, 8035676 normal rebinds.
388403 locks, 185688 forced rebinds, 8016589 normal rebinds.
367113 locks, 175432 forced rebinds, 8037879 normal rebinds.
381852 locks, 182550 forced rebinds, 8023140 normal rebinds.
376530 locks, 180348 forced rebinds, 8028462 normal rebinds.
358899 locks, 171207 forced rebinds, 8046093 normal rebinds.
398739 locks, 191667 forced rebinds, 8006253 normal rebinds.
349401 locks, 166384 forced rebinds, 8055591 normal rebinds.
368334 locks, 176060 forced rebinds, 8036658 normal rebinds.
40.560 seconds.
real 20.55
user 40.52
sys 0.06
[michael_at_hawk test]$ g++ -pthreads -m64 -mcpu=ultrasparc
-mtune=ultrasparc3 -O2 -Wall -ftemplate-depth-255
-Wno-non-virtual-dtor -I "/export/home/michael/boost_cvs/boost" -o
weak_ptr_mt_test weak_ptr_mt_test.cpp
[michael_at_hawk test]$ file weak_ptr_mt_test
weak_ptr_mt_test: ELF 64-bit MSB executable SPARCV9 Version 1,
UltraSPARC1 Extensions Required, dynamically linked, not stripped
[michael_at_hawk test]$ LD_LIBRARY_PATH=/usr/local/lib/sparcv9 timex
./weak_ptr_mt_test
Using POSIX threads: 16 threads, 16384 * 512 iterations:
373029 locks, 178768 forced rebinds, 8031963 normal rebinds.
371022 locks, 177439 forced rebinds, 8033970 normal rebinds.
384749 locks, 184009 forced rebinds, 8020243 normal rebinds.
382946 locks, 183064 forced rebinds, 8022046 normal rebinds.
364680 locks, 174424 forced rebinds, 8040312 normal rebinds.
388327 locks, 186181 forced rebinds, 8016665 normal rebinds.
386915 locks, 185417 forced rebinds, 8018077 normal rebinds.
362228 locks, 172848 forced rebinds, 8042764 normal rebinds.
393288 locks, 188491 forced rebinds, 8011704 normal rebinds.
345412 locks, 164552 forced rebinds, 8059580 normal rebinds.
371340 locks, 177177 forced rebinds, 8033652 normal rebinds.
375262 locks, 179372 forced rebinds, 8029730 normal rebinds.
388247 locks, 185931 forced rebinds, 8016745 normal rebinds.
364153 locks, 173886 forced rebinds, 8040839 normal rebinds.
375689 locks, 179917 forced rebinds, 8029303 normal rebinds.
386681 locks, 185009 forced rebinds, 8018311 normal rebinds.
37.290 seconds.
real 19.01
user 37.27
sys 0.04
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk