[LiDIA] Re: Question on check_basis() function in Lattice packagQuestion on check_basis() function in Lattice package. (LiDIA

zhifeng Li z-li1 at northwestern.edu
Wed May 7 05:22:04 CEST 2003


On Saturday 03 May 2003 05:01 am, lidia-request at cdc.informatik.tu-darmstadt.de 
wrote:

Hello, 

Thanks Stefan and  Christoph for helping reply my question. I compiled the 
example check_basis.cc Christoph wrote with dynamic linking (default for my 
gcc 3.2.2 ) LiDIA library. I got the following error message. 

----------------Shared lib error-------------
g++  -g check_basis.o -o ./check_basis -lLiDIA -lgmp -lm

[zhifeng at iems247 Example1]$ ./check_basis
./check_basis: error while loading shared libraries: libLiDIA.so.3: cannot 
open shared object file: No such file or directory
---------------End Shared lib error----------

Then I compiled check_basis.cc  with -static option. It gave the following 
output.  The output from gdb is also included here.

----------------------Outputs------------------------------
g++  -g -static check_basis.o -o ./check_basis -lLiDIA -lgmp -lm

[zhifeng at iems247 Example1]$ ./check_basis
 L =
(0 7 )
(7 7 )
                                                                                                                     
Aborted

[zhifeng at iems247 Example1]$ gdb check_basis
(gdb) run
Starting program: /home/zhifeng/Research/MIP/Try-LiDIA/Example1/check_basis
 L =
(0 7 )
(7 7 )
                                                                                                                                                                                                                                          
Program received signal SIGABRT, Aborted.
0x083827d1 in kill ()
(gdb) backtrace
#0  0x083827d1 in kill ()
#1  0x08382541 in raise ()
#2  0x083530a5 in abort ()
#3  0x08344047 in __cxxabiv1::__terminate(void (*)()) (handler=0x8352f30 
<abort>)
    at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x08344094 in std::terminate() () at 
../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x08344206 in __cxa_throw (obj=0x846e210, tinfo=0x0, dest=0)
    at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:77
#6  0x082aad05 in void LiDIA::precondition_error_handler<char const*>(char 
const* const&, char const*, char const*, char const*, char const*, char 
const*) ()
#7  0x082970c7 in LiDIA::prime_list::load_from_file(char const*, int) ()
#8  0x080c4a7f in LiDIA::load_primes(char const*, int, LiDIA::bigint*) ()
#9  0x080c5197 in LiDIA::get_primes(LiDIA::bigint const&, LiDIA::bigint 
const&, bool) ()
#10 0x081ce016 in LiDIA::modular_arithmetic<LiDIA::DRMK<LiDIA::bigint>, 
LiDIA::dense_fp_matrix_kernel<long, LiDIA::MR<long> >, 
LiDIA::dense_fp_matrix_kernel<LiDIA::bigint, LiDIA::MR<LiDIA::bigint> > 
>::det(LiDIA::matrix<LiDIA::bigint> const&, LiDIA::bigint&, LiDIA::bigint 
const&) const ()
#11 0x080995bb in LiDIA::matrix<LiDIA::bigint>::det(LiDIA::bigint&) const ()
#12 0x0805353e in 
LiDIA::bigint_lattice::TrD_check_basis(LiDIA::dense_alg<LiDIA::bigint> 
const&) ()
#13 0x08050702 in LiDIA::bigint_lattice::check_basis() ()
#14 0x08048456 in main ()
#15 0x0834cc3c in __libc_start_main ()
(gdb)
-------------------End Outputs--------------------

I also checked the prime_list.cc which contains the function 
prime_list::load_from_file(). It tries to load some file. Is it trying to 
load LIDIA_PRIMES? I guess that this may cause the trouble. As Stefan 
mentioned, I copied the file LIDIA_PRIMES from 
/home/zhifeng/LiDIA-2.1pre7/share/LiDIA/LIDIA_PRIMES to 
/usr/local/lib/LiDIA/LIDIA_PRIMES where LiDIA were installed in 
/usr/local/lib/LiDIA. The check_basis still aborted as above.  Also tried to 
recomipled and reinstalled the first five packages. It did not work either. 

Sorry for bothering your guys. Really can not figure out the problem. :-(

Thanks again. 
Zhifeng

-------------prime_list::load_from_file()------------
void  prime_list::load_from_file (const char *filename, lidia_size_t 
max_number_of_primes)
{
    //
    // Load primes from file
    // Number of primes being read can be limited by setting
    // "max_number_of_primes" > 0
    //
 
    PRIME_LIST_NUMBER prime, first_prime;
//      std::ifstream in(filename, std::ios::in|std::ios::nocreate);
    std::ifstream in(filename, std::ios::in);
 
    release_prime_list();
    if (in.fail() || in.bad())
      lidia_error_handler_para(filename, "filename", "",
                               "prime_list::load_from_file",
                               DM_CP, "Can't open file!");
    if (!in.eof()) {
      in >> first_prime;
      create_prime_list(first_prime);
      max_number_of_primes--;
      if (in.good() && (max_number_of_primes != 0)) {
        in >> prime;
        if (in.good()) {
          max_number_of_primes--;
          if (prime > first_prime) {
            check_and_add_next_prime(prime);
            while (in.good() && (max_number_of_primes != 0)) {
              in >> prime;
              if (in.good()) {
                check_and_add_next_prime(prime);
                max_number_of_primes--;
              }
            }
          }
          else {
            check_and_add_prev_prime(prime);
            while (in.good() && (max_number_of_primes != 0)) {
              in >> prime;
              if (in.good()) {
                check_and_add_prev_prime(prime);
                max_number_of_primes--;
              }
            }
          }
        }
      }
    }
    if (!in.good() && !in.eof())
      lidia_error_handler_para(filename, "filename", "",
                               "prime_list::load_from_file",
                               DM_CP, "An error occured, while reading from 
file!");
    in.close();
    create_block_list();
    get_first_prime();
    lower_bound = first_prime;
    upper_bound = last_prime;
  }









> Send LiDIA mailing list submissions to
> 	lidia at cdc.informatik.tu-darmstadt.de
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.cdc.informatik.tu-darmstadt.de/mailman/listinfo/lidia
> or, via email, send a message with subject or body 'help' to
> 	lidia-request at cdc.informatik.tu-darmstadt.de
>
> You can reach the person managing the list at
> 	lidia-admin at cdc.informatik.tu-darmstadt.de
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of LiDIA digest..."
>
>
> Today's Topics:
>
>    1. Re: Question on check_basis() function in Lattice packagQuestion on 
check_basis() function in Lattice package. (LiDIA
> Administrator)
>
> --__--__--
>
> Message: 1
> Date: Fri, 2 May 2003 13:17:35 +0200
> From: LiDIA Administrator <lidiaadm at cdc.informatik.tu-darmstadt.de>
> To: lidia at cdc.informatik.tu-darmstadt.de
> Subject: Re: [LiDIA] Question on check_basis() function in Lattice package.
> Reply-To: lidia at cdc.informatik.tu-darmstadt.de
>
> Hi,
>
> a request to all submitters of bugreports: Please include a small
> sample program into your report that exhibits the failure. Like in
> this case, it often takes me only five minutes to fire up an editor
> and create a test myself; but these and similar five-minute-tasks
> cumulate...
>
> On Fri, May 02, 2003 at 10:30:39AM +0100, Stefan.Neis at t-online.de wrote:
> >         Hi,
> >
> > (snipp)
> >
> > > But when I called function L.check_basis(). The program
> > > aborted and the stack showed the following error from gdb.
> >
> > (snipp)
> >
> > > #6  0x083aa525 in void LiDIA::precondition_error_handler<char
> > > const*>(char const* const&, char const*, char const*, char const*, char
> > > const*, char const*) ()
> > > #7  0x083968e7 in LiDIA::prime_list::load_from_file(char const*, int)
> > > () #8  0x0813f89f in LiDIA::load_primes(char const*, int,
> > > LiDIA::bigint*) ()
> >
> > (snipp)
> >
> > Looks like LiDIA couldn't find it's LIDIA_PRIMES. Either set the
> > environment variable LIDIA_PRIMES_NAME to the absolute path of that file,
> > e.g. to /usr/lib/LiDIA/LIDIA_PRIMES or install the file into the default
> > place which is  (or at least was in LiDIA-1)
> > $(LIDIA_INSTALL_DIR)/lib/LiDIA/LIDIA_PRIMES, where LiDIA_INSTALL_DIR is
> > the directory determined at configure time, to which LiDIA is supposed to
> > be installed after compilation.
> >
> > However, why this silently dumps core and doesn't give a meaningful error
> > message is beyond me ... :-(
>
> Zhifeng Li configured LiDIA with exception support, but he didn't
> bother to catch a precondition_error thrown in
> prime_list::load_from_file(). If you look at entry #4 in the
> backtrace, you see that std::terminate() was called. That's exactly
> what you want to happen in such a case.
>
> > Looks like an error in the build system. Maybe some matrix files are
> > compiled without passing a suitable define for LIDIA_PRIMELIST_NAME to
> > the compiler? In that case, the second possibility suggested above
> > wouldn't work anyway. :-(
>
> I can't reproduce the error. I built and installed LiDIA as usual
> (make; make install) and afterward built the following program:
>
> ========= check_basis.cc BEGIN =====
> #include <iostream>
> #include <stdexcept>
>
> #include "LiDIA/bigint_matrix.h"
> #include "LiDIA/bigint_lattice.h"
>
> int main() {
>     using namespace std;
>
>     try {
>         LiDIA::bigint_matrix B(2,2);
>         B.sto(0,0,0);
>         B.sto(1,0,7);
>         B.sto(0,1,7);
>         B.sto(1,1,7);
>
>         LiDIA::bigint_lattice L(B);
>         cout << " L =" << L << endl;
>         if(L.check_basis()) {
>             cout << "Ok, L is a basis" << endl;
>         }
>         else {
>             cout << "Huh? LiDIA claims L is not a basis!" << endl;
>         }
>     }
>     catch (exception const& ex) {
>         cerr << "Exception caught: " << ex.what() << endl;
>         return 1;
>     }
>
>     return 0;
> }
> ======== check_basis.cc END =======
>
> The result is:
>
> lidiaadm at lap200:~/gcc-3.2.2/test> ./check_basis
>  L =
> (0 7 )
> (7 7 )
>
> Ok, L is a basis
> lidiaadm at lap200:~/gcc-3.2.2/test>
>
> Therefore, I need a sample program from Zhifeng Li if I am to
> investigate this any further. But let me point out two issues:
>
> a) There is no check_basis() in bigint_matrix.h. It is rather a member
>    of LiDIA::bigint_lattice found in bigint_lattice.h
>
> b) As analyzed by Stefan, the problem seems to be that a particular file
>    was not found. Looking into prime_list.cc, I see two lines where
>    an error handling routine is called. What makes me wonder is why
>    this particular error is converted into a
>    LiDIA::precondition_error; this exception type ought to be
>    reserved for failed assertions etc. I would have expected a
>    LiDIA::generic_error in case of an I/O failure.
>
> Regards
>
> Christoph
>
> PS: I had some trouble with my email account over the holiday whence I
> never got Zhifeng Li's posting. Thanks to Stefan's reply I became
> aware of it and retrieved Zhifeng Li's message from the mailing list
> archive. However, if you sent me a message off list on May 1, chances
> are it got lost. (I saw the message by Per Christoffersen and asked
> Harald Baier to look into it.)

-- 
==========================================
Zhifeng Li,
Dept. of IE/MS, Northwestern University
Phone: (847) 491-2412 (O)
Fax:  (847) 491-8005
Email: zhifeng at iems.nwu.edu
URL: http://users.iems.nwu.edu/~zhifeng
==========================================





More information about the LiDIA mailing list