HI Tugkan,

> I used standard configure with "cmake . -DCMAKE_BUILD_TYPE=Release" .

Check the CMAKE_CXX_FLAGS_RELEASE, it should read something like -O3,
I mention this as I had found that CMake 2.6.0 pulled down from the
Ubuntu 8.10 repositories erroneously left this field blank.

> include/OpenThreads/Config has
> _OPENTHREADS_ATOMIC_USE_MUTEX
> instead of
> _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS

This is likely to be a large part of why you aren't getting the
performance that isn't as good as it should be.  When I did introduce
the ref_ptr<> into the rendering backend I this was when we still just
had mutex based ref_ptr<> and while there was a small performance hit,
was at most only a couple of percent with vsync off.  The change was
introduced for robustness reasons - as the code required to prevent
crashes when users deleted objects during the
DrawThreadPerContext/CullThreadPerCameraDrawThreadPerContext modes
with rather awkward and prone to bugs.

Potentially we could make the use of ref_ptr<> in the rendering back
optional offering the faster but less robust using C pointers -
perhaps a cmake build option, but it'll complicate the code a bit and
require a little know knowledge from the application developer about
the restrictions that such a change introduces.

> I tried to debug this. Here are my observations:
>
> 1- In CheckAtomicOps.cmake some small programs are compiled and run to see
> whether the architecture supports GCC_BUILTINS. I copied and pasted the one
> for GCC_BUILTINS to a file and tried to compile it. If I compile with  "g++
> test.cpp" I get following errors:
>
> test.cpp:(.text+0x43): undefined reference to
> `__sync_bool_compare_and_swap_4'
> test.cpp:(.text+0x6e): undefined reference to
> `__sync_bool_compare_and_swap_4'
>
> If I explicitly define an architecture as follows, "g++ -march=i686
> test.cpp", then compile succeeds and the resulting program runs and returns
> successfully.
>
>
> 2- I changed the CheckAtomicOps.cmake so that the results of the test
> programs are completely ignored and SET(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS
> 1) is called in any case. This successfully changes
> include/OpenThreads/Config to use _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS.
> However, when I try to compile OSG I get linker errors similar to the above
> ones.
>
> 3- It can be seen in CMakeFiles/CMakeSystem.cmake that the architecture is
> correctly recognized as i686 ( SET(CMAKE_SYSTEM_PROCESSOR "i686") line is
> present ).
>
> 4- I saw on a different Suse 10.3 computer that it also
> has_OPENTHREADS_ATOMIC_USE_MUTEX.
>
>
> I don't have much experience with cmake system so I don't know how I should
> continue with debugging. Can you give me some pointers?

I'll have to defer to Mathias Froehlich on how best to detect the
support for atomic ref counting as he's the author of the detection
code.

What gcc version do you have on your system?  Are all your systems 32 or 64bit?

Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to