Created
June 27, 2017 21:14
-
-
Save galek/71f1763762c608fd262c3c4d7662448e to your computer and use it in GitHub Desktop.
pvm test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example program | |
#include <iostream> | |
#include <string> | |
int main() | |
{ | |
# define SIZE 10 | |
# define NPROCS 2 | |
// A-Матрица, размера Size size | |
int a [ SIZE ][SIZE]; | |
// вектор | |
int b [ SIZE ]; | |
// результирующий вектор | |
int sum [ SIZE ]; | |
for (int i=0;i<SIZE;i++) | |
{ | |
sum[i]=0; | |
} | |
int num_data = SIZE / NPROCS ; | |
for (int i = 0; i < SIZE; i++) { | |
for ( int j = 0; j < SIZE ; j ++) { | |
a [ i ][j] = i % 2; | |
b [ i ] = i % 3; | |
} | |
} | |
for (int i = 0; i < NPROCS ; i ++) | |
{ | |
for(int j=0;j<SIZE;j++) | |
sum [ SIZE * num_data * i+j]=-1; | |
} | |
for ( int i = 0; i < SIZE ; i ++) | |
printf ("%d \n", sum [ i ]) ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment