home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / cellsim / v2_5 / doc / cm.doc < prev    next >
Encoding:
Text File  |  1990-02-26  |  13.8 KB  |  294 lines

  1.             Documentation for Cellsim v2.5
  2.              Connection Machine interface
  3.               February, 1990
  4.  
  5.  
  6.            ****************************************
  7.   Version 2.5 of Cellsim can communicate with a daemon process on a
  8. Connection Machine front-end (CMFE), transferring data (such as lookup
  9. tables and images) and instructions to the CM, and reading data (such
  10. as images and state-counts) back.  This essentially allows you to
  11. run your CA rules on a Connection Machine (CM), while still using the
  12. Sun as a user-interface.
  13.  
  14.   You can do this by running Cellsim on one of the CM front-ends (assuming
  15. it's a Sun), or you can do this remotely through the network.  I've
  16. successfully run Cellsim attached to a CM 2000 miles away (it was pretty
  17. slow though)!
  18.  
  19.   Both lookup-table (LT) and computed-function rules can be used.
  20. To use LT rules, you don't need to know any CM programming, as you
  21. generate the LT's locally, and then transfer them to the CM.  To use
  22. computed-function (256-state) rules on the CM, however, you will have
  23. to program the rules in C/Paris, a semi-low-level language on the CM
  24. which you call from C.
  25.  
  26.  
  27.            ****************************************
  28.            STARTING THE DAEMON ON THE CMFE
  29.  
  30.   To use the CM, you need to run a program on the CMFE which will wait for
  31. the Sun side of Cellsim to call it up.  This program is "cm_cell".
  32.  
  33.   Go to the directory that has the cm_cell program (either "cm_cell.sun4"
  34. or "cm_cell.vax", but referred to simply as "cm_cell" here) on the CMFE.
  35. Attach to the CM using the "cmattach" command, to grab whatever Sequencer(s)
  36. and interface you want, however many processors you want, etc.  You should
  37. now be in an attached shell.  Run the "cm_cell" program.  You can give it
  38. a couple of arguments to set either the debug-level (to make it be *very*
  39. verbose about what the Sun is telling it to do), or to change the port-number
  40. from the default of 12700.  The form of those optional arguments is:
  41.   cm_cell -d # -p #
  42. where the first # is the debug-level (0 is the default if you don't use
  43. the -d argument), and the second # is the port to use.  Right now, only
  44. two debug-levels are supported: 0, very quiet, and 1, very verbose.
  45. So some possible command-lines are:
  46.   cm_cell -d 1
  47.   cm_cell -p 12705
  48.   cm_cell -d 1 -p 12714
  49.  
  50.   Note also that you can just invoke cm_cell when attaching, by doing
  51. the following, for example:
  52.   cmattach -w -S 2 cm_cell -d 1
  53.  
  54.   I recommend just doing a cmattach to get an attached shell, and then
  55. running cm_cell from the shell.  The reason for that is, sometimes cm_cell
  56. or Cellsim crashes, and if you are not in an attached shell, you'll lose
  57. the CM when you crash, and someone else might grab it from you.  It can be
  58. very frustrating.  (Hopefully, cm_cell will not crash too often any more...)
  59.  
  60.  
  61.            ****************************************
  62.           CONNECTING TO CM_CELL FROM CELLSIM
  63.  
  64.   Ok, now you've got cm_cell running, what next?  You should run Cellsim
  65. on a Sun somewhere.  You can use command-line arguments to Cellsim to
  66. tell it the name of the CMFE you are running cm_cell on, or if the person
  67. who compiled Cellsim was nice or was you, Cellsim will automatically know
  68. which CMFE you're most likely to want.  You can also specify the port
  69. number to use.  Finally, you can also set the hostname and/or port number
  70. from within Cellsim, using the "Defaults" menu.
  71.  
  72.   So once you've done all that, you should click the left mouse-button
  73. on the "CM" button in the control panel, or select "Connect to CM" from
  74. the "CM" menu.  However, in order to do this, you have to be in a neighorhood
  75. and image-size that is allowed on the CM.  These are as follows:
  76.  
  77.   Valid image sizes for use with CM: 128, 256, 512  (64 is too small)
  78.   Valid neighorhoods: m2, v2, v4, v8, M2, M4, M8, l2r1, l4r1, l8r1, l16r1,
  79.               l2r2, l4r2, l8r2, l2r3, l4r3, any 256-state nhood
  80.  
  81. This means you *cannot* use the following neighborhoods with the CM, that
  82. you could use on the Sun:
  83.   m4, v16, M16, l16r2
  84. This is because the lookup table would be too large.  Apparently, some
  85. CMs (that I use, at least) will be getting memory upgrades from
  86. 8 kbytes/processor up to 32 kbytes/processor, so future releases of Cellsim
  87. might allow you to use larger tables.  However, there's not much need, if
  88. you know C/Paris, since computed-function rules go almost as fast as
  89. lookup-tables on the CM!
  90.  
  91.   Anyways, when you click on the "CM" button to connect to the CMFE, the
  92. control panel in Cellsim will probably flash some messages too quickly
  93. for you to see (they are just handshaking messages between Cellsim and
  94. cm_cell, which you can read when they happen individually; a bunch of
  95. things have to be done when first connecting though).  Eventually, you
  96. should see the message "Connected to CM".
  97.  
  98. ERRORS
  99.   If you *don't* get that message, you might see one of 2 things:
  100. "Error trying to connect to CM" means that there wasn't anybody waiting
  101. on the host/port Cellsim tried to call.  Either you got the hostname
  102. or port wrong, or you didn't run cm_cell, or the host-table on your
  103. machine is wrong, or the network is messed up, or something of that nature.
  104. Check everything very carefully and try again.
  105.   If you see "Not connected!", that means Cellsim did connect, but something
  106. happened that caused the connection to break, such as cm_cell crashed.
  107. I'd suggest changing some parameters in Cellsim, such as the image-size
  108. or neighborhood, and trying again, although that shouldn't be the cause
  109. of the problem.  But I find that different CMs have very different sets
  110. of problems, and I've only tested Cellsim on 3 CMs so far.
  111.  
  112.   If you just can't get Cellsim to connect to the CM successfully, send
  113. a message to me, Dave Hiebeler (hiebeler@heretic.lanl.gov), and we'll
  114. debug your situation.  Different CMs behave very differently, in my
  115. experience, so it may take some fine-tuning to get it working on your CM.
  116. (Feel free to do some hacking yourself, and contact me if you don't get
  117. it running).
  118.  
  119.  
  120.            ****************************************
  121.            USING THE CM, NOW THAT YOU'RE CONNECTED
  122.  
  123.   So you're connected to the CM.  It's a good feeling, right?  Well, let's
  124. go through a simple example.  Say you want to run Life.  You can load the
  125. lookup table for Life locally, using the "Rules" menu.   Then, select
  126. "Send LT" from the "CM" menu, to send the lookup table to the CM.  Next,
  127. you can draw an image locally, and send it to the CM ("Send image" under
  128. the "CM" menu).  Or, you could use "CM quick random" or "CM general random"
  129. to generate an image very quickly out on the CM, since sending an image
  130. is pretty slow.
  131.   Now everything's out there and ready to run.  Make sure you've enabled
  132. whichever display devices you want to use, in the "CM" popup window under
  133. the "defaults" menu.  You can either use "Run", or "Skip", or "Skip/Bounded",
  134. or any of those, to run.
  135.   Note that if you're only using the Sun display (no FrameBuffer), then
  136. if you hit "Run", you won't see anything until you hit the left mouse-button
  137. to stop running.  It would severely strain the network to send back every
  138. image to the Sun.
  139.  
  140.   If the "life.m2" LT was on the CMFE filesystem, and you had the CM Image-dir
  141. set up appropriately, you could use the "Load rule from CMFE" item under
  142. the "CM" menu, to just load the LT directly into the CM, rather than loading
  143. it on the Sun and then sending it.
  144.  
  145. RUNNING A 256-STATE PARIS RULE
  146.   For our next trick, let's run a 256-state C/Paris rule.  Select
  147. "Load rule from CMFE" under the "CM" menu, and enter "heat.m256.sun4.o"
  148. or "heat.m256.vax.o", depending on which type of CMFE cm_cell is running on.
  149. You'll probably also want to load in the "rainbow256.cmap" colormap, and
  150. send that to the CM (use the "send cmap" item under the "CM" menu in the
  151. control panel).  Then, select "quick random" under the "CM" menu, and you're
  152. ready to run!  If you have a FrameBuffer, this rule runs very smoothly; if
  153. you're only using a Sun display, you'll just have to look at an image once
  154. in a great while -- but things will still run fast on the CM!
  155.  
  156.  
  157.            ****************************************
  158.               DISCONNECTING FROM THE CM
  159.        ("I'll let someone else use the machine for a change.")
  160.  
  161.   To disconnect things, select "disconnect" from the "CM" menu.  That will
  162. close the socket connection between Cellsim and cm_cell.  However, cm_cell
  163. won't exit; it will sit and wait for another Cellsim (or the same one)
  164. to call it up again.  To kill it, hit control-c (or whatever your interrupt
  165. character is, if you've changed it) in the window where you are running it.
  166. The interrupt signal tells cm_cell to stop waiting, close the socket, and
  167. exit.  Then you can detach from the CM by exiting your attached shell.  (You
  168. will automatically detach if you ran cm_cell as an argument to cmattach).
  169.  
  170.  
  171.            ****************************************
  172.        SPEED OF COMPUTED-FUNCTION VS LOOKUP-TABLE RULES
  173.  
  174.   Running a computed-fcn rule on the CM isn't as bad as on the Sun.  The
  175. reason for that is, on the Sun, the update-function gets called for every
  176. cell, but on the CM, the update-function gets called *once*, to update *all*
  177. the cells.
  178.  
  179.   For simple update-functions, such as heat.m256, there are about a dozen
  180. Paris calls.  For lookup-tables, there are 2 Paris calls, but they are very
  181. slow ones (aref32-shared and a normal aref).  So you don't lose much speed
  182. at all.  If your update-function has millions of Paris calls, then you'll
  183. suffer a loss in speed, of course, but things will still be pretty fast
  184. compared to the Sun!
  185.  
  186.  
  187.            ****************************************
  188.            YOU CAN DO A LOT MORE THAN 8 BIT RULES!
  189.  
  190.   Perhaps one of the more pleasant realizations I had when writing the
  191. CM code, was that when using a computed-function rule, you can use a lot
  192. more than 8 bits per cell.  In fact, less than a dozen bytes per virtual
  193. processor are used (when not using lookup-tables), so with a VP ratio of
  194. 16, you've got around 500 bytes/VP left.  (The VP ratio is 16 when running
  195. with a 512x512 image on 16384 processors).
  196.  
  197.   Because of this, it is possible to allocate extra fields on the CM from
  198. within your rule, and use those fields in your update-function.  Right now,
  199. you have to do this extra work yourself; Cellsim will maintain (and display)
  200. an 8-bit field for you, and look up the neighbors from that field.  If
  201. you want neighbors from your private fields, you have to look them up.
  202. You also have to put stuff into the supplied 8-bit field for display,
  203. if you want to see anything or send things to the Sun.
  204.  
  205.   Despite those restrictions, Cellsim still has the potential to be used as
  206. a somewhat general interface for 2-D geometries on the CM.  I've even written
  207. a floating-point rule which ran under Cellsim/cm_cell!
  208.  
  209.   See the "CM.Fcn" file for more information about constructing C/Paris
  210. rules, and how to make rules that use more than 8 bits.
  211.  
  212.  
  213.            ****************************************
  214.                COMMON MISTAKES
  215.  
  216.   One of the most common mistakes I make is to load an LT on the Sun, and
  217. then try to run on the CM without ever sending the LT to the CM.  I plan to
  218. eventually have Cellsim warn the user when that happens, but I haven't
  219. implemented it yet.  So if you try to run a rule and *very* strange things
  220. happen, you should check to make sure you sent everything to the CM --
  221. LT, image, cmap, etc.
  222.  
  223.            ****************************************
  224.                    WARNINGS
  225.   The CM code is fairly new, and fairly fragile at this point.  You will
  226. probably find lots of ways to make it crash or just screw up.  I can think
  227. of at least one thing that would probably cause problems: trying to use
  228. fewer cells than physical processors.  Although one of the CMs I use is
  229. a 64k-processor CM, I generally seize at most 1/4 of the machine, or
  230. 16k processors.  I suspect that if you run on 32k processors and try to
  231. use a 128x128 array (16384 cells), the CM program will crash.  I'd test
  232. this myself, but of course it's the night before I want to release this
  233. program...
  234.  
  235.   Occasionally, things just go wrong, causing something to crash.  Usually,
  236. if cm_cell crashes, Cellsim will notice and will tell you it's disconnected
  237. from the CM.  Once in a while, it won't notice, and things will hang.
  238. Sometimes you can use "Disconnect" in the "CM" menu, to disconnect after
  239. cm_cell has crashed (it doesn't make sense to disconnect from a program
  240. that's no longer running, but what it does is tell Cellsim to close the
  241. socket).  When things get really messed up, you should kill both cm_cell
  242. and Cellsim, to make sure the socket is closed and everything can be
  243. restarted.  Sometimes sockets won't die, and cm_cell will complain that
  244. the address is already in use.  Usually, the socket will time out after
  245. a minute or so, but if it won't, you can use a different port number instead.
  246.  
  247.   If all this makes you nervous, don't worry about it until you've tried
  248. it out.  Some CMs seem to behave very well, and others give more trouble.
  249.  
  250.  
  251. /*
  252.  *
  253.  * Cellsim copyright 1989, 1990 by Chris Langton and Dave Hiebeler
  254.  * (cgl@lanl.gov, hiebeler@heretic.lanl.gov)
  255.  *
  256.  * This package may be freely distributed, as long as you don't:
  257.  * - remove this notice
  258.  * - try to make money by doing so
  259.  * - prevent others from copying it freely
  260.  * - distribute modified versions without clearly documenting your changes
  261.  *   and notifying us
  262.  *
  263.  * Please contact either of the authors listed above if you have questions
  264.  * or feel an exception to any of the above restrictions is in order.
  265.  *
  266.  * If you make changes to the code, or have suggestions for changes,
  267.  * let us know!  If we use your suggestion, you will receive full credit
  268.  * of course.
  269.  */
  270.  
  271. /*****
  272.  * Cellsim history:
  273.  *
  274.  * Cellsim was originally written on Apollo workstations by Chris Langton.
  275.  *
  276.  * Sun versions:
  277.  *
  278.  * - version 1.0
  279.  *   by C. Ferenbaugh and C. Langton
  280.  *   released 09/02/88
  281.  *
  282.  * - version 1.5
  283.  *   by Dave Hiebeler and C. Langton  May - June 1989
  284.  *   released 07/03/89
  285.  *
  286.  * - version 2.0
  287.  *   by Dave Hiebeler and C. Langton  July - August 1989
  288.  *   never officially released (unofficially released 09/08/89)
  289.  *
  290.  * - version 2.5
  291.  *   by Dave Hiebeler and C. Langton  September '89 - February 1990
  292.  *   released 02/26/90
  293.  *****/
  294.