|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread com.multicorebsp.core.BSP_PROGRAM
public abstract class BSP_PROGRAM
This class represents an executable concurrent program.
This framework is designed according a 'single program, multiple data (SPMD)'-
principle; extending (non-abstract) classes must define sequential instructions
(main_part) and instructions to be executed in parallel (parallel_part).
The parallel part is called from the sequential part by calling bsp_begin(P),
with P the number of threads to be spawned. The parallel part is ended by
bsp_end(), after which the sequential part executes any remaining
instructions.
Global variables are available within this package; they are BSP_REGISTER for
single variables, and BSP_CONTIGUOUS_ARRAY for global arrays. Refer to the
documentation of those classes for information how to perform inter-process
communication.
BSPOnJava stands for Bulk Synchronous Processing on Java. The BSP-model itself
has been around for decades, and has seen many implementations; most of them
in C (with additional Fortran interfaces). One of the more recent implementations
is BSPOnMPI, which implements the Oxford BSP library (BSPlib) interface on
top of the more popular Message Passing Interface (MPI) parallel model.
Unlike BSPOnMPI, BSPOnJava has a very different interface than that of the
Oxford BSP implementation. This is due to two things:
- Java is a clean, object-oriented language and thus calls for a more
object-oriented approach for a parallel model, and
- BSPOnJava explicitly targets multiple processors, multiple cores,
shared-memory machines only.
Like the original BSP model, we advocate portability which is synergetic with
the Java language.
Key property of the BSP model is the synchronisation barrier. In-between
barriers, each processor executes the same code and may or may not call inter-
process communication commands. Communication is however not performed before
synchronisation, but is guaranteed to be performed after the next
synchronisation.
Please refer to the main documentation or the example programs bundled with
this library for more details.
BSP_REGISTER
,
BSP_ARRAY
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
BSP_PROGRAM()
Base constructor. |
Method Summary | |
---|---|
protected void |
bsp_abort()
Aborts the parallel part. |
protected void |
bsp_begin(int P)
Starts P threads, each performing the instructions in parallel_part(). |
protected int |
bsp_nprocs()
Method to request the total number of threads active in parallel. |
protected int |
bsp_pid()
Method to request the current thread (processor) ID. |
protected void |
bsp_sync()
Synchronises all threads. |
int |
getPid()
|
protected abstract void |
main_part()
Stuff that only 1 processor is supposed to do until bsp_begin() is encountered. |
protected abstract void |
parallel_part()
The part of the algorithm that needs to run in parallel. |
void |
run()
Basic run method. |
void |
waitForEnd()
Lets threads not associated to this parallel program wait until execution is done. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BSP_PROGRAM()
Method Detail |
---|
protected final void bsp_begin(int P) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.InterruptedException, EmptyQueueException
P
- The number of threads to spawn.
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.InterruptedException
EmptyQueueException
public final void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected abstract void main_part() throws java.lang.InterruptedException
java.lang.InterruptedException
protected abstract void parallel_part() throws java.lang.InterruptedException, java.lang.IllegalAccessException, EmptyQueueException
java.lang.InterruptedException
java.lang.IllegalAccessException
EmptyQueueException
protected final void bsp_sync() throws java.lang.InterruptedException, java.lang.IllegalAccessException
java.lang.InterruptedException
java.lang.IllegalAccessException
protected final void bsp_abort()
protected final int bsp_nprocs()
protected final int bsp_pid()
public void waitForEnd() throws java.lang.InterruptedException
java.lang.InterruptedException
public int getPid()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |