// ================================================================== // Author: Jean-Michel Richer // Email: jean-michel.richer@univ-angers.fr // Date: Aug 2020 // Last modified: November 2020 // Purpose: Demonstrate basic send functionality, send array of float // from master (rank=0) to slave (rank=1) // ================================================================== #include #include #include #include // for sleep #include using namespace std; #include "ezmpi.h" using namespace ez::mpi; /** * run master and slaves */ void run(int argc, char *argv[]) { // data to send float *data; int data_size; // Create Process from ezmpi // that retrives cpu rank (id), # cpus (max), cpu name (name) Process p(argc, argv); if (p.is_master()) { // Code of master // set remote cpu identifier that will communicate with master p.remote(1); // processor of id 0 (master) fills and sends the array data_size = 100 + rand() % 100; data = new float [data_size]; for (int i=0; i