# Fortran 2018 Examples
[![cmake](https://github.com/scivision/fortran2018-examples/actions/workflows/cmake.yml/badge.svg)](https://github.com/scivision/fortran2018-examples/actions/workflows/cmake.yml)
[![oneapi-linux](https://github.com/scivision/fortran2018-examples/actions/workflows/oneapi-linux.yml/badge.svg)](https://github.com/scivision/fortran2018-examples/actions/workflows/oneapi-linux.yml)
[![fpm](https://github.com/scivision/fortran2018-examples/actions/workflows/fpm.yml/badge.svg)](https://github.com/scivision/fortran2018-examples/actions/workflows/fpm.yml)
Standalone examples of Fortran 2018 and 2023 standard features.
Popular,
[free-to-use Fortran compilers](https://www.scivision.dev/free-c-fortran-compilers/)
(GCC, Intel oneAPI, NVIDIA, Cray, IBM OpenXL, AOCC, Flang) and paid compilers such as NAG support all or many Fortran 2008 and 2018 standards.
Some standard Fortran features are so distinctive that we've put examples in separate repos:
* [C / C++ interface to/from Fortran](https://github.com/scivision/fortran-cpp-interface)
* [Fortran submodule](https://github.com/scivision/fortran-submodule)
* [Fortran coarray](https://github.com/scivision/fortran-coarray-mpi-examples): modern Fortran is the only major compiled language standard with intrinsic massively parallel arrays. Also contains MPI examples.
* [do concurrent, OpenMP, OpenACC](https://github.com/scivision/fortran-parallel-examples): parallel execution with Fortran directives and native syntax.
The examples are built with CMake:
```sh
cmake --workflow --preset default
```
or to do each step manually:
```sh
cmake -B build
cmake --build build
ctest --test-dir build -V
```
## Programs
The standalone examples are organized under [test/](./test/) directory, including:
* array: Array math in modern CMake and Fortran
* Git traceability
* namelist: Fortran 90 / 2003 Namelist parsing -- native text config files for Fortran
* io: modern Fortran File I/O including resolving absolute path
* real: Numerous examples dealing with practical features of real floating point numbers, including sentinel NaN and polymorphism.
* character: String handling is easy and performant in modern Fortran.
* standard: advanced features that can be done with Fortran standard coding
* submodule: Fortran 2008 and CMake ≥ 3.12 enable even better large program architecture with `submodule`
* system: system (hardware) functionality accessible via Fortran
## Companion libraries and examples
* [object-oriented Fortran HDF5 interface: h5fortran](https://github.com/geospace-code/h5fortran-mpi)
* [object-oriented Fortran NetCDF4 interface: nc4fortran](https://github.com/geospace-code/nc4fortran)
* [sparse-matrix examples in Fortran](https://github.com/scivision/sparse-fortran)
## Resources
### Fortran standards
* Fortran I 1956 [manual](https://www.fortran.com/FortranForTheIBM704.pdf)
* Fortran II 1958 [manual](http://archive.computerhistory.org/resources/text/Fortran/102653989.05.01.acc.pdf)
* Fortran 66 [standard](http://web.eah-jena.de/~kleine/history/languages/ansi-x3dot9-1966-Fortran66.pdf)
* Fortran 77 [language reference](http://physik.uibk.ac.at/hephy/praktikum/fortran_manual.pdf)
* Fortran [77](http://www.fortran.com/F77_std/f77_std.html)
* Fortran 90 / 95 [manual](http://www.chem.ucl.ac.uk/resources/history/people/vanmourik/images/Fortran%2095-manual.pdf)
* Fortran [2003](https://wg5-fortran.org/f2003.html)
* Fortran [2008](https://wg5-fortran.org/f2008.html)
* Fortran [2018](https://wg5-fortran.org/f2018.html)
### Books
* [Modern Fortran Explained: Incorporating Fortran 2018](https://global.oup.com/academic/product/modern-fortran-explained-9780198811886).
Metcalf, Reid, Cohen. 5th Ed, Nov 2018. ISBN: 978-0198811886.
* [Modern Fortran: Building Efficient Parallel Applications](https://www.manning.com/books/modern-fortran).
[Milan Curcic](https://twitter.com/realmilancurcic).
Feb. 2019. ISBN: 978-1617295287.
### Compiler User Guides
* [Cray Fortran](https://support.hpe.com/hpesc/public/docDisplay?docId=a00115296en_us)
* [Flang Wiki](https://github.com/flang-compiler/flang/wiki)
* [GNU Fortran docs](https://gcc.gnu.org/onlinedocs/)
* [IBM OpenXL](https://www.ibm.com/support/pages/ibm-open-xl-fortran-linux-power-and-xl-fortran-linux-documentation-library)
* [Intel Fortran](https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top.html)
* [NAG Fortran](https://www.nag.com/content/nag-fortran-compiler-documentation)
* [NVIDIA HPC SDK](https://docs.nvidia.com/hpc-sdk)
### Surveys
* [2018 modern Fortran user survey](http://www.fortran.bcs.org/2018/FortranBenefitsSurvey_interimrep_Aug2018.pdf)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Fortran 2018 是一种在科学计算领域具有广泛应用的编程语言的现代版本。它引入了许多新特性,增强了语言的表达能力和功能性。以下是一些 Fortran 2018 标准的关键特性和示例的简介: 1. 新特性支持:Fortran 2018 引入了诸如协程(Coroutines)、任务并行(Task Parallelism)、非阻塞IO、模块数据和增强的类型系统等新特性。 2. 面向对象编程:增强了面向对象编程的能力,包括类、继承和虚函数等概念,提供了相关的示例代码。 3. 并行处理:随着多核处理器的普及,Fortran 2018 提供了利用 OpenMP 进行高效并行计算的示例。 4. 编译器兼容性:示例代码经过了多种 Fortran 编译器(如 GNU Fortran, Intel Fortran 等)的测试,确保了良好的跨平台兼容性。 5. 编程范式:项目不仅包含传统的过程式编程,还涉及到函数式、面向对象和并发编程等多种编程范式,使得开发者可以根据具体需求选择适合的方法。
资源推荐
资源详情
资源评论
收起资源包目录
具有广泛应用的 Fortran 2018 标准示例 (127个子文件)
bell.aac 26KB
zero.asc 2B
FindFFMPEG.cmake 1KB
compilers.cmake 1KB
f03selectType.cmake 339B
f08kind.cmake 274B
f03abstract.cmake 253B
f18assumed_rank.cmake 222B
f03charalloc.cmake 203B
test_stdin.cmake 200B
f03ieee.cmake 170B
f08contig.cmake 164B
f2023rank_integer.cmake 125B
f08execute.cmake 123B
f18abstract.cmake 122B
f2023ternary.cmake 122B
f2023real16.cmake 120B
f03utf8.cmake 120B
f18prop.cmake 105B
f18random.cmake 104B
f2023tokenize.cmake 98B
.f2py_f2cmap 98B
assert.f90 4KB
huge_precision.F90 3KB
devnull.f90 3KB
auto_allocate.f90 2KB
rot90.f90 2KB
derived_type.f90 2KB
div_precision.F90 2KB
append_file.f90 2KB
nans.f90 2KB
finite.f90 2KB
string_utils.f90 2KB
minloc_maxloc_mask.f90 1KB
character_allocatable.f90 1KB
bit_pattern.f90 1KB
test_rot90.f90 1KB
floating_precision.F90 1KB
contiguous_assumed_shape.f90 1KB
coerce.F90 1KB
logging.f90 1KB
test_string.f90 1KB
nans_128.f90 1KB
devnull_simple.f90 1KB
color_text.f90 1002B
play_sound.f90 969B
null_pointer.f90 873B
assumed-rank.f90 865B
block.f90 837B
call_python_script.f90 796B
nan_max_min.f90 794B
epsilon.f90 772B
pause.f90 765B
character_array.f90 733B
minval_maxval_mask.f90 733B
polymorphic_module.f90 703B
file_or_console_output.f90 700B
short_circuit.f90 678B
random_init.f90 668B
explicit.f90 646B
procedure.f90 628B
print_vs_write.f90 618B
namelist.f90 606B
array_real.f90 601B
utf8.f90 586B
do_cycle.f90 553B
intent.f90 551B
recursive.f90 531B
special_characters.f90 523B
main.in.f90 512B
polymorphic.in.f90 510B
big_integer.f90 462B
contiguous_pointer.f90 430B
properties.f90 418B
os_detect.f90 416B
cast_int2real.f90 415B
precision_problems.f90 412B
leading_zeros.f90 381B
overwrite_stdout.f90 378B
unlink.f90 366B
badalloc.f90 361B
statement_function.f90 342B
terminal_io.f90 341B
charlen.f90 341B
str2int.f90 309B
f2018errorstop.f90 301B
terminal_size.f90 300B
abstract.f90 286B
badbounds.f90 219B
errorstop_variable.f90 195B
ascii.f90 184B
add_dummy.f90 164B
pragma.f90 136B
one_plus_one.f90 123B
two_plus_one.f90 123B
CMakePresets.json 2KB
LICENSE 1KB
README.md 5KB
README.md 1KB
README.md 1KB
共 127 条
- 1
- 2
资源评论
stormsha
- 粉丝: 7334
- 资源: 486
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功