MiniMPI Notes

List of Classes

Exceptions

InvalidMiniMPIOperationException

This is the exception thrown when a MiniMPI call is invalid for the runtime or calling the process' current state.

This exception extends the MiniMPIExeption class

InvalidMiniMPIProgramException

The exception thrown when a MiniMPI program or process is incorrect, as opposed to just making an invalid MPI operation. (e.g. Forgetting to call MpiFinalize after calling MpiInit.)

This exception extends the MiniMPIExeption class

MiniMPICollectiveAbortException

The exception thrown when a MiniMPI process is collectively aborted.

This exception extends the MiniMPIExeption class

MiniMPIException:

The base exception for all exceptions in the MiniMPI namespace.

This exception extends the Exception class that is part of the .NET Framework.

MiniMPIExecutionException:

The base exception for all exceptions in the MiniMPI namespace.

At least that is what was said in the description, however the other exceptions do not derive from this one. I did a search and found that it is used once in MiniMPIRuntime.cs and a few times in the testing package.

This exception extends the MiniMPIException class.

Global Enums

InstructionType

All MPI calls can be broken down and describes as being comprised of a combination of four different MPI calls: ISend, IRecv, Wait, and Barrier. MiniMPI implements MPI using only these four main ideas.

AsyncSend

Analogous to ISend in MPI. This starts the sending of the message to a local buffer (in another process to leave the current MpiProcess free to do more work) to later be received by another MpiProcess.

value = 0

AsyncReceive

Analogous to IRecv in MPI. This starts the receiving of a message (in another process to leave the current MpiProcess free to do more work).

value = 1

Wait

Analogous to Wait in MPI. This makes the MpiProcess wait for one of its AsyncSends or one of its AsyncReceives to finish before it is realeased to perform more work.

value = 2

Barrier

Analogous to Barrier in MPI. Every MpiProcess that gets to a Barrier must wait for all of the other MpiProcesses to get to the Barrier before any of the MpiProcesses are free to continue.

value = 3

MiniMPIRuntimeState

Initialized

This means that the runtime has been constructed but has not been executed yet.

value = 0

Executing

This means that the runtime is executing the assigned processes.

value = 1

Aborting

This indicates that the runtime is in the prociess of aborting all worker processes. This is usually due to a process throwing an unhandled exception. When in this state, the runtime will cause each process to abort the next time it calls into the runtime.

value = 2

Terminating

This indicates that the runtime is terminating. This is usually because a call to the Dispose method while the runtime is running.

value = 3

Finished

This means that the runtime has finished executing the assigned processes and cannot be restarted.

value = 4

MpiProcessState

NotStarted

The process has been created, but not started yet.

value = 0

Started

The process has started running but the Mpi Initialize method has not been called yet.

value = 1

MpiInitialized

Indicates the process has called the MiniMPI Initialize method but has not been Finalized. MPI API calls are valid only in this state.

value = 2

MpiFinalized

Indicates the process has called the MiniMPI Finalize method. No more MPI API calls are valid in this state.

value = 3

Finished

The process has finished executing.

value = 4

The MpiProcess Class

The Main Idea

MpiProcess is implemented with a thread. It has a list of Instructions, a list of send instructions and receive instructions. There are a few values that can be set within the assembly (i.e. within the same project).

Most of the fields are set externally. The lists that I mentioned above can be added to by using the method RegisterInstruction(). For sinchronization issues, to use the RegisterInstruction method, the programmer should lock the SyncRoot variable in the MpiProcess.

The Instruction Class

The Main Idea

First of all, the Instruction class is an internal abstract class. That means that only the classes inside of the MiniMPI project can create references to Instruction objects. Since it is an abstract class, only instances of child classes may be created.

Each Instruction has a Type described by the enum InstructionType. Each Instruction also has a boolean value called IsCompleted that specifies when the Instruction has been executed. Each Instruction belongs to an MpiProcess and has a unique ID. This abstract class can be summarized by those fields.

The AsyncSendInstruction Class

The Main Idea

This class represents an asynchronous send from this MpiProcess to another.

Questions

  1. What does the IsEager boolean value represent?
  2. Does the Payload variable contain the message to be sent?
  3. If the Payload variable is the message, why is it only a string? Is that the only type of message that you are allowing?
  4. Are you allowing for wildcard sends? I see that you account for wildcard receives with a null pointer. Will a wildcard send occur if I use a null pointer for the DestProcess variable?

The AsyncReceiveInstruction Class

The Main Idea

This class represents an asynchronous receive from one MpiProcess to this MpiProcess. The receive instruction only needs to know the MpiProcess that will be sending the message. If you want to be able to receive any eligable message, use a null value for the sending MpiProcess. This is called a "wildcard receive".

Questions

  1. What does the "int?" mean? I don't understand it and I didn't know that it could be used. Does it mean that it may be an integer that is returned but sometimes it may return something else? Does it mean that it may be an int or null only?

The WaitInstruction Class

The Main Idea

This class represents a call to Wait where an MpiProcess would be required to wait until either one of its Send or one of its Receives have finished. You must pass in the handle of the type of instruction that you are waiting for to finish.

The MiniMPIRuntime Abstract Class

The Main Idea

This abstract class defines the main functionality of creating the MpiProcesses and making sure that only the thread that created the object can call the Execute method. Each MiniMPIRuntime has a unique ID given to it.

List of Public Members

These are the members that can be called from outside of this project. These are the members that will be seen from projects using MiniMPI.

  • MiniMPIRuntime(int) - Constructor
  • Execute(Action<? extends MiniMPIRuntime>) - Method
  • GetRank() - Method
  • MpiFinalize() - Method
  • MpiInit() - Method
  • ID - Property
  • ProcessCount - Variable

Questions

  1. In the CreateProcesses method, why is the parameter not used at all, or is it? I can't see where you use the parameter "processWork". Actually, I think I figured it out. You have the parameter of processWork sent only to get the type of the parameter that is used so that you can pass the deligate for ProcessWorker<TRuntime> to the parametrized thread start. Is that correct?

The Main Idea