#include #include #include /* MPI_Allreduce( void* send_data, //the element to apply the reduce void* recv_data, //the reduce result int count, //size of result in recv_data is sizeof(datatype)*count MPI_Datatype datatype, //type of element MPI_Op op, //operation to apply. Can also be defined custom operation MPI_Comm comm //communicator ) */ int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); //Initialize the MPI environment //TODO perche qui non (NULL, NULL) ?? int world_size; MPI_Comm_size(MPI_COMM_WORLD, &world_size); //Get the number of processes int world_rank; MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); //Get the number of process float rand_nums[10] = {1,2,3,42,55,66,71,82,93,190}; int size = 10; //Related to the correct dize of rand_nums array float local_sum = 0; for(int i=0; i