// MC# Examples if (args.Length
< 2) int i, j; int N
= System.Convert.ToInt32(args[0]); // Matrix
size double[,] A = new double[N,
N]; Random rnd = new Random(); // Matrix content generation for (i = 0; i < N;
++i) // Divide matrix between asynchronous processes int q = N /
M,
int from =
0, MatrixMultiplierParallel mmp = new MatrixMultiplierParallel(); DateTime dt1 = DateTime.Now; // Check the time for (i = 0; i < M;
++i)
mmp.Multiply(N, A, B, C, from, to, mmp.sendStop); // Start the
async for (i = 0; i < M; ++i) mmp.getStop?(); // Wait the process termination
Console.WriteLine("Matrix size: {0}, Number of parts: {1}.", N,
M); public handler
getStop int() & channel sendStop() public async
Multiply (int N, double[,] A, double[,] B,
double[,]
C, for (i = from; i < to;
i++) sendStop !
(); |