#include #include #include #include int main(int argc, char** argv) { MPI_Init(&argc, &argv); int rank, size,pid,nprocs; MPI_Comm_rank(MPI_COMM_WORLD, &pid); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); int s=atoi(argv[1]); double* V = NULL; double* V_local = NULL; int local_size; int total_elements = s; int base_size= total_elements / nprocs; int remainder = total_elements % nprocs; if (pid == 0) { V = (double*)malloc(s * sizeof(double)); for (int i = 0; i