c - How to parallelize 3 Two-dimensional arrays -


i need check best way parallelize 3 two-dimensional arrays. 2 of them (a , b) have values set in loop, , other (the c) have sum of , b.

i have use mpi achieve want. i'm thinking in separate process , check "if myrank == 0 make work", don't know if best option. code have parallelize this:

for (i=0; i<1000; i++) {     (j=0; j<1000; j=j+2) {         a[i][j] = 1.0;         a[i][j+1]=-1.0;     } } (i=0; i<1000; i++) {     (j=0; j<1000; j++) {         b[i][j] = 1.0;         c[i][j] = 0.0;     } } (i=0; i<1000; i++) {     (j=0; j<1000; j++) {         (k=0; k<1000; k++) {             c[i][j] += a[i][k] * b[k][j];         }     } } result=0.0; (i=0; i<1000; i++) {     (j=0; j<1000; j++) {         result=result+c[i][j];     } } 


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -