Synergy User Manual and Tutorial. - THE CORE MEMORY
Synergy User Manual and Tutorial. - THE CORE MEMORY
Synergy User Manual and Tutorial. - THE CORE MEMORY
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Synergy</strong> <strong>User</strong> <strong>Manual</strong> <strong>and</strong> <strong>Tutorial</strong><br />
main(){<br />
int i, j;<br />
int tplength;<br />
int status;<br />
int P;<br />
int res;<br />
int tsd;<br />
int n;<br />
int Ai[N];<br />
int Ci[N];<br />
char host[128];<br />
char tpname[20];<br />
// Matrix indices<br />
// Length of ts entry<br />
// Return status for tuple operations<br />
// Number of processors<br />
// Result tuple space identifier<br />
// Problem tuple space identifier<br />
// Counter<br />
// Row from A to send to worker<br />
// Row from C to get from worker<br />
// Host machine name<br />
// Identifier of ts entry<br />
// The A matrix to break up into arrays<br />
// <strong>and</strong> send to workers<br />
int A[N][N] = {{1,0,1,0,0,0},<br />
{0,1,0,1,0,0},<br />
{1,0,1,0,1,0},<br />
{0,1,0,1,0,1},<br />
{0,0,1,0,1,0},<br />
{0,0,0,1,0,1}};<br />
// The B matrix to send to workers<br />
int B[N][N] = {{0,0,1,0,-1,0},<br />
{0,0,0,1,0,-1},<br />
{1,0,-1,0,1,0},<br />
{0,1,0,-1,0,1},<br />
{-1,0,1,0,0,0},<br />
{0,-1,0,1,0,0}};<br />
// The C matrix built from arrays<br />
// received from workers<br />
int C[N][N];<br />
printf("Master: started\n");<br />
// Get host machine name<br />
gethostname(host, sizeof(host));<br />
// Open tuple spaces<br />
printf("Master: Opening tuple spaces\n");<br />
// Open problem tuple space<br />
tsd = cnf_open("problem",0);<br />
// Open result tuple space<br />
res = cnf_open("result",0);<br />
printf("Master: Tuple spaces open complete\n");<br />
// Get number of processors<br />
P = cnf_getP(); // Get number of processors<br />
printf("Master: Processors %d\n", P);<br />
// Print matrix A <strong>and</strong> B<br />
printf("Master: Matrix A\n");<br />
for(i=0; i