com.multicorebsp.core
Class BSP_GLOBAL_COMM<T,S extends BSP_GLOBAL_COMM<?,?>>

java.lang.Object
  extended by com.multicorebsp.core.BSP_GLOBAL_COMM<T,S>
Type Parameters:
T - Raw data type of global variable.
S - Class implementing BSP_GLOBAL_COMM
Direct Known Subclasses:
BSP_GLOBAL_ARR_COMM, BSP_INTEGER, BSP_REGISTER

public abstract class BSP_GLOBAL_COMM<T,S extends BSP_GLOBAL_COMM<?,?>>
extends java.lang.Object

Defines what functions should be implemented for global BSP variables.


Constructor Summary
BSP_GLOBAL_COMM()
           
 
Method Summary
abstract  void bsp_direct_get(int pid)
          Get instruction.
abstract  void bsp_direct_get(S source, int pid)
          Direct get instruction.
abstract  void bsp_get(int pid)
          Get instruction.
abstract  void bsp_get(S source, int pid)
          Get instruction.
abstract  void bsp_move()
          BSMP instruction.
abstract  void bsp_put(int pid)
          Put instruction.
abstract  void bsp_put(S source, int pid)
          Put instruction.
abstract  void bsp_put(T source, int pid)
          Put instruction.
abstract  int bsp_qsize()
          BSMP instruction.
abstract  void bsp_send(int pid)
          Bulk-synchronous message passing (BSMP) instruction.
abstract  void bsp_send(S source, int pid)
          BSMP instruction.
abstract  void bsp_send(T source, int pid)
          BSMP instruction.
abstract  void unregister()
          Removes all shared references.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BSP_GLOBAL_COMM

public BSP_GLOBAL_COMM()
Method Detail

bsp_put

public abstract void bsp_put(int pid)
Put instruction. Copies the current variable (local to the current processor) to the current variable local to destination processor pid. This instruction buffers the to-be copied current elements here; this variable thus is free to change after calling this method.

Note that the copied element will be available at the destination only after synchronisation.

Parameters:
pid - The destination processor.

bsp_put

public abstract void bsp_put(S source,
                             int pid)
Put instruction. Copies the source variable (local to the current processor) to the this variable local to destination processor pid. This instruction buffers the to-be copied current elements here; this variable thus is free to change after calling this method.

Note that the copied element will be available at the destination only after synchronisation.

Parameters:
source - Source global variable.
pid - Destination processor.

bsp_put

public abstract void bsp_put(T source,
                             int pid)
Put instruction. Copies the source variable (local to the current processor) to the this variable local to destination processor pid. This instruction buffers the to-be copied current elements here; this variable thus is free to change after calling this method.

Note that the copied element will be available at the destination only after synchronisation.

Parameters:
source - Source variable.
pid - Destination processor.

bsp_get

public abstract void bsp_get(int pid)
Get instruction. Short for bsp_get( this, from );

Parameters:
pid - From which processor to get its variable.

bsp_get

public abstract void bsp_get(S source,
                             int pid)
Get instruction. Gets target source variable local to source processor pid, and puts those contents in this variable (local to current processor).

This instruction does not buffer the element to be got as those are generally unavailable from this processor's perspective. Hence, the element at the source variable's processor at synchronisation time is the element which will be copied to the current variable.

Note that gets and puts are not necessarily freely interchangeable. Note that the retrieved element will be available at the destination only after synchronisation.

Parameters:
source - From which global variable to get its contents.
pid - From which processor to get its variable.

bsp_direct_get

public abstract void bsp_direct_get(int pid)
Get instruction. Short for bsp_direct_get( this, from );

Parameters:
pid - From which processor to get its variable.

bsp_direct_get

public abstract void bsp_direct_get(S source,
                                    int pid)
Direct get instruction. Gets target source variable local to source processor pid, and puts those contents in this variable (local to current processor).
Does this immediately; communication does not wait for a sync, and this method blocks.

Parameters:
source - From which global variable to get its contents.
pid - From which processor to get its variable.

bsp_send

public abstract void bsp_send(int pid)
Bulk-synchronous message passing (BSMP) instruction. Sends the caption of this shared variable to the message queue of the thread with the given ID.

Parameters:
pid - The ID of the receiving thread.

bsp_send

public abstract void bsp_send(S source,
                              int pid)
BSMP instruction. Sends the given object to the message queue of the thread with the given ID.

Parameters:
source - The object to send.
pid - The ID of the receiving thread.

bsp_send

public abstract void bsp_send(T source,
                              int pid)
BSMP instruction. Sends the given object to the message queue of the thread with the given ID.

Parameters:
source - The object to send.
pid - The ID of the receiving thread.

bsp_move

public abstract void bsp_move()
                       throws EmptyQueueException
BSMP instruction. Moves an incoming message from the queue into this shared variable, hence overwriting the current variable. If the queue is empty, the variable is set to null.

Throws:
EmptyQueueException

bsp_qsize

public abstract int bsp_qsize()
BSMP instruction. Reports the number of messages waiting in the local queue.

Returns:
The number of messages in queue.

unregister

public abstract void unregister()
Removes all shared references. Cannot be used afterwards.