CPL
Page: (parallel)Top, Next: nonparallel, Prev: (graphics), Up: (cpl)Library Index

Parallel computing

Page: (parallel)SHARED, Next: PARALLEL, Up: Top Index

SHARED

Prefix to global variable declarations specifying that the declared variables are to be shared among parallel modules. Variables without this declaration have separate instances for each module, i.e. changing their value produces no outside effect. Example: SHARED ARRAY(0..100) OF REAL vec
Page: (parallel)PARALLEL, Next: synchronization, Prev: SHARED, Up: Top Index

PARALLEL

Prefix to either (cpl)MODULE or (cpl)LOOP that specifies parallel execution. A PARALLEL MODULE contains a block of code that gets executed in parallel with whatever follows (including possibly a sequence of other modules). Synchronization occurs at the end of the enclosing block: that is, the enclosing block does not end until all intervening modules are completed. A PARALLEL LOOP is a loop all instances of which occur in parallel. Synchronization occurs before the LOOP terminates and the program is allowed to continue.
Page: (parallel)synchronization, Next: tcpserver, Prev: PARALLEL, Up: Top Index

synchronization

Once parallel processes are running explicit synchronization can be achieved through shared variables. A process can be made to wait for a condition by the instruction SLEEP UNTIL <condition> In order to make all sleeping processes verify their condition and wake up as needed, the process modifying the condition must subsequently execute the command WAKEUP
Page: (parallel)tcpserver, Next: tcpclient, Prev: synchronization, Up: Top Index

int tcpserver(uint16_t port)

C function (transparently available to CPL): listen on port port for a TCP connection and return the corresponding file handle.
Page: (parallel)tcpclient, Next: nonparallel, Prev: tcpserver, Up: Top Index

int tcpclient(const char ∗hostname, uint16_t port)

C function (transparently available to CPL): connect to a TCP server listening on port port of host hostname and return the corresponding file handle.
Page: (parallel)nonparallel, Next: (symbolic), Prev: Top, Up: (cpl)Library Index

nonparallel.cpl

Fake parallel-computing package that provides void equivalents of the parallel.cpl extensions.