/*****************************************************************************/
/*                             //Satz: README                                */
/*           //Satz (verion 4.0) based on satz214 of Chu Min Li              */
/*    //Satz is Copyright LaRIA, Universit de Picardie Jules Verne 2001     */
/*           Authors: - Bernard Jurkowiak (jurkowia@laria.u-picardie.fr)     */
/*                    - Chu Min Li (cli@laria.u-picardie.fr)                 */
/*                    - Gil Utard (utard@laria.u-picardie.fr)                */
/*****************************************************************************/

I) What is //Satz ?

//Satz is the distributed/parallel version of the SAT solver Satz. 

II) The principle of //Satz:

Based on the master/slave model for communications and on a dynamic preemptive 
workload balancing by work stealing, //Satz can run on any Linux or Unix 
machines in a local network. Currently //Satz requires that all machines
in the local network share the same home directory (using NFS, see below).

Each used machine is a slave, while the master runs on an arbitrary machine.
When one slave becomes idle after finishing its work, it sends a work request 
to the master which evaluates the workload of each busy slaves and sends the 
first remaining subtree of the most loaded slave to the idle slave.

When a slave finds a solution (for satisfiable problems) or all slaves send
a work request (for unsatisfiable problems), the master stops the resolution.

//Satz supports fault-tolerance. Every hours, all slaves send their current 
context to the master. If a slave dies, the master sends its saved context to 
the idle slave at the time of workload balancing so that the work of the died 
slave can be continued. The resolution can be so stopped and re-started from 
an interruption point.


III) Requirements:

  => NFS (Network File System): This is file system that will mount remote 
file systems across homogenous and heterogenous systems. NFS consists of a 
client and server systems. An NFS server can export local directories for 
remote NFS clients to use. NFS uses the RPC.

  => RPC (Remote Procedure Call): RPC is concerned with interaction between 
processes. As a piece of software, it is a toolkit for building distributed 
processing applications.

  => Pthread.h: This is thread library.

  => Linux or Unix system.

  => ~/.rhosts file used by rsh (see ParaSatz shell script and man rsh).

  => 200 Ko in your home.

  => At least 2 machines.


IV) How to use //Satz.

a) Contents:

  => This directory contains: 

                ParaSatz: shell script to run //Satz;
                README: current file;
                Script: directory of shell scripts tools;
                machine: a text file containing the name of all used
                         machines
                master: master directory;
                slave1: slave1 directory;
		RunDir: shell script to run //Satz on a directory.
                instances: directory containing two random 3-SAT 
                           formulas

Important:

  Before running //Satz, put in machine file the name of all used machines
and end the file by 0.
        
        --> Example:

              $ echo machine_name_1 machine_name_2 0 > machine
              $ cat machine
              machine_name_1 machine_name_2 0
              $

b) Run //Satz to solve a single instance:

  => Now, you can run //Satz.

        --> Example:

              $ ls ~/instances_path
              intance1.cnf  instance2.cnf  instance3.cnf
              $ ParaSatz ~/instances_path/instance1.cnf
              //Satz: Master version 4.0 (for n processors)

	--> Note that user may be the owner of "instances_path" directory.

  => At end of the resolution, the running information is print.

        --> Example:

//Satz: Master version 4.0 (for n processors)
Instance: ~/instances_path/instance1.cnf is Unsatifiable Time: 2 MinTime (machine_name_1): 1 MaxTime (machine_name_2): 2 Com: 0 NB_BRANCHE: 3272 NB_COM: 41 NB_SEND: 23 NB_RECEPT: 18 NB_MACH: 2 NB_LIFE: 2 NB_DEAD: 0 NB_LOAD_BALANCE: 4

	Where "Time" is the real master time, "MinTime" is the minimum user 
        time for a slave (here machine_name_1 spends minimum time for the 
        resolution") "MaxTime" is similar. "Com" is the real time of all
        communications, "NB_BRANCHE" is the number of branches, "NB_COM" is 
        the number of communications, "NB_SEND" is the number of messages 
        sent, "NB_RECEPT" is the number of received messages, "NB_MACH" is 
        the number of used machines, "NB_LIFE" is the number of used 
	machines alive at the end of the current resolution, "NB_DEAD"
 	is the number of "dead machines" before the end of the resolution and 
	"NB_LOAD_BALANCE" the number of workload balancings.

  => When //Satz is running, 1 directory was created for a additional slave 
     (see RunClean below).

        --> Example:

              $ ls
              ParaSatz  README  RunDir  Script  machine  master  slave1  slave2

  => For satisfiable problem, the solution is in a slave directory.

        --> Example:

              $ find . -name satx.sol -print
              ./slave2/satx.sol 

  => The master timetable file is in the master directory.

c) Run //Satz on a directory:

  you can run //Satz to solve a set of instances put in a directory.

        --> Example:

              $ ls ~/instances_path
              intance1.cnf  instance2.cnf  instance3.cnf
              $ RunDir ~/instances_path/

	--> Note that user may be owner of "instances_path" directory.

d) Shell scripts tools:

  => Script directory contains:

        - RunPS: to print all active processes;
        - RunKill: to kill all processes if something is wrong;
        - RunHalt: to halt or interrupt the resolution;
        - Resume: to resume from the interruption point (see RunHalt);
        - RunClean: to delete directory created when //Satz is running.

  => RunPS: This tool prints all active processes.

        --> Example:

              $ ParaSatz ~/instances_path/instance1.cnf &
              $ cd Script 
              $ ls
              Resume  RunClean  RunHalt  RunKill  RunPS
              $ RunPS
              ------------ machine_name_1 -------------
              PID TTY      STAT   TIME COMMAND
              881 ?        SN     0:00 sh ~/ParaSatz/slave1/Exe
              889 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              890 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              891 ?        RN     0:11 ~/ParaSatz/slave1/Slave
              892 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              894 ?        R      0:00 ps x
              --------------------------------
              ------------ machine_name_2 -------------
              PID TTY      STAT   TIME COMMAND
              875 ?        SN     0:00 sh ~/ParaSatz/slave2/Exe
              883 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              884 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              885 ?        RN     0:10 ~/ParaSatz/slave2/Slave
              886 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              888 ?        R      0:00 ps x
              --------------------------------
              $

  => RunKill: This tool kills all processes.

        --> Example:

              $ ParaSatz ~/instances_path/instance1.cnf &
              $ cd Script 
              $ ls
              Resume  RunClean  RunHalt  RunKill  RunPS
              $ RunPS
              ------------ machine_name_1 -------------
              PID TTY      STAT   TIME COMMAND
              881 ?        SN     0:00 sh ~/ParaSatz/slave1/Exe
              889 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              890 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              891 ?        RN     0:11 ~/ParaSatz/slave1/Slave
              892 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              894 ?        R      0:00 ps x
              --------------------------------
              ------------ machine_name_2 -------------
              PID TTY      STAT   TIME COMMAND
              875 ?        SN     0:00 sh ~/ParaSatz/slave2/Exe
              883 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              884 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              885 ?        RN     0:10 ~/ParaSatz/slave2/Slave
              886 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              888 ?        R      0:00 ps x
              --------------------------------
              $ RunKill
              $ RunPS
              ------------ machine_name_1 -------------
              PID TTY      STAT   TIME COMMAND
              899 ?        R      0:00 ps x
              --------------------------------
              ------------ machine_name_2 -------------
              PID TTY      STAT   TIME COMMAND
              893 ?        R      0:00 ps x
              --------------------------------
              $

  => RunHalt: This tool halts the resolution and sends a message to the 
master to save current context in ~/ParaSatz/master/save_context file
(the master generally runs on the first machine appearing in machine 
file).

        --> Example:

              $ ParaSatz ~/instances_path/instance1.cnf &
              $ ls ./master/save_context
              ls: ./master/save_context: No such file or directory
              $ cd Script
              $ ls
              Resume  RunClean  RunHalt  RunKill  RunPS
              $ RunPS
              ------------ machine_name_1 -------------
              PID TTY      STAT   TIME COMMAND
              881 ?        SN     0:00 sh ~/ParaSatz/slave1/Exe
              889 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              890 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              891 ?        RN     0:11 ~/ParaSatz/slave1/Slave
              892 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              894 ?        R      0:00 ps x
              --------------------------------
              ------------ machine_name_2 -------------
              PID TTY      STAT   TIME COMMAND
              875 ?        SN     0:00 sh ~/ParaSatz/slave2/Exe
              883 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              884 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              885 ?        RN     0:10 ~/ParaSatz/slave2/Slave
              886 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              888 ?        R      0:00 ps x
              --------------------------------
              $ RunHalt name_of_master_machine
              $ ls ./master/save_context
              ./master/save_context 
              $ RunPS
              ------------ machine_name_1 -------------
              PID TTY      STAT   TIME COMMAND
              899 ?        R      0:00 ps x
              --------------------------------
              ------------ machine_name_2 -------------
              PID TTY      STAT   TIME COMMAND
              893 ?        R      0:00 ps x
              --------------------------------
              $

  => Resume: This tool resumes the resolution from the interruption point 
(see RunHalt) halted by RunHalt.

        --> Example:

              $ ls ./master/save_context
              ./master/save_context
              $ cd Script
              $ RunPS
              ------------ machine_name_1 -------------
              PID TTY      STAT   TIME COMMAND
              899 ?        R      0:00 ps x
              --------------------------------
              ------------ machine_name_2 -------------
              PID TTY      STAT   TIME COMMAND
              893 ?        R      0:00 ps x
              --------------------------------
              $ Resume&
              $ RunPS
              ------------ machine_name_1 -------------
              PID TTY      STAT   TIME COMMAND
              981 ?        SN     0:00 sh ~/ParaSatz/slave1/Exe
              989 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              990 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              991 ?        RN     0:11 ~/ParaSatz/slave1/Slave
              992 ?        SN     0:00 ~/ParaSatz/slave1/Slave
              994 ?        R      0:00 ps x
              --------------------------------
              ------------ machine_name_2 -------------
              PID TTY      STAT   TIME COMMAND
              975 ?        SN     0:00 sh ~/ParaSatz/slave2/Exe
              983 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              984 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              985 ?        RN     0:10 ~/ParaSatz/slave2/Slave
              986 ?        SN     0:00 ~/ParaSatz/slave2/Slave
              988 ?        R      0:00 ps x
              --------------------------------        
                $       

  => RunClean: this tool deletes directory created when //Satz is running.      

        --> Example:

              $ ls
              ParaSatz  README  Script  machine  master  slave1  slave2
              $ RunClean
              $ ls
              ParaSatz  README  Script  machine  master  slave1
              $ ls ./master/save_context
              ls: ./master/save_context: No such file or directory
              $

V) Acknowledgement

We thank Dominique Lazure for material help, Laure Devendeville and Daniel
Singer for fruitful discussions. This work is partially supported by grant
of "ple de modlisation de la rgion de Picardie".