                           Charm++ for Cygwin

       Copyright (C) 1989-2000 Regents of the University of Illinois

Now you can compile charm++ under Windows9x/2000/NT/XP with Cygwin using its 
GNU compiler. The generated executables require cygwin1.dll, and have to run
under cygwin environment. To build Charm++ program that do not depend on 
Cygwin DLL and only depend on runtime libraries distributed as part of the 
OS (Win9x/NT), one needs to compile Charm++ using Mingw.
Note: This version of cygwin is still under testing.
Check the FAQ at end of this file for more help.


                       Setup and Compilation
                    ===========================

To compile charm on cygwin:
1. install cygwin from: http://www.cygwin.com/mirrors.html
   download inetutils, openssh, w32api packages and gcc of course. Remember to
   choose default file type as "unix" at the beginning of cygwin installation.

2. before compiling, make sure you have /bin/sh correctly installed, otherwise
   make a link from /bin/bash.exe:  ln -s /bin/bash.exe /bin/sh.exe
   compile charm++:    
     ./build charm++ net-cygwin

3. set up environment:
     There are several ways to do this, using rsh or ssh. 
   Under Windows2000/NT, ssh is recommended, I once had difficulty to have 
   inetd working.
     Starting from Charm++ version 5.4, ++local option is added to start
   node programs directly on your desktop machine. You no longer need rshd or 
   sshd to start charm program on local machine. This is for testing purpose 
   or small job run though, for best performance, launch one process per 
   processor with rsh daemons.
   Starting from Charm++ V5.4R2, you can also run Charm++ program in standalone
   mode without charmrun.

 ** RSH method **
   setup /etc/inetd.conf and /etc/services to start rshd, 
   Here is an example of /etc/inetd.conf:

###
shell stream tcp nowait.1000  root /usr/sbin/in.rshd  in.rshd
###

   and an example of /etc/services:

###   
shell     514/tcp    cmd
###

   before running charm program, start 'inetd' first to get rshd running.
   Run debug mode 'inetd -d' to see the debug information.

 ** SSH method **
     Check /etc/passwd, make sure your home directory is correct. (it may be
   empty there!)
   run "/usr/bin/ssh-config" to setup all ssh config files.
     Since openssh version 2.5.1p2, you have to run /usr/bin/ssh-host-config
   for the first time to generate global config files and server keys; and 
   run /usr/bin/ssh-user-config creates the private and public keys for a user.
   You may need to modify /etc/sshd_config or /etc/ssh_config for your needs.
   
     Setup ~/.shosts, or add your public key to your ~/.ssh/authorized_keys to 
   allow you to login without password authentication. You can test if your
   setting works by:   
       ssh localhost date
   
   Now you can start sshd and run charm programs. To tell Charmrun to use ssh
   instead of rsh(default), you need to add ++shell option in ~/.nodelist file:

group main ++shell /bin/ssh
host localhost 

 ** run only on local machine with ++local **
     This allows a user to run charm program on his/her desktop machine for 
   testing purpose or running a small job without the hassle of setting up any 
   rsh deamons. To launch a charm++ program on your local machine, use 
   "++local" option via:
  
     ./charmrun +p4 ++local ./pgm

 ** run in standalone mode **
     You can run Charm++ program without charmrun after Charm++ V5.4R2.
   Simply type executable and command line options:
   ./pgm 
   This will run only one copy of program locally.

4. If you have any problem with it, please check the FAQ below for help.
   Let me know if it works or not by sending email to (charm@cs.illinois.edu).




                                    FAQ
			      ==============

 * Why would I use net-cygwin version?

   First cygwin is free, it comes with free gcc compiler, cvs and openSSH.
   You don't need expensive Visual C++ compiler to get work done. For unix 
   fans, it is also a good idea to just turn your windows box to a unix 
   workspace, and learn and run charm++ program uniformly on all platforms.

 * How to get your latest version of Charm++?

   You can use anonymous cvs login to checkout the latest version of charm.
   (It may not be the latest stable version though)
   1. login the cvs server:

      cvs -d :pserver:checkout@thrift.cs.illinois.edu:/expand6/cvsroot login

      when CVS passwd is prompted, just type <Enter>.
   2. checkout charm

      cvs co -P charm

      You should get latest charm source tree.
   3. logout the cvs server

      cvs logout

 * How to compile Charm++ executable using Mingw?

   Make sure mingw-runtime is installed using Cygwin setup program. 

   Download "MinGW API for MS-Windows" from mingw website: 
      http://www.mingw.org/download.shtml 
   The downloaded file should be named as w32api-3.11.tar.gz.
   Install the file under /usr/local/mingw

   Now build charm++ with "mingw" option:
     ./build charm++ net-cygwin mingw

   One can then compile Charm++ application using mingw support and run 
   applications outside of Cygwin. However, note that one can not use 
   ssh mode in charmrun to start a parallel job. Instead, use charmd which 
   is a daemon process that listen charm command and start processes.

 * Problem: Charm++ build script stops when it compile "ckfutures.ci", with 
   error message: "Syntax error at line 1: parse error"

   This happens when the .ci files have strange characters like '^M' at end
   of each line. Don't use WinCVS to checkout charm because it will append
   '^M' for each line. Use the cvs that comes free from cygwin.
   After charm++ version 5.4, this bug is fixed.

 * Problem: I got a runtime error "CthCreate failed to create fiber!".

     net-cygwin uses Win32 Fiber in its user threads implementation. However, 
   there is a limit upon the number of Fibers you can create at one time in 
   the w32api of cygwin. The current limit (as I tested) is between 50-52. You 
   have to reduce the number of processors or the number of charm++ threads
   you create in the program to run the program under cygwin.



