[COIN-DISCUSS] Problems with MPI application using COIN

YANG YUAN erry.yuan at gmail.com
Wed Jun 20 14:22:02 EDT 2007


Hi Andreas,

I tried icpc and icc. When compiling COIN without -cxxlib-gcc, the following
error comes out during the compilation:


CglProbing.cpp(41): error: name must be a namespace name
  using namespace __gnu_cxx;
                  ^

CglProbing.cpp(128): error: hash_set is not a template
    hash_set<OsiRowCut2  , row_cut_hash, row_cut_compare> rowCut_;
    ^

CglProbing.cpp(147): error: identifier "hash_set" is undefined
        hash_set<OsiRowCut2 , row_cut_hash,
        ^

CglProbing.cpp(147): error: type name is not allowed
        hash_set<OsiRowCut2 , row_cut_hash,
                 ^

CglProbing.cpp(147): error: type name is not allowed
        hash_set<OsiRowCut2 , row_cut_hash,
                              ^

CglProbing.cpp(148): error: type name is not allowed
          row_cut_compare>::iterator find;
          ^

CglProbing.cpp(148): error: the global scope has no "iterator"
          row_cut_compare>::iterator find;
                            ^

......

If i compile it with CXXFLAGS="-cxxlib-gcc", the COIN libraries can be
successfully compiled and installed. However, when i try to link my own MPI
program with COIN, without -cxxlib-gcc as a link option, the following error
comes up:

/home/osu4502/Coin-Cbc/lib/libCbc.so: undefined reference to
`std::__default_alloc_template<true, 0>::allocate(unsigned)'
/home/osu4502/Coin-Cbc/lib/libCbc.so: undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char>
>&, char const*)'
/home/osu4502/Coin-Cbc/lib/libCoinUtils.so: undefined reference to
`std::ostream::operator<<(bool)'
/home/osu4502/Coin-Cbc/lib/libOsiClp.so: undefined reference to
`std::string::operator=(char const*)'
/home/osu4502/Coin-Cbc/lib/libOsiClp.so: undefined reference to
`std::string::compare(char const*) const'
/home/osu4502/Coin-Cbc/lib/libCbc.so: undefined reference to
`std::string::string(std::string const&)'
/home/osu4502/Coin-Cbc/lib/libClp.so: undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char>
>&, char)'
/home/osu4502/Coin-Cbc/lib/libOsiClp.so: undefined reference to
`std::string::operator=(std::string const&)'
/home/osu4502/Coin-Cbc/lib/libCbc.so: undefined reference to
`std::allocator<char>::allocator()'
/home/osu4502/Coin-Cbc/lib/libOsiCbc.so: undefined reference to
`std::string::size() const'
/home/osu4502/Coin-Cbc/lib/libCgl.so: undefined reference to
`std::string::append(char const*)'
/home/osu4502/Coin-Cbc/lib/libCbc.so: undefined reference to
`std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/home/osu4502/Coin-Cbc/lib/libCgl.so: undefined reference to
`std::__throw_length_error(char const*)'
/home/osu4502/Coin-Cbc/lib/libCbc.so: undefined reference to
`std::ostream::operator<<(void const*)'
/home/osu4502/Coin-Cbc/lib/libOsiCbc.so: undefined reference to
`std::string::reserve(unsigned)'
......

After adding -cxxlib-gcc as a link option, my program compiles and links to
COIN successfully. but when i run the executable, again without printing out
the first line of main function, it directly gives me a seg fault.

Could you please help me to solve this problem?

Many thanks -- yang



On 6/20/07, Andreas Waechter <andreasw at watson.ibm.com> wrote:
>
> Hi Yang,
>
> The first thing I would suggest is to use the same compiler for your
> application and the COIN libraries.  You can specify the compiler you want
> to use with the CC, CXX, anf F77 (if you have Fortran code) arguments for
> configure, see
>
>
> https://projects.coin-or.org/CoinHelp/wiki/user-configure#VariableArgumentsforconfigure
>
> You probably also want to use the same compiler flags (CFLAGS and CXXFLAGS
> as in your application.  The COIN configure scripts determine a default
> value for those, based on the compiler name, and we have also default
> values for the Intel compilers (maybe you like them already as they
> are...).
>
> I hope this helps,
>
> Andreas
>
> On Wed, 20 Jun 2007, YANG YUAN wrote:
>
> > Hi,
> >
> > I am working on a MPI application using COIN-cbc, clp as solvers. The
> COIN
> > shared libraries have been made using gcc, however, my own MPI program
> > together with COIN failed to compile using mpicc (a compiler and linker
> > constructed for MPI application). Instead, i use the intel C++ compiler
> > "icpc" together with some necessary MPI lib and include files.
> > Fortunately, the compilation and linking are fine, but on the other
> hand,
> > probably it is one of the reason that causes the following errors.
> >
> > If I add the link flags -cxxlib-gcc or -shared while linking my program
> with
> > COIN shared libraries. the executable can be successfully generated.
> > However, everytime i run it, it directly gives me a seg fault even
> without
> > getting into the main function. it is proved by no output of the first
> > "printf", as shown below.
> >
> > #include ***
> >
> > int
> > main (int argc, char *argv[])
> > {
> >  printf ("Beginning of the code.\n");
> > ......
> > }
> >
> >
> >
> > If I get rid of the link flags -cxxlib-gcc or -shared, the above seg
> fault
> > is gone. and the Coin utility functions seem to work fine, but it fails
> to
> > solve a simple MIP problem with output "Cbc: LP relaxation is infeasible
> or
> > too expensive". I write the MIP out, actually the problem is ok and it
> can
> > be solved very easily.
> >
> > I am suspecting that there might exist some linking errors, so that
> although
> > the libraries (-lCbc -lCgl -lOsiClp -lOsiCbc -lOsi -lClp -lCoinUtils)
> have
> > been linked, they don't function well. I sense the usage of shared
> libraries
> > might also be a problem, but so far i have no luck in finding what's
> wrong.
> > If you have any idea or some experience with using MPI and COIN
> together,
> > please kindly provide me some directions. Any suggestion is extremely
> > appreciated!
> >
> > Thanks!
> >
> > yang
> >
> > p.s. The following is the makefile i am using:
> >
> > /******************************************
> >
> > D2BAC=$(HOME)/D2-MPI
> >
> > CXX = icpc
> >
> > # C++ Compiler options
> > CXXFLAGS = -O2 -unroll0 -mp1 -w -ip
> > # -cxxlib-gcc -gcc-version=323
> >
> > # additional C++ Compiler options for linking
> > CXXLINKFLAGS =
> > #-Wl,--rpath -Wl,/home/osu4502/Coin-Cbc/lib -cxxlib-gcc
> >
> > # Directory with COIN header files
> > COININCDIR = $(HOME)/Coin-Cbc-T1/include
> >
> > # Directory with COIN libraries
> > COINLIBDIR = $(HOME)/Coin-Cbc-T1/lib
> >
> > # Directory with C library and header files
> > CINCDIR = /usr/local/intel-8.0-20040716/include/c++
> > CLIBDIR = /usr/local/intel-8.0-20040716/lib
> >
> > # Libraries necessary to link with Clp
> > LIBS = -L$(COINLIBDIR) -lCbc -lCgl -lOsiClp -lOsiCbc -lOsi -lClp
> -lCoinUtils
> > \
> >       -lm -lc \
> >       `cat $(COINLIBDIR)/cgl_addlibs.txt` \
> >       `cat $(COINLIBDIR)/osi_addlibs.txt` \
> >       `cat $(COINLIBDIR)/clp_addlibs.txt` \
> >       `cat $(COINLIBDIR)/coinutils_addlibs.txt`
> >
> > # ------------------------------------------------------------
> >
> > clean :
> >       /bin/rm -rf *.o *~
> >
> > realclean :
> >       /bin/rm -rf *.o *~
> >       /bin/rm -rf *.mps *.ord *.sos *.lp *.sav *.net *.msg
> >
> > # ------------------------------------------------------------
> >
> > d2alg: d2algFuncsV2.o  d2algMainV2.o COINInterface.o
> >       $(CXX) $(CXXLINKFLAGS) d2algMainV2.o d2algFuncsV2.o
> COINInterface.o
> > -o d2alg  $(MPI_LIBS) $(LIBS)
> > COINInterface.o: $(D2BAC)/ COINInterface.c
> >       $(CXX) -c $(MPI_CFLAGS) $(CXXFLAGS) -I$(COININCDIR)
> > $(D2BAC)/COINInterface.c -o COINInterface.o
> > d2algMainV2.o: $(D2BAC)/ d2algMainV2.c
> >       $(CXX) -c $(MPI_CFLAGS) $(CXXFLAGS) -I$(COININCDIR)
> > $(D2BAC)/d2algMainV2.c -o d2algMainV2.o
> > d2algFuncsV2.o: $(D2BAC)/ d2algFuncsV2.c
> >       $(CXX) -c $(MPI_CFLAGS) $(CXXFLAGS) -I$(CINCDIR) -I$(COININCDIR)
> > $(D2BAC)/d2algFuncsV2.c -o d2algFuncsV2.o
> >
> _______________________________________________
> Coin-discuss mailing list
> Coin-discuss at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/coin-discuss/attachments/20070620/a648fc76/attachment.html>


More information about the Coin-discuss mailing list