Workunits and results can be created using either a utility program or a C++ function.
The utility program is
create_work
    -appname name                   // application name
    -wu_name name                   // workunit name
    -wu_template filename           // WU template filename
    -result_template filename       // result template filename
    -redundancy n                   // # of results to create
    -db_name x                      // database name
    -db_passwd x                    // database password
    -upload_url x                   // URL for output file upload
    -download_url x                 // base URL for input file download
    -download_dir x                 // where to move input files
    -rsc_fpops x                    // est. # floating-point ops
    -rsc_iops x                     // est. # integer ops
    -rsc_memory x                   // est. RAM working set size, bytes
    -rsc_disk x                     // est. disk space required
    -keyfile x                      // path of upload private key
    -delay_bound x                  // delay bound for result completion
    infile_1 ... infile_m           // input files

The WU template file has the form

[ <file_info>...</file_info> ]
[ ... ]
<workunit>
    [ <command_line>-flags xyz</command_line> ]
    [ <env_vars>name=val&name=val</env_vars> ]
    [ <max_processing>...</max_processing> ]
    [ <max_disk>...</max_disk> ]
    [ <file_ref>...</file_ref> ]
    [ ... ]
</workunit>
The components are:
<command_line> The command-line arguments to be passed to the main program.
<env_vars> A list of environment variables in the form name=value&name=value&name=value.
<max_processing> Maximum processing (measured in Cobblestones). An instance of the computation that exceeds this bound will be aborted. This mechanism prevents an infinite-loop bug from indefinitely incapacitating a host. The default is determined by the client; typically it is 1.
<max_disk> Maximum disk usage (in bytes). The default is determined by the client; typically it is 1,000,000.
<file_ref> describes a reference to an input file, each of which is described by a <file_info> element.

The workunit template file is processed as follows:

The result file template is macro-substituted as follows:


The C++ library (backend_lib.C,h) provides the functions:

int read_key_file(char* path, R_RSA_PRIVATE_KEY& key);

int create_work(
    WORKUNIT&,
    char* wu_template,                  // contents, not path
    char* result_template_filename,     // path
    int redundancy,
    char* infile_dir,                   // where input files are
    char** infiles,                     // array of input file names
    int ninfiles
    R_RSA_PRIVATE_KEY& key,             // upload authentication key
    char* upload_url,
    char* download_url
);

read_key_file() reads a private key from a file. Use this to read the file upload authentication key.

create_work() creates a workunit and one or more results. The arguments are similar to those of the utility program; some of the information is passed in the WORKUNIT structure, namely the following fields:

name
appid
batch
rsc_fpops
rsc_iops
rsc_memory
rsc_disk
delay_bound
All other fields should be zeroed. "; page_tail(); ?>