private static unsafe void DistributedLoadModelMaster(Mpi mpi, string fullPath, CartesianModel model, int k) { using (var lr = new LinesReader(fullPath)) { for (int rank = 0; rank < mpi.Size; rank++) { var nxLength = mpi.CalcLocalHalfNxLength(rank, model.LateralDimensions.Nx); var sigma = new double[nxLength, model.Anomaly.LocalSize.Ny, 1]; var sendLength = nxLength * model.Anomaly.LocalSize.Ny; if (nxLength == 0) { continue; } AnomalyLoaderUtils.ReadAnomalyDataFromPlainText(lr, sigma, 0); if (rank == 0) { for (int i = 0; i < nxLength; i++) { for (int j = 0; j < model.Anomaly.LocalSize.Ny; j++) { model.Anomaly.Sigma[i, j, k] = sigma[i, j, 0]; } } } else if (nxLength != 0) { fixed(double *data = &sigma[0, 0, 0]) mpi.Send(data, sendLength, Mpi.Double, rank, 0); } } } }
private void SendTaskTo(int rank, ParallelTask task) { Mpi.Send(task.PolarizationIndex, rank, (int)Tag.TaskData, Mpi.CommWorld); Mpi.Send(task.Frequency, rank, (int)Tag.TaskData, Mpi.CommWorld); }
private void SendCommandTo(int rank, Command command) { Mpi.Send((int)command, rank, (int)Tag.Command, Mpi.CommWorld); }