cluster sim, and NetworkServer basics

Hi folks.

I'm hoping people here can help with a general and a specific aspect of project:

general: I need to set up a breve simulation to run on a beowulf cluster. The idea is to have each node responsible for a certain region of space, and when an object/creature "falls off" the end of one simulation, it's sent over the network to the neighboring simulation. So, loosely coupled parallel simulations...for the time being, not worrying about synchronizing. From poking around on the forum a little, it looks like Correy Kowall has done just this--Correy, is there a detailed document somewhere explaining how?

specific: in preparation for the above, I've written a very simple sim which in which I want to have a ball rolling, then sent over the network to another (or the same) simulation when it reaches the end of the world. I'm getting an error, looks like during the dearchiving of the object:

network connection from localhost.localdomain
execution stopped from within simulation: attempt to register Mobile object with uninitialized shape (Sphere (0x877e7f8) )
... error in file "Mobile.tz" at line 68
dearchive of instance 0x877e8a8 (Ball) failed
error decoding XML message from string
... error in file "Control.tz" at line 161
method "move" called with uninitialized object
... error in file "code/ClusterWorld.tz" at line 65

[4]+  Segmentation fault      breve code/ClusterWorld.tz

The simulation code is below; I also have versions where sender and reciever are actually two different breve processes, but the results are, for current purposes, the same. Could someone point out what I'm doing wrong? I'm pretty new to breve/steve...

Thanks in advance,

Andrew Stout

sim code:

# this is a simulation intended to simultaneously teach myself steve and breve,
# and test my notion for how to set up a parallel breve simulation.

# include some frequently used classes and specify common classpaths

#@path "classes"
#@path "lib/classes"

@use Mobile.
@use Control.
@use Stationary.
@use NetworkServer.

# tell the engine the name of the controller

Controller ClusterWorld.

# implment the controller object

Control : ClusterWorld {
    + variables:
        cloudTexture (object).
        theBall (object).
        NetSrvr (object).
        
    + to init:
        # put initialization code here which creates objects
        # and sets up the simulation

        # floor
        floor (object).
        # I don't think I understand scoping in steve.
        # why doesn't the floor need to be declared as a variable?

        # some lighting stuff?
        self enable-lighting.
        self move-light to (0, 20, 20).

        cloudTexture = (new Image load from "images/clouds.png").
        self set-background-texture-image to cloudTexture.
        
        # Add a huge floor.
        floor = new Floor.
        floor catch-shadows.
        self enable-shadows.
        
        self offset-camera by (5, 1.5, 6).
        
        theBall = new Ball.
        self watch item theBall.

        NetSrvr = new NetworkServer.
        NetSrvr listen on-port 22222.

        print "simulation started".

    + to iterate:
        # place code that should be called during every 
        # iteration here.

        super iterate.
    
    # method required for passing objects over the net
    + to accept-upload of-instace newInstance (object) from-host clientHostname (string):
        newInstance move to (0, 0, -450).
        self watch item newInstance.   
}

# implement other objects in your simulation here

Mobile : Ball {
		+ variables:
			theShape (object).
			
    + to init:
        theShape = (new Sphere init-with radius .1).
				self set-shape to theShape.
				self add-dependency on theShape.
        self enable-physics.
        self set-color to random[(1, 1, 1)].
        self move to (0, 0.1, 0).
        self set-velocity to (0, 0, 10).

    + to iterate:
       if (self get-location)::z > 500:
            self send-over-network to "localhost" on 22222.

    # would need to archive and to dearchive methods, but nothing to be done
    # for such a simple object.
		#+ to archive:
		#	return super archive.
		
		#+ to dearchive:
		#	return super dearchive.
}

cluster sim, and NetworkServer basics

impressive idea :)

I have no idea if this is a better way of doing it or not!!! but i would do it in a slightly differnt mannour.

At the moment your trying to send a object over the network which can work but it might be easer to save the ball in a file, as can be seen in the creatures sim.

then send a message over to the other terminal and ask it to open that file in its space. this could be slightly better and simpler with the addid bonus that your saving your ball or creature every now and again which would make it easer for you to shutdown the simulatoin and not lose simulatoin time, breve does get slower when objects are created and distroyed, i think that your simulatoin might have this problem at some point.

Also have a look at the capture the flag tornament files and that shows you how to have differnt files running in syncro. it might be benificial if you have a ball.tz file which will act as a master class that can be called from multiple terminals.

its all congecture but it might work out better depending on where you want to end up with the simulatoin.

if you explain in greater detail where you want to end up with this simulatoin im sure more help can be given.

cluster sim, and NetworkServer basics

Hi Andrew,
which build of breve are you using? Archiving and dearchiving was broken for a couple of classes in 2.4 and I've been working on some fixes. The latest build I put up (the 2.5d builds) does have a number of improvements, but I don't believe it's fully fixed yet.

If you're using the latest 2.5d build and still having problems, the best thing to do might be to send me the simulation code to debug here so that I can make sure that all built-in classes are archive-complient.

- jon

Objects vs. Instances

In OOP you spec your objects then use instances of the object. The object works like a template for the compiler to build 'object(s)'

In your code what instance is created?

We are returning a string from another client but what type of Object is newRecipient?

I know what it should be but does the controller know?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.