next up previous

Passing the Input as Arguments to Main

In this case, all the nodes would automatically receive the command line arguments to the program.

Example
The program myprog.c requires two integers as input and looks as follows:

#include <cube.h>
#include <stdio.h>
main(argc, argv)
int argc;
char *argv[];
{
int x, y;
sscanf(argv[1], "%d", &x);
sscanf(argv[2], "%d", &y);


}

Suppose the object program myprog is loaded on the nodes of the hypercube along with two input parameters with the following command:

load myprog 7 12
myprog assigns the value 7 to x and 12 to y.