iotbx::pdb and boost::unit_test::framework
Hi,
Is it reasonable to assume that the boost unit test framework (boost::test)
is compatible with cctbx's iotbx::pdb? Or might boost::test's handling of
memory clash with that of cctbx?
I can get simple examples with iotbx::pdb::input by itself or a print
statement wrapped by boost test to work fine on Linux (gcc 4.1.2). What I
am having issues with is replacing the print statement & include file with
iotbx::pdb::input (even if no file is opened). If the answer to the above
question is: "it is reasonable", then would it be better to post my
question to the c++ sig group?
The simple example is:
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE test_iotbx_pdb_input
#include
I may just scream out of frustration ... I am not well versed in the intricacies of gcc. However, recompiling Boost Test with debugging info (cflags=-g), removes the issue. That is, the program no longer tries to free an invalid chunk of memory. I am not sure how this resolves the issue. --Jeff
Hi Jeff,
I'm not familiar with the boost unit test framework.
If you are still stuck, if you describe exactly step-by-step how to
reproduce your problem, maybe I can help.
Problems I can imagine are somehow mixing two different boost versions, or
incompatible compilation options.
Ralf
On Tue, Dec 13, 2011 at 8:57 AM,
I may just scream out of frustration ...
I am not well versed in the intricacies of gcc. However, recompiling Boost Test with debugging info (cflags=-g), removes the issue. That is, the program no longer tries to free an invalid chunk of memory. I am not sure how this resolves the issue.
--Jeff
______________________________**_________________ cctbxbb mailing list [email protected] http://phenix-online.org/**mailman/listinfo/cctbxbbhttp://phenix-online.org/mailman/listinfo/cctbxbb
On Dec 13 2011, Ralf Grosse-Kunstleve wrote:
Hi Jeff, I'm not familiar with the boost unit test framework. If you are still stuck, if you describe exactly step-by-step how to reproduce your problem, maybe I can help. Problems I can imagine are somehow mixing two different boost versions, or incompatible compilation options. Ralf
I will try to reproduce the issue with as few changes to cctbx as possible. At the present, it appears to be a heisenbug (more likely it is pebkac) -- if I compile the Boost Test module (not my test program, but the actual Boost Test library) with -g, the memory error disappears (i.e. valgrind does not report an invalid read/write). I will write down the explicit steps I took when I get a bit more time.
Here is what I have found on both Linux (an ancient version of SUSE Linux Enterprise) and Mac OS X 10.6.8 using their respective build toolchains (without any tweaks). Steps to reproduce: * Download the 2011_09_03_0448 tarball for cctbx * Replace the cctbx_sources/boost directory with the 1_48_0 release of boost * Build the Boost Test library using the default values ** ./bootstrap.sh --with-libraries=test ** ./b2 --with-test * Follow the cctbx documentation to build iotbx ** python ../cctbx_sources/libtbx/configure.py --build-boost-python-extensions=False ** source setpaths.sh ** make ** On Mac OS X, create the shared library by hand * Create a simple boost test that does nothing more than: ** Create a test function ** Create an uninitialized (or initialized if you prefer) iotbx::pdb::input variable/object in the test function This results (on both systems): An invalid free/delete for a checked array that it appears the Boost Test module is trying to free (and it was already freed by iotbx::pdb::input) This problem appears to be resolved by compiling iotbx with threads (i.e. configuring with the --enable-boost-threads flag). I'm hoping that this enabling threads will not adversely affect my python extension modules that use iotbx.pdb. Are there any issues that I should be aware of when enabling the threads for iotbx.pdb (other than Mac OS X's buggy implementations of core system components such as pthreads, polling, etc.)? --Jeff
Hi Jeff,
This problem appears to be resolved by compiling iotbx with threads (i.e. configuring with the --enable-boost-threads flag).
Yes, that's expected, assuming the boost build system compiles with threads by default. I'm hoping that this enabling threads will not adversely affect my python
extension modules that use iotbx.pdb.
I don't think so.
Are there any issues that I should be aware of when enabling the threads for iotbx.pdb (other than Mac OS X's buggy implementations of core system components such as pthreads, polling, etc.)?
The main reason for disabling threads has to do with OpenMP. For a while we had OpenMP enabled if by default if available. Since we are not certain if OpenMP plays well with threads we turned the latter off. Now OpenMP is off too, since we repeatedly had problems. So enabling threads should be fine. Ralf
Thanks for your help (saves me many headaches from otherwise having to write my own efficient and valid pdb parser). --Jeff
Hi Jeff,
You're welcome.
A small warning: in input.cpp I'm currently using strtod(). Some platform
look at the "locale" (man locale) which can break parsing floating-point
numbers (e.g. the germans use 1,234 instead of 1.234). To avoid this, we
set LC_ALL=C in our command-line launchers (see e.g. bin/libtbx.python in
your cctbx build directory). You may have to do this in your environment,
too, if you want to support your program internationally.
After I stopped working on iotbx/pdb I wrote a Fortran conversion/emulation
tool (fable, inside cctbx) which includes a strtod() replacement. We could
use that to avoid the locale surprises.
Ralf
On Wed, Dec 14, 2011 at 12:52 PM,
Thanks for your help (saves me many headaches from otherwise having to write my own efficient and valid pdb parser).
--Jeff
______________________________**_________________ cctbxbb mailing list [email protected] http://phenix-online.org/**mailman/listinfo/cctbxbbhttp://phenix-online.org/mailman/listinfo/cctbxbb
participants (2)
-
Ralf Grosse-Kunstleve
-
vanv0059@umn.edu