Skip to content

Commit

Permalink
Merge pull request #72 from sourceryinstitute/partial-cray-support
Browse files Browse the repository at this point in the history
Partial Cray support
  • Loading branch information
rouson authored Mar 5, 2024
2 parents 1b01017 + 0d11ce5 commit b5f5317
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 53 deletions.
78 changes: 50 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,19 @@ compiler standard-conformance, including a test for each scenario in which the
the Fortran 2023 standard requires that an object be finalized. The table below
summarizes the observed compiler behaviors:

| _Compiler_ | _Test failures_ | _Version tested_ |
| :--- | :---: | :--- |
| AMD `flang` | N.A. (see Note 1.) | 13.0.0 (AOCC_3.2.0-Build\#128 2021\_11\_12) |
| Cray `ftn` | >= 3 (see Note 2.) | 13.0.1 |
| GCC `gfortran` :trophy: | 0 | 13.1.0 |
| IBM `xlf2008_r` | 1 | 17.1.0 on AIX |
| Intel `ifort` | 1 | 2021.7.0 Build 20220726_000000 |
| Intel `ifx` | 1 | 2024.0.0 Build 20231017 |
| LLVM `flang` :trophy: | 0 | 19.0.0 `git` commit 325f5123 |
| NAG `nagfor` :trophy: | 0 | 7.1 Build 7113 |
| NVIDIA `nvfortran` | 2 | 22.7-0 |

**Notes**
1. Fails to build due to an internal compiler error (ICE).
2. Fails to build due to `fpm` issue [767]. See [test/README.md#cray] for a lower bound on the Cray compiler test failures.
| _Compiler_ | _Test failures_ | _Version tested_ |
| :--- | :---: | :--- |
| AMD `flang` | N.A. (see Note) | 13.0.0 (AOCC_3.2.0-Build\#128 2021\_11\_12) |
| Cray `ftn` | 4 | 17.0.0 |
| GCC `gfortran` :trophy: | 0 | 13.1.0 |
| IBM `xlf2008_r` | 1 | 17.1.0 on AIX |
| Intel `ifort` | 1 | 2021.7.0 Build 20220726_000000 |
| Intel `ifx` | 1 | 2024.0.0 Build 20231017 |
| LLVM `flang` :trophy: | 0 | 19.0.0 `git` commit 325f5123 |
| NAG `nagfor` :trophy: | 0 | 7.1 Build 7113 |
| NVIDIA `nvfortran` | 2 | 22.7-0 |

Note: AMD `flang` fails to build Smart-Pointers due to an internal compiler error (ICE).

See the [test suite README.md](./test/README.md) for more details on each compiler's test
results.
Expand All @@ -93,42 +91,66 @@ cd smart-pointer
```
followed by one of the commands below corresponding to your compiler choice.

### Numerical Algorithms Group
### Fully supported compilers
The following compilers pass all Smart-Pointers tests.

#### GCC `gfortran`
```
fpm test
```

#### LLVM `flang`
```
fpm test --compiler flang-new
```

#### NAG `nagfor`
```
fpm test --compiler nagfor --flag -fpp
```

### Intel
### Partially supported compilers
The following compilers pass most Smart-Pointers tests.

#### HPE: Cray Compiler Environment (CCE)
Building with `fpm` using the CCE `ftn` compiler wrapper requires an additional
wrapper to identify the wrapped compiler. Place a file named `crayftn.sh` at the
front of your `PATH` environment variable containing the following contents:
```
fpm test --compiler ifort
#!/bin/bash
ftn "$@"
```
or
Then test with the following command
```
fpm test --compiler ifx
fpm test --compiler crayftn.sh
```
where the latter requires `fpm` 0.10.0 or later.

### IBM
#### IBM
```
fpm test --archiver ar --compiler xlf2008_r --flag -DXLF
```

### GCC
#### Intel `ifort`
```
fpm test
fpm test --compiler ifort
```

### LLVM
#### Intel `ifx`
```
fpm test --compiler flang-new
fpm test --compiler ifx
```
where the latter requires `fpm` 0.10.0 or later.

### NVIDIA
#### NVIDIA `nvfortran`
```
fpm test --compiler nvfortran --flag -Mpreprocess
```

### AMD
### Unsupported compiler
The following compiler cannot build the Smart-Pointers library.

#### AMD `flang`
```
fpm test --compiler flang --flag -cpp
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ program specification_expression_finalization
contains

subroutine finalize_specification_expression_result
#ifndef _CRAYFTN
real tmp(component(finalizable_t(component=0))) !! Finalizes the finalizable_t function result
real eliminate_unused_variable_warning
tmp = eliminate_unused_variable_warning
#endif
end subroutine

end program
42 changes: 19 additions & 23 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,27 @@ Detailed Results
- Result: Fails to build due to an internal compiler error (ICE)

### Cray
- Version: 13.0.1
- Result: at least 3 test failures.
The Smart-Pointers library does not currenlty build with the Cray Fortran compiler, but
the compiler standard-conformance tests embodied in [compiler_test_m.f90] also exist in
a standalone format in a type-finalization [branch] of the Berkely Lab fork of the
llvm-test-suite repository. The reslts of running those compiler test show three compiler
test failures as follows:
- Version: 17.0.0
- Result: 4 test failures.
```
git clone https://github.com/berkeleylab/llvm-test-suite
cd llvm-test-suite/Fortran/UnitTests/finalization
ftn compile_me_only.f90
> ./a.out
Cray Fortran : Version 13.0.1 fails to compile specification_expression_finalization.f90
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
Fail: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at the end of a block construct
Pass: finalizes a function reference on the RHS of an intrinsic assignment
Fail: finalizes a specification expression function result
Fail: finalizes an intent(out) derived type dummy argument
Pass: finalizes an allocatable component object
The compiler
Pass: finalizes a non-allocatable object on the LHS of an intrinsic assignment
Fail: finalizes an allocated allocatable LHS of an intrinsic assignment
Pass: finalizes a target when the associated pointer is deallocated
Pass: finalizes an object upon explicit deallocation
Pass: finalizes a non-pointer non-allocatable object at the END statement
Pass: finalizes a non-pointer non-allocatable object at END BLOCK statement
Pass: finalizes a function reference on the RHS of an intrinsic assignment
Pass: finalizes a specification expression function result
Fail: finalizes an intent(out) derived type dummy argument
Pass: finalizes an allocatable component object
A smart_pointer
Pass: creates a resource when constructed
Fail: removes the resource when the object goes out of scope
Pass: copy points to the same resource as the original
Fail: has zero references after a shallow copy goes out of scope
```
The number of unit test failures for the remainder of the Smart-Pointers test suite is unknown.

### GCC
- Version: 13.1.0
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions test/sp_smart_pointer_test_m.F90
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function check_deletion() result(test_passes)
function check_copy() result(test_passes)
logical test_passes
type(object_t) :: reference
#ifdef XLF
#if defined(XLF) || defined(_CRAYFTN)
type(object_t) :: original

original = object_t()
Expand All @@ -107,7 +107,7 @@ function check_copy() result(test_passes)
reference_to_declared = declared
test_passes = associated(original%ref, reference%ref) .and. associated(declared%ref, reference_to_declared%ref)
end block
#ifndef XLF
#if !defined(XLF) && !defined(_CRAYFTN)
end associate
#endif

Expand Down

0 comments on commit b5f5317

Please sign in to comment.