Skip to content

Commit 7e930c4

Browse files
authored
Merge pull request #24 from BerkeleyLab/program-termination
Add normal termination & fix error termination
2 parents 18acc5d + cae7752 commit 7e930c4

19 files changed

Lines changed: 347 additions & 138 deletions

.github/workflows/deploy-docs.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build and Deploy Documentation
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
Build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
13+
- name: Install Dependencies Ubuntu
14+
run: |
15+
sudo apt-get update
16+
sudo apt install -y python-dev python build-essential graphviz
17+
sudo pip install ford
18+
19+
- name: Build Developer Documenation
20+
run: |
21+
ford doc-generator.md
22+
23+
- name: Upload Documentation
24+
uses: actions/upload-artifact@v2
25+
with:
26+
name: documentation
27+
path: doc/html
28+
if-no-files-found: error
29+
30+
- name: Broken Link Check
31+
if: ${{ github.ref == 'refs/heads/main'}}
32+
uses: technote-space/broken-link-checker-action@v1
33+
with:
34+
TARGET: file://${{ github.workspace }}/doc/html/index.html
35+
RECURSIVE: true
36+
ASSIGNEES: ${{ github.actor }}
37+
38+
- name: Deploy API Documentation
39+
uses: JamesIves/github-pages-deploy-action@4.1.0
40+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
41+
with:
42+
branch: gh-pages
43+
folder: doc/html

README.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ Caffeine
33

44
**CoArray Fortran Framework of Efficient Interfaces to Network Environments**
55

6-
Caffeine is a parallel runtime library that aims to support Fortran compilers with a programming-model-agnostic application binary interface (ABI) to various communication libraries. Current work is on supporting the ABI with the [GASNet-EX] or with POSIX processes. Future plans include support for an alternative MPI back end.
6+
Caffeine is a parallel runtime library that aims to support Fortran compilers with a programming-model-agnostic application binary interface (ABI) to various communication libraries. Current work is on supporting the ABI with the [GASNet-EX] exascale-ready networking middleware. Future plans include support for an alternative Message Passing Interface ([MPI]) back end.
77

88
```
9-
109
.
1110
`:.
1211
`:.
@@ -26,6 +25,24 @@ Caffeine is a parallel runtime library that aims to support Fortran compilers wi
2625
`"--.__ __.--"'
2726
`""-------------""'
2827
```
28+
(Art from [ascii.co.uk].)
29+
30+
Prerequisites
31+
-------------
32+
Caffeine leverages the following non-parallel features of Fortran to simplify the writing of a portable, compact runtime-library that supports Fortran's parallel features:
33+
34+
| Feature | Introduced in |
35+
|-------------------------------------------|---------------|
36+
| The `iso_c_binding` module | Fortran 2003 |
37+
| The `contiguous` attribute [1] | Fortran 2008 |
38+
| `do concurrent` [2] | Fortran 2008 |
39+
| The ISO_Fortran_binding.h C header file | Fortran 2018 |
40+
| Assumed-type dummy arguments: `type(*)`, | Fortran 2018 |
41+
| Assumed-rank dummy arguments: `array(..)`,| Fortran 2018 |
42+
43+
[1] This requirement simplifies development but might be removed in a future release.
44+
45+
[2] This feature is used to support only `co_reduce` and might become optional in a future release.
2946

3047
Download, build, and run an example
3148
-----------------------------------
@@ -45,14 +62,24 @@ Run tests
4562

4663
Generate documentation
4764
----------------------
65+
Generate HTML documentation for Caffeine using [ford] as follows:
4866
```
4967
ford doc-generator.md
5068
```
5169
Open `doc/html/index.htmtl` in a web browser.
5270

53-
Art from [ascii.co.uk](https://ascii.co.uk/art/cup).
54-
55-
[GASNet-EX]: https://gasnet.lbl.gov
71+
Support and Development
72+
-----------------------
73+
The Computer Languages and Systems Software ([CLaSS]) Group at [Berkeley Lab] leads Caffeine development under funding from the Exascale Computing Project ([ECP]).
5674

75+
License
76+
-------
5777
See [LICENSE.txt](LICENSE.txt) for usage terms and conditions.
5878

79+
[GASNet-EX]: https://gasnet.lbl.gov
80+
[CLaSS]: https://go.lbl.gov/class
81+
[Berkeley Lab]: https://lbl.gov
82+
[ECP]: https://www.exascaleproject.org
83+
[ford]: https://github.com/Fortran-FOSS-Programmers/ford
84+
[MPI]: https://www.mpi-forum.org
85+
[ascii.co.uk]: https://ascii.co.uk/art/cup

example/hello.f90

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
program hello_world
2-
use caffeine_m, only : caf_caffeinate, caf_decaffeinate &
3-
, this_image => caf_this_image, num_images => caf_num_images
2+
use caffeine_m, only : caf_caffeinate, this_image => caf_this_image, num_images => caf_num_images, caf_stop
43
implicit none
54

65
if (caf_caffeinate() /= 0) error stop "caffeinate returned a non-zero exit code"
76

87
print *, "Hello from image", this_image(), "of", num_images()
98

10-
call caf_decaffeinate(exit_code=0) ! normal termination
9+
call caf_stop(stop_code=0) ! normal termination
1110

1211
end program
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
program error_stop_character_code
2-
use caffeine_m, only : caf_caffeinate, caf_decaffeinate, caf_error_stop
2+
use caffeine_m, only : caf_caffeinate, caf_error_stop
33
implicit none
44

55
if (caf_caffeinate() /= 0) error stop "caffeinate returned a non-zero exit_code"
66

7-
call caf_error_stop("")
7+
call caf_error_stop("Oh snap!")
88

99
stop 0 ! ../../test/caf_error_stop_test.f90 will report a test failure if this line runs
1010
end program

example/support-test/error_stop_integer_code.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
program error_stop_integer_code
2-
use caffeine_m, only : caf_caffeinate, caf_decaffeinate, caf_error_stop
2+
use caffeine_m, only : caf_caffeinate, caf_error_stop
33
implicit none
44

55
if (caf_caffeinate() /= 0) error stop "caffeinate returned a non-zero exit_code"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
program stop_with_no_code
2+
use caffeine_m, only : caf_caffeinate, caf_stop
3+
implicit none
4+
5+
if (caf_caffeinate() /= 0) error stop "caffeinate returned a non-zero exit_code"
6+
7+
call caf_stop(1)
8+
9+
stop 2 ! caffeine/test/zzz_finalization_test.f90 reports a failure if this line runs
10+
end program
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
program normal_termination
2-
use caffeine_m, only : caf_caffeinate, caf_decaffeinate
1+
program stop_with_no_code
2+
use caffeine_m, only : caf_caffeinate, caf_stop
33
implicit none
44

55
if (caf_caffeinate() /= 0) error stop "caffeinate returned a non-zero exit_code"
66

7-
call caf_decaffeinate(0)
7+
call caf_stop
88

99
stop 1 ! caffeine/test/zzz_finalization_test.f90 reports a failure if this line runs
1010
end program

src/caffeine/caffeinate_decaffeinate_s.F90

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,7 @@ function c_interop_arg(argnum) result(arg)
4545
end procedure
4646

4747
module procedure caf_decaffeinate
48-
49-
integer(c_int), parameter :: normal_termination=0
50-
51-
call caf_sync_all
52-
53-
call caf_c_decaffeinate(normal_termination)
48+
call caf_c_decaffeinate(exit_code)
5449
end procedure
5550

5651
end submodule caffeinate_decaffeinate_s

src/caffeine/caffeine.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ void caf_c_co_reduce(
7171
size_t c_sizeof_a = a_desc->elem_len;
7272
gex_Event_t ev;
7373

74-
switch (a_desc->type) {
75-
case float_Complex_workaround: c_sizeof_a *= 2; break;
76-
case double_Complex_workaround: c_sizeof_a *= 2; break;
77-
}
78-
7974
if (result_image) {
8075
ev = gex_Coll_ReduceToOneNB(
8176
myteam, result_image-1, a_address, a_address, GEX_DT_USER, c_sizeof_a, num_elements, GEX_OP_USER, user_op, &c_sizeof_a, 0

src/caffeine/error_termination_m.f90

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)