bsp.h File Reference

Defines the BSPlib prototypes. More...

#include <stdarg.h>

Include dependency graph for bsp.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Initialisation

void bsp_init (void(*smpd_part)(void), int, char *[])
 Initializes BSPonMPI.
void bsp_begin (int maxprocs)
 Marks the start of the SPMD code.
void bsp_end ()
 Ends the SPMD code.

Halt

void bsp_abort (const char *format,...)
 Aborts the program printing a message to the standard error output.

Enquiry

int bsp_nprocs ()
 Returns the number of processors available / allocated.
int bsp_pid ()
 Returns the rank of the processor.
double bsp_time ()
 The time in seconds since bsp_begin().

Superstep

void bsp_sync ()
 Seperates two supersteps.

DRMA

void bsp_push_reg (const void *, int)
 Makes the memory location with specified size available for DRMA operations at the next and additional supersteps.
void bsp_pop_reg (const void *)
 Deregisters the memory location.
void bsp_put (int, const void *, void *, int, int)
 Puts a block of data in the memory of some other processor at the next superstep.
void bsp_get (int, const void *, int, void *, int)
 Gets a block of data from the memory of some other processor at the next superstep.

BSMP

void bsp_send (int, const void *, const void *, int)
 Sends message to a processor.
void bsp_qsize (int *restrict, int *restrict)
void bsp_get_tag (int *restrict, void *restrict)
void bsp_move (void *, int)
 Dequeue the current message.
void bsp_set_tagsize (int *)
 Sets the tag size at the next superstep.

High Performance

void bsp_hpput (int, const void *, void *, int, int)
 Puts a block of data in the memory of some other processor at then next superstep.
void bsp_hpget (int, const void *, int, void *, int)
 Gets a block of data from the memory of some other processor at the next superstep.
int bsp_hpmove (void **, void **)
 Dequeue the current message in an unbuffered way.

Defines

#define restrict   __restrict


Detailed Description

Defines the BSPlib prototypes.

This include file should be used when writing a BSP program and is therefore part of the installation.

Author:
Wijnand Suijlen

Definition in file bsp.h.


Define Documentation

#define restrict   __restrict
 

Definition at line 45 of file bsp.h.

Referenced by bsp_get_tag(), bsp_hpmove(), bsp_move(), bsp_put(), bsp_send(), deliveryTable_execute(), deliveryTable_push(), memoryRegister_find(), memoryRegister_memoized_find(), memoryRegister_pack(), memoryRegister_pop(), and requestTable_execute().


Function Documentation

void bsp_abort const char *  format,
  ...
 

Aborts the program printing a message to the standard error output.

Parameters:
format uses the same format as printf()

Definition at line 511 of file bsp.c.

References bsp_intern_abort(), and ERR_BSP_ABORT.

Here is the call graph for this function:

void bsp_begin int  maxprocs  ) 
 

Marks the start of the SPMD code.

The code following the call to this function will be executed in parallel with at most maxprocs processors. The SPMD code must end with a call to bsp_end()

Parameters:
maxprocs Denotes the requested number of processors. The actual allocated number of processors may be less. Calling allocates the maximum number of processors.
See also:
bsp_nprocs()

bsp_end()

Definition at line 427 of file bsp.c.

References _BSPObject::begintime, bsp, bsp_free(), bsp_malloc, _BSPObject::communicator, _BSPObject::delivery_received_table, _BSPObject::delivery_table, deliveryTable_initialize(), DELIVTAB_SIZE, _BSPObject::memory_register, memoryRegister_initialize(), MEMREG_SIZE, _BSPObject::message_queue, messageQueue_initialize(), MIN, _BSPObject::nprocs, _BSPObject::rank, REQTAB_SIZE, _BSPObject::request_received_table, _BSPObject::request_table, and requestTable_initialize().

Here is the call graph for this function:

void bsp_end  ) 
 

Ends the SPMD code.

This function must be called after all SPMD code has been executed. The code after this call is executed by processor 0 only.

Definition at line 489 of file bsp.c.

References bsp, _BSPObject::delivery_received_table, _BSPObject::delivery_table, deliveryTable_destruct(), _BSPObject::memory_register, memoryRegister_destruct(), _BSPObject::request_received_table, _BSPObject::request_table, and requestTable_destruct().

Here is the call graph for this function:

void bsp_get int  pid,
const void *  src,
int  offset,
void *  dst,
int  nbytes
 

Gets a block of data from the memory of some other processor at the next superstep.

This function is buffered, i.e.: The data is retrieved from the destionation processor at the start of the next bsp_sync(). Translation of the src pointer is performed with help of earlier calls to bsp_push_reg()

Parameters:
pid Ranks of the source (remote) processor
src Pointer to source location using a pointer to a local memory region
offset offset from src in bytes
dst Pointer to destination location
nbytes Number of bytes to be received
See also:
bsp_push_reg()

Definition at line 716 of file bsp.c.

References bsp, ReqElement::dst, _BSPObject::memory_register, memoryRegister_memoized_find(), ReqElement::offset, _BSPObject::request_table, requestTable_push(), ReqElement::size, and ReqElement::src.

Referenced by bsp_hpget().

Here is the call graph for this function:

void bsp_get_tag int *  restrict,
void *  restrict
 

void bsp_hpget int  pid,
const void *  src,
int  offset,
void *  dst,
int  nbytes
 

Gets a block of data from the memory of some other processor at the next superstep.

This should be the high performance unbuffered version of bsp_get(). However currently it is the same as bsp_get()

Parameters:
pid Ranks of the source (remote) processor
src Pointer to source location using a pointer to a local memory region
offset offset from src in bytes
dst Pointer to destination location
nbytes Number of bytes to be received
See also:
bsp_push_reg()

Definition at line 862 of file bsp.c.

References bsp_get().

Here is the call graph for this function:

int bsp_hpmove void **  tag_ptr,
void **  payload_ptr
 

Dequeue the current message in an unbuffered way.

Parameters:
tag_ptr a pointer to reference of memory location which will contain the tag
payload_ptr a pointer to a reference of a memory location which will contain the pyload
Returns:
the payload size of the dequeued message

Definition at line 875 of file bsp.c.

References MessageQueue::accum_size, ALIGNED_TYPE, bsp, MessageQueue::head, _BSPObject::message_queue, MessageQueue::n_mesg, no_slots(), MessageQueue::recv_tag_size, and restrict.

Here is the call graph for this function:

void bsp_hpput int  pid,
const void *  src,
void *  dst,
int  offset,
int  nbytes
 

Puts a block of data in the memory of some other processor at then next superstep.

This should be de high perfomance unbuffered version of bsp_put, but currently these two functions are the same

Parameters:
pid rank of destination (remote) processor
src pointer to source location on source ( local ) processor
dst pointer to destination location on source processor. Translation of addresses is performed with help of earlier calls to bsp_push_reg()
offset offset from dst in bytes (comes in handy when working with arrays)
nbytes number of bytes to be copied
See also:
bsp_put()

Definition at line 845 of file bsp.c.

References bsp_put().

Here is the call graph for this function:

void bsp_init void(*)(void)  spmd_part,
int  argc,
char *  argv[]
 

Initializes BSPonMPI.

Bug:
Because several MPI implementations require that command line arguments are supplied, a call to this function at the start of the program is mandatory
Example
    void do_something()
    {
      bsp_begin(bsp_nprocs())
      ... a parallel program ...
      bsp_end()
    }  
      
    int main(int argc, char *argv[])
    {
      bsp_init( &do_something, argc, argv);
      ... optional sequential code ...
      do_something();
      ... optional sequential code ...
    }  
Parameters:
spmd_part reference to the SPMD function
argc obtained from function main()
argv obtained from function main()
See also:
bsp_begin()

bsp_end()

bsp_nprocs()

Definition at line 397 of file bsp.c.

References bsp, _BSPObject::nprocs, and _BSPObject::rank.

void bsp_move void *  payload,
int  reception_nbytes
 

Dequeue the current message.

Parameters:
payload A pointer to a memory location big enough to contain the payload or reception_nbytes
reception_nbytes The maximum number of bytes to copy

Definition at line 795 of file bsp.c.

References MessageQueue::accum_size, ALIGNED_TYPE, bsp, MessageQueue::head, _BSPObject::message_queue, MIN, MessageQueue::n_mesg, no_slots(), MessageQueue::recv_tag_size, and restrict.

Here is the call graph for this function:

int bsp_nprocs  ) 
 

Returns the number of processors available / allocated.

Returns:

Definition at line 533 of file bsp.c.

References bsp, and _BSPObject::nprocs.

int bsp_pid  ) 
 

Returns the rank of the processor.

Returns:
The rank of the processor

Definition at line 544 of file bsp.c.

References bsp, and _BSPObject::rank.

void bsp_pop_reg const void *  ident  ) 
 

Deregisters the memory location.

Parameters:
ident pointer to memory location
See also:
bsp_push_reg()

Definition at line 669 of file bsp.c.

References PopRegObject::address, bsp, _BSPObject::delivery_table, deliveryTable_push(), DelivElement::info, _DInfo::pop, popreg, _BSPObject::rank, and DelivElement::size.

Here is the call graph for this function:

void bsp_push_reg const void *  ident,
int  size
 

Makes the memory location with specified size available for DRMA operations at the next and additional supersteps.

Parameters:
ident pointer to memory location
size of memory block
Note:
In this version of BSPonMPI the parameter size is ignored
See also:
bsp_pop_reg()

Definition at line 654 of file bsp.c.

References PushRegObject::address, bsp, _BSPObject::delivery_table, deliveryTable_push(), DelivElement::info, _BSPObject::nprocs, _DInfo::push, pushreg, and DelivElement::size.

Here is the call graph for this function:

void bsp_put int  pid,
const void *  src,
void *  dst,
int  offset,
int  nbytes
 

Puts a block of data in the memory of some other processor at the next superstep.

This function is buffered, i.e.: the contents of src is copied to a buffer and transmitted at the next bsp_sync()

Parameters:
pid rank of destination (remote) processor
src pointer to source location on source (local) processor
dst pointer to destination location on source processor. Translation of addresses is performed with help of earlier calls to bsp_push_reg()
offset offset from dst in bytes (comes in handy when working with arrays)
nbytes number of bytes to be copied
See also:
bsp_push_reg()

Definition at line 689 of file bsp.c.

References bsp, _BSPObject::delivery_table, deliveryTable_push(), PutObject::dst, DelivElement::info, _BSPObject::memory_register, memoryRegister_memoized_find(), put, _DInfo::put, restrict, and DelivElement::size.

Referenced by bsp_hpput().

Here is the call graph for this function:

void bsp_qsize int *  restrict,
int *  restrict
 

void bsp_send int  pid,
const void *  tag,
const void *  payload,
int  payload_nbytes
 

Sends message to a processor.

You may supply a tag and and a payload. The default size of the tag is 0. To change the tag size you can use bsp_set_tagsize().

Parameters:
pid Rank of the destination processor
tag pointer to the tag
payload pointer to the payload
payload_nbytes size of the payload

Definition at line 742 of file bsp.c.

References bsp, _BSPObject::delivery_table, deliveryTable_push(), DelivElement::info, _BSPObject::message_queue, SendObject::payload_size, restrict, send, _DInfo::send, MessageQueue::send_tag_size, and DelivElement::size.

Here is the call graph for this function:

void bsp_set_tagsize int *  tag_nbytes  ) 
 

Sets the tag size at the next superstep.

Parameters:
tag_nbytes pointer to an int which should contain the size of the tag in bytes. It becomes current tag size.

Definition at line 816 of file bsp.c.

References bsp, _BSPObject::delivery_table, deliveryTable_push(), DelivElement::info, _BSPObject::message_queue, _BSPObject::rank, MessageQueue::send_tag_size, settag, _DInfo::settag, DelivElement::size, and SetTagObject::tag_size.

Here is the call graph for this function:

void bsp_sync  ) 
 

Seperates two supersteps.

Definition at line 564 of file bsp.c.

References bsp, _BSPObject::delivery_received_table, _BSPObject::delivery_table, deliveryTable_reset(), _BSPObject::message_queue, messageQueue_sync(), _BSPObject::nprocs, _BSPObject::request_received_table, _BSPObject::request_table, requestTable_reset(), and _ExpandableTable::used_slot_count.

Here is the call graph for this function:

double bsp_time  ) 
 

The time in seconds since bsp_begin().

Returns:
The time in seconds since bsp_begin()

Definition at line 553 of file bsp.c.

References _BSPObject::begintime, and bsp.


Generated on Sat Apr 8 20:13:04 2006 for BSPonMPI by  doxygen 1.4.6