Re: [eclipse-clp-users] Segmentation fault when loading large source file

From: Joachim Schimpf <jschimpf_at_coninfer.com>
Date: Mon, 18 Feb 2013 22:45:43 +0000
On 18/02/2013 20:38, Sergii Dymchenko wrote:
> Hi,
>
> When try to load very large source file (almost 10 Mb) I get
> "Segmentation fault" error.
>
> Version 6.0 #199 (x86_64_linux), Fri Nov  2 22:47 2012
>
> $ eclipse -g 5000000 -b R10.ecl
> Segmentation fault
>
> Is there some kind of hard limit on source file size?

There is no limit on source file size.  However, your file contains a
single big clause, and the parser chokes on that (which is due to the
hardware stack, and not affected by any ECLiPSe command line setting).

Your clause is mainly a big conjunction of constraints, looking like:

main :-
     ...
     P[1] $= 0.971700,
     P[2] $= 1.797000 + P[37500] * 0.032760 + P[15936] * 0.005254 + ...,
     ...
     P[50000] $= 0.782900 + P[20370] * 0.400100 + P[31487] * 0.073090 + ...,
     ...

I assume you have generated this rather than typed it in ;)

This program-generation technique seems very popular with our
users, but it is the wrong thing to do.  In a programming language
like ECLiPSe, which supports metaprogramming, you never have to
generate a textual program.

If the program that generates this clause is also written in
ECLiPSe, then it probably contains a loop like this

     ( for(I,1,50000) do
          generate_constraint(I, Constraint),
          write(Constraint), writeln(",")
     )

The thing to do is to get rid of the intermediate file, and
execute each constraint as soon as you have generated it:

     ( for(I,1,50000) do
          generate_constraint(I, Constraint),
          call(Constraint)
     )

In other words, just have a program that sets up the constraints
directly from your data files that contain the coefficients (or
wherever you get the numbers from).

This of course only works if your program generator was already
written in ECLiPSe.  If not (and you don't want to rewrite it
in ECLiPSe), let me know, and I'll suggest another technique!


-- Joachim
Received on Mon Feb 18 2013 - 22:46:00 CET

This archive was generated by hypermail 2.2.0 : Tue Feb 19 2013 - 06:14:32 CET