Skip to content

Instantly share code, notes, and snippets.

@galek
Created June 27, 2017 21:14
Show Gist options
  • Save galek/71f1763762c608fd262c3c4d7662448e to your computer and use it in GitHub Desktop.
Save galek/71f1763762c608fd262c3c4d7662448e to your computer and use it in GitHub Desktop.
pvm test
// 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