Skip to content

main.aug ​

Task scheduling benchmark · Source and specification

Files in this project

Code ​

aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
import compute from operations
int iterations = 2000
int index = 0
int checksum = 0
while index < iterations:
    scope:
        first = start compute(value=index)
        second = start compute(value=index + 1)
        (left, right) = wait for first and second
        checksum = checksum + left + right
    index = index + 1
print(value=checksum)
aug
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
import compute from operations
int iterations = 2000
int index = 0
int checksum = 0
while index < iterations {
    scope {
        first = start compute(value=index)
        second = start compute(value=index + 1)
        (left, right) = wait for first and second
        checksum = checksum + left + right
    }
    index = index + 1
}
print(value=checksum)

Compiled specification ​

Interactions and sequences

Startup ​

It sets iterations to 2000. It sets index and checksum separately, each to 0. While index is less than iterations, within a task and ownership scope, it sets first to a child task running compute with value from index with its inputs captured now. It sets second to a child task running compute with value from index plus 1 with its inputs captured now. source

It reads the result of waiting for first and second in input order; propagate failures once and binds [0] as left and [1] as right. It sets checksum to (checksum plus left) plus right. On leaving this scope, join its child tasks and release its local values. It increases index by 1. source

After the loop, it prints checksum. source

Dependencies ​

It uses compute from operations.

Built-in operations follow the language reference.

Last updated:

The world runs on language