Dear Raphael,
Thanks for your reply, and sorry for my delayed response.
On 12 Mar 2009, at 13:13, Raphael Collet wrote:
On Mar 12, 2009, at 8:43 AM, Raphael Collet wrote:
On Wed, Mar 11, 2009 at 11:11 PM, Torsten Anders
<[email protected]> wrote:
I would like to do parallel search where the script contains objects.
Are those objects global? If that's the case, then they are
stateless (or at least, you don't modify them from inside
computation spaces).
The objects are only created within the script and are thus
situated in local computation spaces.
If the objects never reach the toplevel space, there should be no
problem with those objects. Simply check that
- the objects are created by running the script only,
- no object reference is accessible from the root variable, and
Actually, I want to return the object as solution from the script.
Now, I could return a "textual version" (nested records which could
later be turned into the object again). However, the distribution
strategy needs in any case access to the object. So, objects are
communicated between spaces.
- no object is ever sent on a port that belongs to the toplevel space.
If all three conditions above are satisfied, the objects are not
the problem. Also make sure that your classes do not use shared
state or resources (like System, FD, and so on). If the classes
depend on something like the FD module, then make the search
functor (the one you give to the search engine) import the modules
where the classes are defined, and make the script refer explicitly
to that imported module.
Could you perhaps briefly explain why this is necessary?
By the way, can you describe more precisely the problem you are
experiencing? We could give you better advice if we have a bit
more info...
Sure :) Below is a dummy definition which results in a similar error
message to what I get when I use my musical score objects in a script
for parallel search. Please keep in mind that the example below is
only intended to demonstrate this error I am getting.
Any comments how I can twist the example below to get objects working
within parallel search?
Thank you!
Best
Torsten
----------------------------------------------------------------
declare
functor MyDataF
import
FD
export
MyClass
define
%% dummy class
class MyClass
attr val
meth init(val:?Val<={FD.decl})
@val = Val
end
meth val($) @val end
end
end
[MyData] = {Module.apply [MyDataF]}
Machines = init(localhost:2)
functor ScriptF
import FD
export Script
define
%% dummy script
proc {Script Root}
X = {New MyData.myClass init}
Y = {New MyData.myClass init}
Z = {New MyData.myClass init(val: 7)}
in
Root = unit(X Y Z)
{X val($)} + {Y val($)} =: {Z val($)}
{X val($)} <: {Y val($)}
%%
{FD.distribute ff [{X val($)} {Y val($)}]}
end
end
%% create search engine for two processes on localhost
SearchEngine = {New Search.parallel Machines}
Solution = {SearchEngine one(ScriptF $)}
/*
{SearchEngine close}
{SearchEngine stop}
*/
%% This results in the following error
*** Warning: Unable to reach the net, using localhost instead
*** Warning: Unable to reach the net, using localhost instead
*** Warning: Unable to reach the net, using localhost instead
%********************** error in application ********************
%**
%** Application of non-procedure and non-object
%**
%** In statement: {<Resource> _<optimized>}
%**
%** Call Stack:
%** procedure 'MyClass,init' in file "/Users/tanders/oz/music/
Strasheela/strasheela/trunk/strasheela/examples/Parallel-Search-
moreExamples.oz", line 25, column 3, PC = 4410444
%**--------------------------------------------------------------
%********************** error in application ********************
%**
%** Application of non-procedure and non-object
%**
%** In statement: {<Resource> _<optimized>}
%**
%** Call Stack:
%** procedure 'MyClass,init' in file "/Users/tanders/oz/music/
Strasheela/strasheela/trunk/strasheela/examples/Parallel-Search-
moreExamples.oz", line 25, column 3, PC = 4410444
%**--------------------------------------------------------------
%****************** Error: remote module manager ****************
%**
%** remote(crashed <O: ManagerProxy> apply(<Chunk> 'export'(worker:<P/
1 PS>)))
%**
%** Call Stack:
%** procedure 'ManagerProxy,SyncSend/fast' in file "/Users/ggutierrez/
Work/mozart-1-3-2/mozart/share/lib/dp/Remote.oz", line 196, column 6,
PC = 25674016
%** procedure 'Process,plain/fast' in file "/Users/ggutierrez/Work/
mozart-1-3-2/mozart/share/lib/cp/par/ParProcess.oz", line 48, column
6, PC = 25511900
%** procedure 'MapT' in file "/usr/staff/raph/devel/trunk/mozart/
share/lib/base/Record.oz", line 76, column 3, PC = 4390288
%**--------------------------------------------------------------
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users