I'll try to
implement persistence (using pickled values), so I can restart ozengine
during the search and see if the memory requirements differ.
I did this and succeeded. The data in the global structure is saved
after each 10 loop iterations using
fun {Deref R}
if {IsDet R} then
if {Record.is R} then
{Record.map R Deref}
elseif {List.is R} then
{Map R Deref}
elseif {Cell.is R} then
{Deref @R}
elseif {Dictionary.is R} then
{Deref {Record.toListInd {Dictionary.toRecord dict R}}}
else
R
end
elseif {IsFree R} then
_
elseif {FD.is R} then
{FD.reflect.dom R}
else
raise errorInDeref end
end
end
{Pickle.save {Deref GlobalData} PROGRESS_FILE}
and upon restart of the solver it is re-loaded using
fun {MakeStateful R CellLabels DictionaryLabels}
fun {MS R}
if {IsDet R} then
if {Record.is R} then
{Record.mapInd R
fun {$ Lbl Val}
if {HasFeature CellLabels Lbl} then
{NewCell {MS Val}}
elseif {HasFeature DictionaryLabels Lbl} then
D={NewDictionary}
in
{ForAll Val
proc {$ Key#DVal}
{Dictionary.put D Key {MS DVal}}
end
}
D
else
{MS Val}
end
end
}
elseif {List.is R} then
{Map R MS}
else
R
end
elseif {IsFree R} then
_
else
raise errorInMakeStateful end
end
end
in
{MS R}
end
GlobalData={MakeStateful {Pickle.load PROGRESS_FILE}
labels(l1:unit l2:unit l3:unit ....)
labels(l4:unit l5:unit l6:unit ....)
}
The conclusion is that the search scripts are OK, because separated
loops run OK. Memory usage of the 10-iteration processes rarely exceeded
150MB.
My only explanation of the emulator behavior is that I am excessively
using new record arities and I am planning to replace them by
dictionaries (I did the reverse in the past because dictionaries used to
crash the engine when used in search spaces, which might already be
fixed in cvs). However, I can not explain why the arities are not
included in heap size, so maybe I am wrong.
Thanks everyone for comments.
Cheers,
Filip
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users