source: CIVL/examples/concurrency/mp_proc.cvh

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 966 bytes
Line 
1 void send(void *buf, int count, int dest, int tag, $comm comm) {
2 $message out = $message_pack(rank, dest, tag, buf, count*sizeof(double));
3 $comm_enqueue(comm, out);
4 }
5
6 void recv(void *buf, int count, int source, int tag, $comm comm) {
7 $message in = $comm_dequeue(comm, source, tag);
8 $message_unpack(in, buf, count*sizeof(double));
9 }
10
11 void sendrecv(void *sendbuf, int sendcount, int dest, int sendtag,
12 void *recvbuf, int recvcount, int source, int recvtag, $comm comm) {
13 $message out = $message_pack(rank, dest, sendtag, sendbuf, sendcount*sizeof(double));
14 $message in;
15 _Bool probe = $comm_probe(comm, source, recvtag);
16
17 $choose {
18 $when (1){
19 $comm_enqueue(comm, out);
20 in = $comm_dequeue(comm, source, recvtag);
21 }
22 $when (probe){
23 in = $comm_dequeue(comm, source, recvtag);
24 $comm_enqueue(comm, out);
25 }
26 }
27 $message_unpack(in, recvbuf, recvcount*sizeof(double));
28 }
29
30 $when (__start);
Note: See TracBrowser for help on using the repository browser.