FORM v5.0.0-35-g6318119
Data Structures | Macros | Typedefs | Functions | Variables
parallel.h File Reference
#include <mpi.h>
Include dependency graph for parallel.h:

Go to the source code of this file.

Data Structures

struct  PF_BUFFER
 
struct  ParallelVars
 

Macros

#define MASTER   0
 
#define PF_RESET   0 /* reset the timer */
 
#define PF_TIME   1 /* get the elapsed time */
 
#define PF_TERM_MSGTAG   10 /* master -> slave: sending terms */
 
#define PF_ENDSORT_MSGTAG   11 /* master -> slave: no more terms to be distributed, slave -> master: after EndSort() */
 
#define PF_DOLLAR_MSGTAG   12 /* slave -> master: sending $-variables */
 
#define PF_BUFFER_MSGTAG   20 /* slave -> master: sending sorted terms, or in PF_SendFile()/PF_RecvFile() */
 
#define PF_ENDBUFFER_MSGTAG   21 /* same as PF_BUFFER_MSGTAG, but indicates the end of operation */
 
#define PF_READY_MSGTAG   30 /* slave -> master: slave is idle and can accept terms */
 
#define PF_DATA_MSGTAG   50 /* InParallel, DoCheckpoint() */
 
#define PF_EMPTY_MSGTAG   52 /* InParallel, DoCheckpoint(), PF_SendFile(), PF_RecvFile() */
 
#define PF_STDOUT_MSGTAG   60 /* slave -> master: sending text to the stdout */
 
#define PF_LOG_MSGTAG   61 /* slave -> master: sending text to the log file */
 
#define PF_OPT_MCTS_MSGTAG   70 /* master <-> slave: optimization */
 
#define PF_OPT_HORNER_MSGTAG   71 /* master <-> slave: optimization */
 
#define PF_OPT_COLLECT_MSGTAG   72 /* slave -> master: optimization */
 
#define PF_RUNTIME_ERROR_MSGTAG   80 /* slave <-> master: runtime error */
 
#define PF_RUNTIME_SYNC_MSGTAG   81 /* master <-> slave: sync after EndSort() */
 
#define PF_MISC_MSGTAG   100
 
#define GNUC_PREREQ(major, minor, patchlevel)   0
 
#define OMPI_SKIP_MPICXX   1
 
#define indices   ((INDICES)(AC.IndexList.lijst))
 
#define PF_ANY_SOURCE   MPI_ANY_SOURCE
 
#define PF_ANY_MSGTAG   MPI_ANY_TAG
 
#define PF_COMM   MPI_COMM_WORLD
 
#define PF_BYTE   MPI_BYTE
 
#define PF_INT   MPI_INT
 
#define PF_LongMultiPack(buffer, count, type)   PF_LongMultiPackImpl(buffer, count, sizeof_datatype(type), type)
 
#define PF_LongMultiUnpack(buffer, count, type)   PF_LongMultiUnpackImpl(buffer, count, sizeof_datatype(type), type)
 

Typedefs

typedef struct ParallelVars PARALLELVARS
 

Functions

int PF_ISendSbuf (int, int)
 
int PF_Bcast (void *buffer, int count)
 
int PF_Reduce (const void *sendbuf, void *recvbuf, int count, MPI_Datatype type, MPI_Op op, int root)
 
int PF_RawSend (int, void *, LONG, int)
 
LONG PF_RawRecv (int *, void *, LONG, int *)
 
int PF_PreparePack (void)
 
int PF_Pack (const void *buffer, size_t count, MPI_Datatype type)
 
int PF_Unpack (void *buffer, size_t count, MPI_Datatype type)
 
int PF_PackString (const UBYTE *str)
 
int PF_UnpackString (UBYTE *str)
 
int PF_Send (int to, int tag)
 
int PF_Receive (int src, int tag, int *psrc, int *ptag)
 
int PF_Broadcast (void)
 
int PF_PrepareLongSinglePack (void)
 
int PF_LongSinglePack (const void *buffer, size_t count, MPI_Datatype type)
 
int PF_LongSingleUnpack (void *buffer, size_t count, MPI_Datatype type)
 
int PF_LongSingleSend (int to, int tag)
 
int PF_LongSingleReceive (int src, int tag, int *psrc, int *ptag)
 
int PF_PrepareLongMultiPack (void)
 
int PF_LongMultiPackImpl (const void *buffer, size_t count, size_t eSize, MPI_Datatype type)
 
int PF_LongMultiUnpackImpl (void *buffer, size_t count, size_t eSize, MPI_Datatype type)
 
int PF_LongMultiBroadcast (void)
 
int PF_EndSort (void)
 
WORD PF_Deferred (WORD *, WORD)
 
int PF_Processor (EXPRESSIONS, WORD, WORD)
 
int PF_Init (int *, char ***)
 
void PF_PreTerminate (int errorcode)
 
int PF_Terminate (int)
 
LONG PF_GetSlaveTimes (void)
 
LONG PF_BroadcastNumber (LONG)
 
void PF_BroadcastBuffer (WORD **buffer, LONG *length)
 
int PF_BroadcastString (UBYTE *)
 
int PF_BroadcastPreDollar (WORD **, LONG *, int *)
 
int PF_CollectModifiedDollars (void)
 
int PF_BroadcastModifiedDollars (void)
 
int PF_BroadcastRedefinedPreVars (void)
 
int PF_BroadcastCBuf (int bufnum)
 
int PF_BroadcastExpFlags (void)
 
int PF_StoreInsideInfo (void)
 
int PF_RestoreInsideInfo (void)
 
int PF_BroadcastExpr (EXPRESSIONS e, FILEHANDLE *file)
 
int PF_BroadcastRHS (void)
 
int PF_InParallelProcessor (void)
 
int PF_SendFile (int to, FILE *fd)
 
int PF_RecvFile (int from, FILE *fd)
 
void PF_MLock (void)
 
void PF_MUnlock (void)
 
LONG PF_WriteFileToFile (int, UBYTE *, LONG)
 
void PF_FlushStdOutBuffer (void)
 
void PF_ReceiveRuntimeError (void) NORETURN
 

Variables

PARALLELVARS PF
 
LONG PF_maxDollarChunkSize
 

Detailed Description

Header file with things relevant to ParForm.

Definition in file parallel.h.

Macro Definition Documentation

◆ MASTER

#define MASTER   0

Definition at line 43 of file parallel.h.

◆ PF_RESET

#define PF_RESET   0 /* reset the timer */

Definition at line 48 of file parallel.h.

◆ PF_TIME

#define PF_TIME   1 /* get the elapsed time */

Definition at line 49 of file parallel.h.

◆ PF_TERM_MSGTAG

#define PF_TERM_MSGTAG   10 /* master -> slave: sending terms */

Definition at line 54 of file parallel.h.

◆ PF_ENDSORT_MSGTAG

#define PF_ENDSORT_MSGTAG   11 /* master -> slave: no more terms to be distributed, slave -> master: after EndSort() */

Definition at line 55 of file parallel.h.

◆ PF_DOLLAR_MSGTAG

#define PF_DOLLAR_MSGTAG   12 /* slave -> master: sending $-variables */

Definition at line 56 of file parallel.h.

◆ PF_BUFFER_MSGTAG

#define PF_BUFFER_MSGTAG   20 /* slave -> master: sending sorted terms, or in PF_SendFile()/PF_RecvFile() */

Definition at line 57 of file parallel.h.

◆ PF_ENDBUFFER_MSGTAG

#define PF_ENDBUFFER_MSGTAG   21 /* same as PF_BUFFER_MSGTAG, but indicates the end of operation */

Definition at line 58 of file parallel.h.

◆ PF_READY_MSGTAG

#define PF_READY_MSGTAG   30 /* slave -> master: slave is idle and can accept terms */

Definition at line 59 of file parallel.h.

◆ PF_DATA_MSGTAG

#define PF_DATA_MSGTAG   50 /* InParallel, DoCheckpoint() */

Definition at line 60 of file parallel.h.

◆ PF_EMPTY_MSGTAG

#define PF_EMPTY_MSGTAG   52 /* InParallel, DoCheckpoint(), PF_SendFile(), PF_RecvFile() */

Definition at line 61 of file parallel.h.

◆ PF_STDOUT_MSGTAG

#define PF_STDOUT_MSGTAG   60 /* slave -> master: sending text to the stdout */

Definition at line 62 of file parallel.h.

◆ PF_LOG_MSGTAG

#define PF_LOG_MSGTAG   61 /* slave -> master: sending text to the log file */

Definition at line 63 of file parallel.h.

◆ PF_OPT_MCTS_MSGTAG

#define PF_OPT_MCTS_MSGTAG   70 /* master <-> slave: optimization */

Definition at line 64 of file parallel.h.

◆ PF_OPT_HORNER_MSGTAG

#define PF_OPT_HORNER_MSGTAG   71 /* master <-> slave: optimization */

Definition at line 65 of file parallel.h.

◆ PF_OPT_COLLECT_MSGTAG

#define PF_OPT_COLLECT_MSGTAG   72 /* slave -> master: optimization */

Definition at line 66 of file parallel.h.

◆ PF_RUNTIME_ERROR_MSGTAG

#define PF_RUNTIME_ERROR_MSGTAG   80 /* slave <-> master: runtime error */

Definition at line 67 of file parallel.h.

◆ PF_RUNTIME_SYNC_MSGTAG

#define PF_RUNTIME_SYNC_MSGTAG   81 /* master <-> slave: sync after EndSort() */

Definition at line 68 of file parallel.h.

◆ PF_MISC_MSGTAG

#define PF_MISC_MSGTAG   100

Definition at line 69 of file parallel.h.

◆ GNUC_PREREQ

#define GNUC_PREREQ (   major,
  minor,
  patchlevel 
)    0

Definition at line 79 of file parallel.h.

◆ OMPI_SKIP_MPICXX

#define OMPI_SKIP_MPICXX   1

Definition at line 120 of file parallel.h.

◆ indices

#define indices   ((INDICES)(AC.IndexList.lijst))

Definition at line 125 of file parallel.h.

◆ PF_ANY_SOURCE

#define PF_ANY_SOURCE   MPI_ANY_SOURCE

Definition at line 135 of file parallel.h.

◆ PF_ANY_MSGTAG

#define PF_ANY_MSGTAG   MPI_ANY_TAG

Definition at line 136 of file parallel.h.

◆ PF_COMM

#define PF_COMM   MPI_COMM_WORLD

Definition at line 137 of file parallel.h.

◆ PF_BYTE

#define PF_BYTE   MPI_BYTE

Definition at line 138 of file parallel.h.

◆ PF_INT

#define PF_INT   MPI_INT

Definition at line 139 of file parallel.h.

◆ PF_LongMultiPack

#define PF_LongMultiPack (   buffer,
  count,
  type 
)    PF_LongMultiPackImpl(buffer, count, sizeof_datatype(type), type)

Definition at line 246 of file parallel.h.

◆ PF_LongMultiUnpack

#define PF_LongMultiUnpack (   buffer,
  count,
  type 
)    PF_LongMultiUnpackImpl(buffer, count, sizeof_datatype(type), type)

Definition at line 247 of file parallel.h.

Function Documentation

◆ PF_ISendSbuf()

int PF_ISendSbuf ( int  to,
int  tag 
)
extern

Nonblocking send operation. It sends everything from buff to fill of the active buffer. Depending on tag it also can do waiting for other sends to finish or set the active buffer to the next one.

Parameters
tothe destination process number.
tagthe message tag.
Returns
0 if OK, nonzero on error.

Definition at line 266 of file mpi.c.

Referenced by FlushOut(), PF_Processor(), and PutOut().

◆ PF_Bcast()

int PF_Bcast ( void *  buffer,
int  count 
)
extern

Broadcasts a message from the master to slaves.

Parameters
[in,out]bufferthe starting address of buffer. The contents in this buffer on the master will be transferred to those on the slaves.
countthe length of the buffer in bytes.
Returns
0 if OK, nonzero on error.

Definition at line 452 of file mpi.c.

Referenced by PF_BroadcastBuffer(), and PF_BroadcastNumber().

◆ PF_Reduce()

int PF_Reduce ( const void *  sendbuf,
void *  recvbuf,
int  count,
MPI_Datatype  type,
MPI_Op  op,
int  root 
)
extern

Performs a reduce operation across all processes.

Parameters
[in]sendbufthe buffer containing the data to be reduced.
[out]recvbufthe buffer to store the reduced result (only for the root process).
countthe number of elements in the buffers.
typethe datatype of the elements.
opthe operation to apply.
rootthe root process number.
Returns
0 if OK, nonzero on error.

Definition at line 475 of file mpi.c.

Referenced by PF_GetSlaveTimes().

◆ PF_RawSend()

int PF_RawSend ( int  dest,
void *  buf,
LONG  l,
int  tag 
)
extern

Sends l bytes from buf to dest. Returns 0 on success, or -1.

Parameters
destthe destination process number.
bufthe send buffer.
lthe size of data in the send buffer in bytes.
tagthe message tag.
Returns
0 if OK, nonzero on error.

Definition at line 497 of file mpi.c.

◆ PF_RawRecv()

LONG PF_RawRecv ( int *  src,
void *  buf,
LONG  thesize,
int *  tag 
)
extern

Receives not more than thesize bytes from src, returns the actual number of received bytes, or -1 on failure.

Parameters
[in,out]srcthe source process number. In output, that of the actual received message.
[out]bufthe receive buffer.
thesizethe size of the receive buffer in bytes.
[out]tagthe message tag of the actual received message.
Returns
the actual sizeof received data in bytes, or -1 on failure.

Definition at line 518 of file mpi.c.

◆ PF_PreparePack()

int PF_PreparePack ( void  )
extern

Prepares for the next pack operations on the sender.

Returns
0 if OK, nonzero on error.

Definition at line 736 of file mpi.c.

Referenced by Optimize(), PF_BroadcastPreDollar(), PF_BroadcastString(), and PF_Init().

◆ PF_Pack()

int PF_Pack ( const void *  buffer,
size_t  count,
MPI_Datatype  type 
)
extern

Adds data into the pack buffer.

Parameters
bufferthe pointer to the buffer storing the data to be packed.
countthe number of elements in the buffer.
typethe data type of elements in the buffer.
Returns
0 if OK, nonzero on error.

Definition at line 754 of file mpi.c.

References MPI_ERRCODE_CHECK.

Referenced by Optimize(), PF_BroadcastPreDollar(), and PF_Init().

◆ PF_Unpack()

int PF_Unpack ( void *  buffer,
size_t  count,
MPI_Datatype  type 
)
extern

Retrieves the next data in the pack buffer.

Parameters
[out]bufferthe pointer to the buffer to store the unpacked data.
countthe number of elements of data to be received.
typethe data type of elements of data to be received.
Returns
0 if OK, nonzero on error.

Definition at line 783 of file mpi.c.

References MPI_ERRCODE_CHECK.

Referenced by Optimize(), PF_BroadcastPreDollar(), and PF_Init().

◆ PF_PackString()

int PF_PackString ( const UBYTE *  str)
extern

Packs a string str into the packed buffer PF_packbuf, including the trailing zero.

The first element (PF_INT) is the length of the packed portion of the string. If the string does not fit to the buffer PF_packbuf, the function packs only the initial portion. It returns the number of packed bytes, so if (str[length-1]=='\0') then the whole string fits to the buffer, if not, then the rest (str+length) must be packed and send again. On error, the function returns the negative error code.

One exception: the string "\0!\0" is used as an image of the NULL, so all 3 characters will be packed.

Parameters
stra string to be packed.
Returns
the number of packed bytes, or a negative value on failure.

Definition at line 818 of file mpi.c.

Referenced by PF_BroadcastString().

◆ PF_UnpackString()

int PF_UnpackString ( UBYTE *  str)
extern

Unpacks a string to str from the packed buffer PF_packbuf, including the trailing zero.

It returns the number of unpacked bytes, so if (str[length-1]=='\0') then the whole string was unpacked, if not, then the rest must be appended to (str+length). On error, the function returns the negative error code.

Parameters
[out]strthe buffer to store the unpacked string
Returns
the number of unpacked bytes, or a negative value on failure.

Definition at line 886 of file mpi.c.

Referenced by PF_BroadcastString().

◆ PF_Send()

int PF_Send ( int  to,
int  tag 
)
extern

Sends the contents in the pack buffer to the process specified by to.

Example:

if ( PF.me == SRC ) {
// Packing operations here...
PF_Send(DEST, TAG);
}
else if ( PF.me == DEST ) {
PF_Receive(SRC, TAG, &actual_src, &actual_tag);
// Unpacking operations here...
}
int PF_Receive(int src, int tag, int *psrc, int *ptag)
Definition mpi.c:959
int PF_Send(int to, int tag)
Definition mpi.c:933
int PF_PreparePack(void)
Definition mpi.c:736
Parameters
tothe destination process number.
tagthe message tag.
Returns
0 if OK, nonzero on error.

Definition at line 933 of file mpi.c.

References MPI_ERRCODE_CHECK.

◆ PF_Receive()

int PF_Receive ( int  src,
int  tag,
int *  psrc,
int *  ptag 
)
extern

Receives data into the pack buffer from the process specified by src. This function allows &src == psrc or &tag == ptag. Either psrc or ptag can be NULL.

See the example of PF_Send().

Parameters
srcthe source process number (can be PF_ANY_SOURCE).
tagthe source message tag (can be PF_ANY_TAG).
[out]psrcthe actual source process number of received message.
[out]ptagthe received message tag.
Returns
0 if OK, nonzero on error.

Definition at line 959 of file mpi.c.

References MPI_ERRCODE_CHECK.

◆ PF_Broadcast()

int PF_Broadcast ( void  )
extern

Broadcasts the contents in the pack buffer on the master to those on the slaves.

Example:

if ( PF.me == MASTER ) {
// Packing operations here...
}
if ( PF.me != MASTER ) {
// Unpacking operations here...
}
int PF_Broadcast(void)
Definition mpi.c:994
Returns
0 if OK, nonzero on error.

Definition at line 994 of file mpi.c.

References MPI_ERRCODE_CHECK.

Referenced by Optimize(), PF_BroadcastPreDollar(), PF_BroadcastString(), and PF_Init().

◆ PF_PrepareLongSinglePack()

int PF_PrepareLongSinglePack ( void  )
extern

Prepares for the next long-single-pack operations on the sender.

Returns
0 if OK, nonzero on error.

Definition at line 1561 of file mpi.c.

Referenced by PF_CollectModifiedDollars(), and PF_Processor().

◆ PF_LongSinglePack()

int PF_LongSinglePack ( const void *  buffer,
size_t  count,
MPI_Datatype  type 
)
extern

Adds data into the "long single" pack buffer.

Parameters
bufferthe pointer to the buffer storing the data to be packed.
countthe number of elements in the buffer.
typethe data type of elements in the buffer.
Returns
0 if OK, nonzero on error.

Definition at line 1579 of file mpi.c.

Referenced by PF_CollectModifiedDollars(), and PF_Processor().

◆ PF_LongSingleUnpack()

int PF_LongSingleUnpack ( void *  buffer,
size_t  count,
MPI_Datatype  type 
)
extern

Retrieves the next data in the "long single" pack buffer.

Parameters
[out]bufferthe pointer to the buffer to store the unpacked data.
countthe number of elements of data to be received.
typethe data type of elements of data to be received.
Returns
0 if OK, nonzero on error.

Definition at line 1613 of file mpi.c.

Referenced by PF_CollectModifiedDollars(), and PF_Processor().

◆ PF_LongSingleSend()

int PF_LongSingleSend ( int  to,
int  tag 
)
extern

Sends the contents in the "long single" pack buffer to the process specified by to.

Example:

if ( PF.me == SRC ) {
// Packing operations here...
PF_LongSingleSend(DEST, TAG);
}
else if ( PF.me == DEST ) {
PF_LongSingleReceive(SRC, TAG, &actual_src, &actual_tag);
// Unpacking operations here...
}
int PF_LongSingleReceive(int src, int tag, int *psrc, int *ptag)
Definition mpi.c:1693
int PF_LongSingleSend(int to, int tag)
Definition mpi.c:1650
int PF_PrepareLongSinglePack(void)
Definition mpi.c:1561
Parameters
tothe destination process number.
tagthe message tag.
Returns
0 if OK, nonzero on error.

Definition at line 1650 of file mpi.c.

Referenced by PF_CollectModifiedDollars(), and PF_Processor().

◆ PF_LongSingleReceive()

int PF_LongSingleReceive ( int  src,
int  tag,
int *  psrc,
int *  ptag 
)
extern

Receives data into the "long single" pack buffer from the process specified by src. This function allows &src == psrc or &tag == ptag. Either psrc or ptag can be NULL.

See the example of PF_LongSingleSend().

Parameters
srcthe source process number (can be PF_ANY_SOURCE).
tagthe source message tag (can be PF_ANY_TAG).
[out]psrcthe actual source process number of received message.
[out]ptagthe received message tag.
Returns
0 if OK, nonzero on error.

Definition at line 1693 of file mpi.c.

Referenced by PF_CollectModifiedDollars(), and PF_Processor().

◆ PF_PrepareLongMultiPack()

int PF_PrepareLongMultiPack ( void  )
extern

Prepares for the next long-multi-pack operations on the sender.

Returns
0 if OK, nonzero on error.

Definition at line 1752 of file mpi.c.

Referenced by Optimize(), PF_BroadcastCBuf(), PF_BroadcastExpFlags(), PF_BroadcastModifiedDollars(), and PF_BroadcastRedefinedPreVars().

◆ PF_LongMultiPackImpl()

int PF_LongMultiPackImpl ( const void *  buffer,
size_t  count,
size_t  eSize,
MPI_Datatype  type 
)
extern

Adds data into the "long multi" pack buffer.

Parameters
bufferthe pointer to the buffer storing the data to be packed.
countthe number of elements in the buffer.
eSizethe byte size of each element of data.
typethe data type of elements in the buffer.
Returns
0 if OK, nonzero on error.

Definition at line 1771 of file mpi.c.

References PF_LongMultiPackImpl().

Referenced by PF_LongMultiPackImpl().

Here is the call graph for this function:

◆ PF_LongMultiUnpackImpl()

int PF_LongMultiUnpackImpl ( void *  buffer,
size_t  count,
size_t  eSize,
MPI_Datatype  type 
)
extern

Retrieves the next data in the "long multi" pack buffer.

Parameters
[out]bufferthe pointer to the buffer to store the unpacked data.
countthe number of elements of data to be received.
eSizethe byte size of each element of data.
typethe data type of elements of data to be received.
Returns
0 if OK, nonzero on error.

Definition at line 1830 of file mpi.c.

References PF_LongMultiUnpackImpl().

Referenced by PF_LongMultiUnpackImpl().

Here is the call graph for this function:

◆ PF_LongMultiBroadcast()

int PF_LongMultiBroadcast ( void  )
extern

Broadcasts the contents in the "long multi" pack buffer on the master to those on the slaves.

Example:

if ( PF.me == MASTER ) {
// Packing operations here...
}
if ( PF.me != MASTER ) {
// Unpacking operations here...
}
int PF_PrepareLongMultiPack(void)
Definition mpi.c:1752
int PF_LongMultiBroadcast(void)
Definition mpi.c:1916
Returns
0 if OK, nonzero on error.

Definition at line 1916 of file mpi.c.

Referenced by Optimize(), PF_BroadcastCBuf(), PF_BroadcastExpFlags(), PF_BroadcastModifiedDollars(), and PF_BroadcastRedefinedPreVars().

◆ PF_EndSort()

int PF_EndSort ( void  )
extern

Finishes a master sorting with collecting terms from slaves. Called by EndSort().

If this is not the masterprocess, just initialize the sendbuffers and return 0, else PF_EndSort() sends the rest of the terms in the sendbuffer to the next slave and a dummy message to all slaves with tag PF_ENDSORT_MSGTAG. Then it receives the sorted terms, sorts them using a recursive 'tree of losers' (PF_GetLoser()) and writes them to the outputfile.

Returns
1 if the sorting on the master was done. 0 if EndSort() still must perform a regular sorting because it is not at the ground level or not on the master or in the sequential mode or in the InParallel mode. -1 if an error occurred.
Remarks
The slaves will send the sorted terms back to the master in the regular sorting (after the initialization of the send buffer in PF_EndSort()). See PutOut() and FlushOut().
This function has been changed such that when it returns 1, AM.S0->TermsLeft is set correctly. But AM.S0->GenTerms is not set: it will be set after collecting the statistics from the slaves at the end of PF_Processor(). (TU 30 Jun 2011)

Definition at line 874 of file parallel.c.

References FlushOut(), and PutOut().

Referenced by EndSort().

Here is the call graph for this function:

◆ PF_Deferred()

WORD PF_Deferred ( WORD *  term,
WORD  level 
)
extern

Replaces Deferred() on the slaves.

Parameters
termthe term that must be multiplied by the contents of the current bracket.
levelthe compiler level.
Returns
0 if OK, nonzero on error.

Definition at line 1201 of file parallel.c.

References Generator(), and InsertTerm().

Referenced by Generator().

Here is the call graph for this function:

◆ PF_Processor()

int PF_Processor ( EXPRESSIONS  e,
WORD  i,
WORD  LastExpression 
)
extern

Replaces parts of Processor() on the masters and slaves. On the master PF_Processor() is responsible for proper distribution of terms from the input file to the slaves. On the slaves it calls Generator() for all the terms that this process gets, but PF_GetTerm() gets terms from the master (not directly from infile).

Parameters
eThe pointer to the current expression.
iThe index for the current expression.
LastExpressionThe flag indicating whether it is the last expression.
Returns
0 if OK, nonzero on error.

Definition at line 1533 of file parallel.c.

References EndSort(), Generator(), LowerSortLevel(), NewSort(), PACK_LONG, PF_BroadcastRedefinedPreVars(), PF_ISendSbuf(), PF_LongSinglePack(), PF_LongSingleReceive(), PF_LongSingleSend(), PF_LongSingleUnpack(), PF_PrepareLongSinglePack(), poly_factorize_expression(), poly_unfactorize_expression(), PutOut(), StoreTerm(), SWAP, TimeCPU(), and WriteStats().

Referenced by Processor().

Here is the call graph for this function:

◆ PF_Init()

int PF_Init ( int *  argc,
char ***  argv 
)
extern

All the library independent stuff. PF_LibInit() should do all library dependent initializations.

Parameters
argcpointer to the number of arguments.
argvpointer to the arguments.
Returns
0 if OK, nonzero on error.

Definition at line 1947 of file parallel.c.

References PF_Broadcast(), PF_LibInit(), PF_Pack(), PF_PreparePack(), PF_RealTime(), and PF_Unpack().

Here is the call graph for this function:

◆ PF_PreTerminate()

void PF_PreTerminate ( int  errorcode)
extern

Prepares for termination. Called by Terminate().

Parameters
errorcodean error code.

Definition at line 2041 of file parallel.c.

◆ PF_Terminate()

int PF_Terminate ( int  errorcode)
extern

Performs the finalization of ParFORM. To be called by Terminate().

Parameters
errorcodean error code.
Returns
0 if OK, nonzero on error.

Definition at line 2061 of file parallel.c.

References PF_LibTerminate().

Here is the call graph for this function:

◆ PF_GetSlaveTimes()

LONG PF_GetSlaveTimes ( void  )
extern

Returns the total CPU time of all slaves together. This function must be called on the master and all slaves.

Returns
on the master, the sum of CPU times on all slaves.

Definition at line 2077 of file parallel.c.

References CHECK, PF_Reduce(), and TimeCPU().

Here is the call graph for this function:

◆ PF_BroadcastNumber()

LONG PF_BroadcastNumber ( LONG  x)
extern

Broadcasts a LONG value from the master to the all slaves.

Parameters
xthe number to be broadcast (set on the master).
Returns
the synchronised result.

Definition at line 2098 of file parallel.c.

References PF_Bcast().

Referenced by DoCheckpoint(), PF_BroadcastBuffer(), and StartVariables().

Here is the call graph for this function:

◆ PF_BroadcastBuffer()

void PF_BroadcastBuffer ( WORD **  buffer,
LONG *  length 
)
extern

Broadcasts a buffer from the master to all the slaves.

Parameters
[in,out]bufferon the master, the buffer to be broadcast. On the slaves, the buffer will be allocated if the length is greater than 0. The caller must free it.
[in,out]lengthon the master, the length of the buffer to be broadcast. On the slaves, it receives the length of transferred buffer. The actual transfer occurs only if the length is greater than 0.

Definition at line 2125 of file parallel.c.

References PF_Bcast(), and PF_BroadcastNumber().

Here is the call graph for this function:

◆ PF_BroadcastString()

int PF_BroadcastString ( UBYTE *  str)
extern

Broadcasts a string from the master to all slaves.

Parameters
[in,out]strThe pointer to a null-terminated string.
Returns
0 if OK, nonzero on error.

Definition at line 2167 of file parallel.c.

References PF_Broadcast(), PF_PackString(), PF_PreparePack(), and PF_UnpackString().

Here is the call graph for this function:

◆ PF_BroadcastPreDollar()

int PF_BroadcastPreDollar ( WORD **  dbuffer,
LONG *  newsize,
int *  numterms 
)
extern

Broadcasts dollar variables set as a preprocessor variables. Only the master is able to make an assignment like #$a=g; where g is an expression: only the master has an access to the expression. So, the master broadcasts the result to slaves.

The result is in *dbuffer of the size is *newsize (in number of WORDs), +1 for trailing zero. For slave newsize and numterms are output parameters.

Parameters
[in,out]dbufferthe buffer for a dollar variable.
[in,out]newsizethe size of the dollar variable in WORDs.
[in,out]numtermsthe number of terms in the dollar variable.
Returns
0 if OK, nonzero on error.

Definition at line 2222 of file parallel.c.

References PF_Broadcast(), PF_Pack(), PF_PreparePack(), and PF_Unpack().

Here is the call graph for this function:

◆ PF_CollectModifiedDollars()

int PF_CollectModifiedDollars ( void  )
extern

Combines modified dollar variables on the all slaves, and store them into those on the master.

The potentially modified dollar variables are given in PotModdollars, and the number of them is given by NumPotModdollars.

The current module could be executed in parallel only if all potentially modified variables are listed in ModOptdollars, otherwise the module was switched to the sequential mode.

Returns
0 if OK, nonzero on error.

Definition at line 2509 of file parallel.c.

References EndSort(), Generator(), LowerSortLevel(), NewSort(), PF_LongSinglePack(), PF_LongSingleReceive(), PF_LongSingleSend(), PF_LongSingleUnpack(), PF_PrepareLongSinglePack(), VectorInit, VectorPtr, VectorReserve, and VectorSize.

Here is the call graph for this function:

◆ PF_BroadcastModifiedDollars()

int PF_BroadcastModifiedDollars ( void  )
extern

Broadcasts modified dollar variables on the master to the all slaves.

The potentially modified dollar variables are given in PotModdollars, and the number of them is given by NumPotModdollars.

The current module could be executed in parallel only if all potentially modified variables are listed in ModOptdollars, otherwise the module was switched to the sequential mode. In either cases, we need to broadcast them.

Returns
0 if OK, nonzero on error.

Definition at line 2788 of file parallel.c.

References PF_LongMultiBroadcast(), and PF_PrepareLongMultiPack().

Here is the call graph for this function:

◆ PF_BroadcastRedefinedPreVars()

int PF_BroadcastRedefinedPreVars ( void  )
extern

Broadcasts preprocessor variables, which were changed by the Redefine statements in the current module, from the master to the all slaves.

The potentially redefined preprocessor variables are given in AC.pfirstnum, and the number of them is given by AC.numpfirstnum. For an actually redefined variable, the corresponding value in AC.inputnumbers is non-negative.

Returns
0 if OK, nonzero on error.

Definition at line 3005 of file parallel.c.

References PF_LongMultiBroadcast(), PF_PrepareLongMultiPack(), PutPreVar(), VectorPtr, and VectorReserve.

Referenced by PF_Processor().

Here is the call graph for this function:

◆ PF_BroadcastCBuf()

int PF_BroadcastCBuf ( int  bufnum)
extern

Broadcasts a compiler buffer specified by bufnum from the master to the all slaves.

Parameters
bufnumThe index of the compiler buffer to be broadcast.
Returns
0 if OK, nonzero on error.

Definition at line 3147 of file parallel.c.

References CbUf::boomlijst, CbUf::Buffer, CbUf::BufferSize, CbUf::CanCommu, CbUf::dimension, finishcbuf(), CbUf::lhs, CbUf::numdum, CbUf::NumTerms, PF_LongMultiBroadcast(), PF_PrepareLongMultiPack(), CbUf::Pointer, CbUf::rhs, and CbUf::Top.

Here is the call graph for this function:

◆ PF_BroadcastExpFlags()

int PF_BroadcastExpFlags ( void  )
extern

Broadcasts AR.expflags and several properties of each expression, e.g., e->vflags, from the master to all slaves.

Returns
0 if OK, nonzero on error.

Definition at line 3258 of file parallel.c.

References PF_LongMultiBroadcast(), and PF_PrepareLongMultiPack().

Here is the call graph for this function:

◆ PF_StoreInsideInfo()

int PF_StoreInsideInfo ( void  )
extern

Definition at line 3095 of file parallel.c.

◆ PF_RestoreInsideInfo()

int PF_RestoreInsideInfo ( void  )
extern

Definition at line 3121 of file parallel.c.

◆ PF_BroadcastExpr()

int PF_BroadcastExpr ( EXPRESSIONS  e,
FILEHANDLE file 
)
extern

Broadcasts an expression from the master to the all slaves.

Parameters
eThe expression to be broadcast.
fileThe file in which the expression is sitting.
Returns
0 if OK, nonzero on error.

Definition at line 3552 of file parallel.c.

Referenced by PF_BroadcastRHS().

◆ PF_BroadcastRHS()

int PF_BroadcastRHS ( void  )
extern

Broadcasts expressions appearing in the right-hand side from the master to the all slaves.

Returns
0 if OK, nonzero on error.

Definition at line 3580 of file parallel.c.

References PF_BroadcastExpr().

Referenced by Processor().

Here is the call graph for this function:

◆ PF_InParallelProcessor()

int PF_InParallelProcessor ( void  )
extern

Processes expressions in the InParallel mode, i.e., dividing expressions marked by partodo over the slaves.

Returns
0 if OK, nonzero on error.

Definition at line 3627 of file parallel.c.

Referenced by Processor().

◆ PF_SendFile()

int PF_SendFile ( int  to,
FILE *  fd 
)
extern

Sends a file to the process specified by to.

Parameters
tothe destination process number.
fdthe file to be sent.
Returns
the size of sent data in bytes, or -1 on error.

Definition at line 4234 of file parallel.c.

References PF_RawSend().

Referenced by DoCheckpoint().

Here is the call graph for this function:

◆ PF_RecvFile()

int PF_RecvFile ( int  from,
FILE *  fd 
)
extern

Receives a file from the process specified by from.

Parameters
fromthe source process number.
fdthe file to save the received data.
Returns
the size of received data in bytes, or -1 on error.

Definition at line 4272 of file parallel.c.

References PF_RawRecv().

Referenced by DoCheckpoint().

Here is the call graph for this function:

◆ PF_MLock()

void PF_MLock ( void  )
extern

A function called by MLOCK(ErrorMessageLock) for slaves.

Definition at line 4353 of file parallel.c.

References VectorClear.

◆ PF_MUnlock()

void PF_MUnlock ( void  )
extern

A function called by MUNLOCK(ErrorMessageLock) for slaves.

Definition at line 4369 of file parallel.c.

References PF_RawSend(), VectorEmpty, VectorPtr, and VectorSize.

Here is the call graph for this function:

◆ PF_WriteFileToFile()

LONG PF_WriteFileToFile ( int  handle,
UBYTE *  buffer,
LONG  size 
)
extern

Replaces WriteFileToFile() on the master and slaves.

It copies the given buffer into internal buffers if called between MLOCK(ErrorMessageLock) and MUNLOCK(ErrorMessageLock) for slaves and handle is StdOut or LogHandle, otherwise calls WriteFileToFile().

Parameters
handlea file handle that specifies the output.
buffera pointer to the source buffer containing the data to be written.
sizethe size of data to be written in bytes.
Returns
the actual size of data written to the output in bytes.

Definition at line 4398 of file parallel.c.

References VectorClear, VectorPtr, VectorPushBacks, and VectorSize.

◆ PF_FlushStdOutBuffer()

void PF_FlushStdOutBuffer ( void  )
extern

Explicitly Flushes the buffer for the standard output on the master, which is used if PF_ENABLE_STDOUT_BUFFERING is defined.

Definition at line 4492 of file parallel.c.

References VectorClear, VectorPtr, and VectorSize.

◆ PF_ReceiveRuntimeError()

void PF_ReceiveRuntimeError ( void  )
extern

Handles a runtime error message received from another process. It ultimately calls Terminate(-1).

Definition at line 4820 of file parallel.c.

References CHECK, PF_RawRecv(), and PF_RawSend().

Referenced by PF_RecvWbuf().

Here is the call graph for this function:

Variable Documentation

◆ PF

PARALLELVARS PF
extern

Definition at line 99 of file parallel.c.

◆ PF_maxDollarChunkSize

LONG PF_maxDollarChunkSize
extern

Definition at line 74 of file mpi.c.