#include #include /* MPI_Reduce( 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 int root, //rank of the process that receive result 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[4] = {1,2,3,42}; int size = 4; //Related to the correct dize of rand_nums array float local_sum = 0; for(int i=0; i