Search NASA⌕ Search

SEARCH · Search NASA

Results for “fortran”

Search indexed NASA NTRS and DOE OSTI research on propulsion, heat transfer, battery materials and energy systems. Follow report and document links to the original sources.

Quote a phrase for an exact phrase match. Source license links do not imply unrestricted reuse.

At least 37 records · Page 2

FLIT: A Generic Fortran Library based on Interfaces and Templates

This Fortran code consists of multiple modules with a focus on simplifying array operations, image processing, and numerical computation especially for computational geophysics applications. We intend to use this code to demonstrate the application and usefulness of Fortran interface and templates for generic programming, especially for computational geophysics and seismology applications. The code has several notable features. Firstly, it is based on a modularized structure, where each module contains multiple functions but with a focus of functionality. Secondly, it heavily uses interfaces and templates for improving the genericness and convenience of the resulting code, where a same function interface can enclose a group of functions that perform the same functionality but with inputs/output variables of different data types. Thirdly, it includes a variety of generic functions with an emphasis on array operations, such as rotation, flipping, cropping, padding, fast Fourier transform, Gaussian blurring, interpolation, and so on. We name this package FLIP – a generic Fortran Library based on Interfaces and Templates.

Gao, Kai↗

SWIG+Fortran User Manual

This report explains the detailed capabilities, usage, and implementation of the Fortran target language extension to the SWIG tool. The SWIG+Fortran extension is used to generate Fortran-2003 bindings to existing C and C++ library codes.

97 MATHEMATICS AND COMPUTING↗

Idiomatic Correctness-Checking via Julienne in Fortran 2023

This paper presents a unified approach to unit testing and runtime assertion checking using Fortran 2023. The paper describes the support for our approach in the Julienne framework. Julienne leverages recent Fortran standards to implement object-oriented design patterns, support testing parallel programs, and implement functional programming patterns in order to craft idioms inspired by natural-language expressions. The presented idioms employ novel operators to write expressions that evaluate to a test-diagnosis object encapsulating two components: (1) the test outcome or assertion outcome and (2) an automatically generated diagnostic string. Two other novel aspects of the approach include (1) the ability to enforce assertions inside pure procedures and (2) the ability to output rich diagnostic information inside pure procedures during error termination when assertions fail. The latter capability mitigates against a reason that Fortran programmers commonly cite for not writing pure procedures: difficulty obtaining useful program output inside pure procedures when debugging code. This paper demonstrates how the adoption of the proposed idioms leads naturally to a unifying theme across two otherwise disparate technologies: unit testing and runtime assertion checking. Finally, this paper describes the usage of the Julienne testing framework for writing unit tests and assertions in the Matcha high-performance computing application and the Fiats deep learning library.

Rouson, Damian↗

Lowering and Runtime Support for Fortran’s Multi-Image Parallel Features using LLVM Flang, PRIF, and Caffeine

This paper provides an overview of the multi-image parallel features in Fortran 2023 and their implementation in the LLVM flang compiler and the Caffeine parallel runtime library. The features of interest support a Single-Program, Multiple-Data (SPMD) programming model based on executing multiple “images”, each of which is a program instance. The features also support a Partitioned Global Address Space (PGAS) in the form of “coarray” distributed data structures. The paper discusses the lowering of multi-image features to the Parallel Runtime Interface for Fortran (PRIF) and the implementation of PRIF in the Caffeine parallel runtime library. This paper also provides an early view into the design of a new multi-image dialect of the LLVM Multi-Level Intermediate Representation (MLIR). We describe validation and testing of the resulting software stack, and demonstrate that performance compares favorably to another open-source compiler and runtime library: GNU Compiler Collection (GCC) gfortran and OpenCoarrays, respectively.

Bonachea, Dan↗

An evaluation of risks associated with relying on Fortran for mission critical codes for the next 15 years

This document examines risks associated with relying on Fortran for codes critical to nuclear security into the late 2030s. The study was requested by the LANL ASC program office to support its decisions. To date, much of the discussion about the prospects for Fortran has tended to be informal and centered on questions (such as, “will the language be around in 20 years”) that are impossible to answer with any certainty. By focusing on estimates of the likelihood associated with different outcomes, rather than on specific predictions, we hope to clarify points of disagreement within the community and strengthen the analytic basis for reasoning about the future.

97 MATHEMATICS AND COMPUTING↗

Comparing the Performance of Julia on CPUs versus GPUs and Julia-MPI versus Fortran-MPI: a case study with MPAS-Ocean (Version 7.1)

Abstract. Some programming languages are easy to develop at the cost of slow execution, while others are fast at runtime but much more difficult to write. Julia is a programming language that aims to be the best of both worlds – a development and production language at the same time. To test Julia's utility in scientific high-performance computing (HPC), we built an unstructured-mesh shallow water model in Julia and compared it against an established Fortran-MPI ocean model, the Model for Prediction Across Scales–Ocean (MPAS-Ocean), as well as a Python shallow water code. Three versions of the Julia shallow water code were created: for single-core CPU, graphics processing unit (GPU), and Message Passing Interface (MPI) CPU clusters. Comparing identical simulations revealed that our first version of the Julia model was 13 times faster than Python using NumPy, where both used an unthreaded single-core CPU. Further Julia optimizations, including static typing and removing implicit memory allocations, provided an additional 10–20× speed-up of the single-core CPU Julia model. The GPU-accelerated Julia code was almost identical in terms of performance to the MPI parallelized code on 64 processes, an unexpected result for such different architectures. Parallelized Julia-MPI performance was identical to Fortran-MPI MPAS-Ocean for low processor counts and ranges from 2× faster to 2× slower for higher processor counts. Our experience is that Julia development is fast and convenient for prototyping but that Julia requires further investment and expertise to be competitive with compiled codes. We provide advice on Julia code optimization for HPC systems.

54 ENVIRONMENTAL SCIENCES↗

A Fortran–Python interface for integrating machine learning parameterization into earth system models

Abstract. Parameterizations in earth system models (ESMs) are subject to biases and uncertainties arising from subjective empirical assumptions and incomplete understanding of the underlying physical processes. Recently, the growing representational capability of machine learning (ML) in solving complex problems has spawned immense interests in climate science applications. Specifically, ML-based parameterizations have been developed to represent convection, radiation, and microphysics processes in ESMs by learning from observations or high-resolution simulations, which have the potential to improve the accuracies and alleviate the uncertainties. Previous works have developed some surrogate models for these processes using ML. These surrogate models need to be coupled with the dynamical core of ESMs to investigate the effectiveness and their performance in a coupled system. In this study, we present a novel Fortran–Python interface designed to seamlessly integrate ML parameterizations into ESMs. This interface showcases high versatility by supporting popular ML frameworks like PyTorch, TensorFlow, and scikit-learn. We demonstrate the interface's modularity and reusability through two cases: an ML trigger function for convection parameterization and an ML wildfire model. We conduct a comprehensive evaluation of memory usage and computational overhead resulting from the integration of Python codes into the Fortran ESMs. By leveraging this flexible interface, ML parameterizations can be effectively developed, tested, and integrated into ESMs.

54 ENVIRONMENTAL SCIENCES↗

A Fortran-Python Interface for Integrating Machine Learning Parameterization into Earth System Models

Parameterizations in Earth System Models (ESMs) are subject to biases and uncertainties arising from subjective empirical assumptions and incomplete understanding of the underlying physical processes. Recently, the growing representational capability of machine learning (ML) in solving complex problems has spawned immense interests in climate science applications. Specifically, ML-based parameterizations have been developed to represent convection, radiation and microphysics processes in ESMs by learning from observations or high-resolution simulations, which have the potential to improve the accuracies and alleviate the uncertainties. Previous works have developed some surrogate models for these processes using ML. These surrogate models need to be coupled with the dynamical core of ESMs to investigate the effectiveness and their performance in a coupled system. In this study, we present a novel Fortran-Python interface designed to seamlessly integrate ML parameterizations into ESMs. This interface showcases high versatility by supporting popular ML frameworks like PyTorch, TensorFlow, and Scikit-learn. We demonstrate the interface's modularity and reusability through two cases: a ML trigger function for convection parameterization and a ML wildfire model. We conduct a comprehensive evaluation of memory usage and computational overhead resulting from the integration of Python codes into the Fortran ESMs. By leveraging this flexible interface, ML parameterizations can be effectively developed, tested, and integrated into ESMs.

54 ENVIRONMENTAL SCIENCES↗

StrmtbFlow Fortran Program, Version 2

<span>This zip file contains files storing Fortran source code, compiled files, an executable file for Windows computers, and example input and output files for StmtbFlow. StrmtbFlow is a Fortran program that solves the multiphase flow equations within stream tubes and can be used to estimate the oil produced and CO2 stored from the application of CO2 EOR to an oil field. StrmtbFlow and StrmtbGen comprise the FE/NETL CO2 Prophet Model, which is a streamline/stream tube reservoir simulator for modeling CO2 EOR. StrmtbFlow's user&rsquo;s manual as well as StrmtbGen and its user's manual and a report on the mathematical basis for the FE/NETL CO2 Prophet Model are available on NETL's website under the Collection Name: FE/NETL CO2 Prophet Model.</span><span>&nbsp;</span>

Morgan, David↗

StrmtbGen Fortran Program, Version 2

This zip file contains files storing Fortran source code, compiled files, an executable file for Windows computers, and example input and output files for StrmtbGen. StrmtbGen is a Fortran program that generates streamlines and stream tubes. StrmtbGen and StrmtbFlow comprise the FE/NETL CO2 Prophet Model, which is a streamline/stream tube reservoir simulator for modeling CO2 EOR. StrmtbGen's user’s manual as well as StrmtbFlow and its user's manual and a report on the mathematical basis for the FE/NETL CO2 Prophet Model are available on NETL's website under the Collection Name: FE/NETL CO2 Prophet Model.

Morgan, David↗

FITEVT: A FORTRAN program for arrival-time analysis of nuclear-decay events

FITEVT is a FORTRAN program designed to analyze recorded arrival times of nuclear-decay events affected by dead-time. Here, the primary goal of the program is precise and accurate determination of half-lives. Its method involves imposition of a known sufficiently long extending dead-time to the recorded event sequence, so that the original dead-time effects are completely obliterated and the remaining live-times of the survived events are known exactly. Upon completion of the analysis, the arrival-time spectrum and the live-time spectrum are predicted and compared to those constructed from the survived events.

73 NUCLEAR PHYSICS AND RADIATION PHYSICS↗

Optimization and Portability of a Fusion OpenACC-based FORTRAN HPC Code from NVIDIA to AMD GPUs

NVIDIA has been the main provider of GPU hardware in HPC systems for over a decade. Most applications that benefit from GPUs have thus been developed and optimized for the NVIDIA software stack. Recent exascale HPC systems are, however, introducing GPUs from other vendors, e.g. with the AMD GPU-based OLCF Frontier system just becoming available. AMD GPUs cannot be directly accessed using the NVIDIA software stack, and require a porting effort by the application developers. This paper provides an overview of our experience porting and optimizing the CGYRO code, a widely-used fusion simulation tool based on FORTRAN with OpenACC-based GPU acceleration. While the porting from the NVIDIA compilers was relatively straightforward using the CRAY compilers on the AMD systems, the performance optimization required more fine-tuning. In the optimization effort, we uncovered code sections that had performed well on NVIDIA GPUs, but were unexpectedly slow on AMD GPUs. After AMD-targeted code optimizations, performance on AMD GPUs has increased to meet our expectations. Modest speed improvements were also seen on NVIDIA GPUs, which was an unexpected benefit of this exercise.

Sfiligoi, Igor↗

Fortran Compiler Test Suite v0.1.0

There is no currently available, open-source, easily adapted test suite for checking a compiler's conformance to the Fortran Standard. The main innovation of this software is in the framework to make the test suite apply to a new compiler. Making it open-source will enable community contributions of the test cases. Single organization construction of a comprehensive test suite is something that would be financially infeasible.

Richardson, Bradley↗

H2OI95: A Stand-Alone Fortran Code for Evaluating the IAPWS-95 Equation-of-State Model for Water (Rev. 1)

H2OI95 is a stand-alone Fortran code for evaluating the IAPWS-95 equation-of-state model for the thermodynamic properties of water. It also evaluates the corresponding thermochemical properties of water consistent with the CODATA recommendations. The IAPWS-95 model is based on a model equation for the dimensionless Helmholtz energy for which the primary variables are the inverse reduced temperature (τ = T cr /T ) and reduced density (δ = ρ/ρ cr ). Here T is the absolute temperature (K), ρ is density (kg/m³), and the subscript “ cr ” refers to the critical point of water (647.096 K and 22.064 MPa pressure in this model, for which ρ cr is 322 kg/m³). The code solves four basic types of problems, distinguished by the specified inputs: 1. Temperature (K) and density (ρ kg/m³) or reduced density (δ) 2. Temperature (K) and pressure (MPa). 3. Temperature (K) on the saturation (liquid-vapor equilibrium) curve 4. Pressure (MPa) on the saturation curve. Each type of problem is run using a corresponding input (text) file. All but the first type of problem require iteration. For example, to solve for desired temperature and pressure, the reduced density must be adjusted to give the desired pressure. Iteration is accomplished using the Newton-Raphson method, though the secant method is also used in solving the fourth type of problem. For the last three types of problems, H2OI95 has been used to conduct numerical studies of convergence and the problem of multiple numerical solutions, some of which are not physically valid. Obtaining valid results depends mainly on appropriate choice of starting values for the density. The default values used in H2OI95 appear to consistently lead to generally desired results. With modification (not addressed here), H2OI95 can be used to support SUPCRT92 and similar codes that compute chemical thermodynamic properties of species and reactions over a wide range of temperature and pressure (273.16-1273K and 0-1000 MPa). Version 1.1 of this software calculates an extended set of water properties, including some derivable solely from IAPWS-95, such as the isobaric thermal expansivity and the isothermal compressibility, and still other properties based on supplementary models sanctioned by IAPWS, including the dynamic viscosity, thermal conductivity, surface tension, and static dielectric constant, and various other properties (notably Debye-Hückel parameters) derivable from the dielectric constant and its partial derivatives with respect to temperature and pressure. A coding error in Version 1.0 was identified while testing the implementation of the viscosity model. This error is described in Appendix C. It mainly affects calculation of “higher order” properties such as compressibility and heat capacity near the critical point.

37 INORGANIC, ORGANIC, PHYSICAL, AND ANALYTICAL CH↗

Automatically parallelizing batch inference on deep neural networks using Fiats and Fortran 2023 `do concurrent`

This paper introduces novel programming strategies that leverage features of the Fortran 2023 standard of the International Standards Organization (ISO) to automatically parallelize computations on deep neural networks. The paper focuses on the interplay of object-oriented, parallel, and functional programming paradigms in the Fiats deep learning library. We demonstrate how several infrequently used language features play a role in enabling efficient, parallel execution. Specifically, the ability to explicitly declare that a procedure is pure facilitates inference in the context of the language’s loop-parallelism construct `do concurrent`. Also, explicitly prohibiting the overriding of a parent type’s type-bound procedures eliminates the need for dynamic dispatch in performance-critical code. Finally, this paper uses batch inference calculations on a neural network surrogate for atmospheric aerosol dynamics to demonstrate that LLVM Flang compiler’s automatic parallelization of `do concurrent` achieves roughly the same performance and scalability as achieved by OpenMP compiler directives. We also demonstrate that double-precision inference costs 37–72% longer runtime than default-real precision with most values in the range 57-60%.

Rouson, Damian↗