Skip to content

Commit 1317ddc

Browse files
author
Damian Rouson
authored
Merge pull request #27 from sourceryinstitute/simplify-example
Simplify example/main.f90 & add example/README.md
2 parents 2abb872 + 989d2aa commit 1317ddc

File tree

2 files changed

+73
-4
lines changed

2 files changed

+73
-4
lines changed

example/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
Proof of Concept
2+
----------------
3+
This directory's [main program](./main.f90) defines an application in the form
4+
of a FEATS `application_t` object containing
5+
6+
1. A directed acyclic graph (DAG) encapsulated in a `dag_t` object provided by
7+
the [dag] library and
8+
2. An array of FEATS `task_t` objects capturing information about tasks that
9+
that the scheduler image assigns to compute images in an order that respects
10+
the dependencies described in the DAG.
11+
12+
The DAG in this example represents the module dependencies within the FEATS
13+
source code as described in the diagram at the bottom of this page.
14+
15+
The motivating use case is enabling the Fortran Package Manager ([`fpm`]) to
16+
perform parallel builds. In this proof concept, each task simply sleeps to pass
17+
a randomly chosen period of time. (No actual software compiling happens.) See
18+
below for the command used to run this example with present working directory
19+
set to the top directory in the FEATS source tree. Also below is sample output.
20+
The task completion order and image/task pairings will vary from one execution
21+
of the first command to the next execution of the same command.
22+
23+
```
24+
fpm run --example --compiler caf --runner "cafrun -n 4"
25+
Executing task number: 2 on image number: 3
26+
Executing task number: 1 on image number: 4
27+
Executing task number: 3 on image number: 2
28+
Compiling: dag_m
29+
Executing task number: 4 on image number: 3
30+
Compiling: assert_m
31+
Executing task number: 5 on image number: 4
32+
Compiling: payload_m
33+
Executing task number: 6 on image number: 2
34+
Compiling: data_loc_map_m
35+
Compiling: task_m
36+
Executing task number: 15 on image number: 2
37+
Executing task number: 7 on image number: 4
38+
Compiling: compile_m
39+
Executing task number: 13 on image number: 3
40+
Compiling: task_item_m
41+
Executing task number: 8 on image number: 4
42+
Compiling: app_m
43+
Executing task number: 9 on image number: 4
44+
Compiling: data_loc_map_s
45+
Executing task number: 10 on image number: 2
46+
Compiling: compile_s
47+
Executing task number: 12 on image number: 3
48+
Compiling: app_generator_m
49+
Executing task number: 14 on image number: 4
50+
Compiling: task_item_s
51+
Executing task number: 16 on image number: 3
52+
Compiling: image_m
53+
Executing task number: 11 on image number: 2
54+
Compiling: app_generator_s
55+
Executing task number: 17 on image number: 4
56+
Compiling: main
57+
Executing task number: 18 on image number: 2
58+
Compiling: payload_s
59+
Executing task number: 20 on image number: 3
60+
Compiling: mailbox_m
61+
Compiling: app_s
62+
Executing task number: 19 on image number: 4
63+
Compiling: image_s
64+
Compiling: final_task_m
65+
Executing task number: 21 on image number: 4
66+
Compiling: final_task_s
67+
```
68+
69+
![feats-dependencies](https://user-images.githubusercontent.com/13108868/133311851-721b7cda-1d10-4ee1-a51d-6169ca624839.png)
70+
71+
[`fpm`]: https://github.com/fortran-lang/fpm
72+
[dag]: https://github.com/sourceryinstitute/dag

example/main.f90

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
program main
22
!! Framework for Extensible Asynchronous Task Scheduling
3-
use application_m, only: application_t
43
use application_generator_m, only : generate_application
54
use image_m, only: image_t
65
use task_payload_map_m, only: task_payload_map_t
76
implicit none
87

9-
type(application_t) :: application
108
type(image_t) :: image
119
type(task_payload_map_t) :: results
1210

13-
application = generate_application()
14-
results = image%run(application)
11+
results = image%run(generate_application())
1512
end program

0 commit comments

Comments
 (0)