A Fortran-Keras Deep Learning Bridge for Scientific Computing

Implementing artificial neural networks is commonly achieved via high-level programming languages like Python and easy-to-use deep learning libraries like Keras. These software libraries come pre-loaded with a variety of network architectures, provide autodifferentiation, and support GPUs for fast and efficient computation. As a result, a deep learning practitioner will favor training a neural network model in Python, where these tools are readily available. However, many large-scale scientific computation projects are written in Fortran, making it difficult to integrate with modern deep learning methods. To alleviate this problem, we introduce a software library, the Fortran-Keras Bridge (FKB). This two-way bridge connects environments where deep learning resources are plentiful, with those where they are scarce. The paper describes several unique features offered by FKB, such as customizable layers, loss functions, and network ensembles. The paper concludes with a case study that applies FKB to address open questions about the robustness of an experimental approach to global climate simulation, in which subgrid physics are outsourced to deep neural network emulators. In this context, FKB enables a hyperparameter search of one hundred plus candidate models of subgrid cloud and radiation physics, initially implemented in Keras, to be transferred and used in Fortran. Such a process allows the model's emergent behavior to be assessed, i.e. when fit imperfections are coupled to explicit planetary-scale fluid dynamics. The results reveal a previously unrecognized strong relationship between offline validation error and online performance, in which the choice of optimizer proves unexpectedly critical. This reveals many neural network architectures that produce considerable improvements in stability including some with reduced error, for an especially challenging training dataset.

[1]  J. Templeton,et al.  Reynolds averaged turbulence modelling using deep neural networks with embedded invariance , 2016, Journal of Fluid Mechanics.

[2]  David J. Lary,et al.  Using neural networks to describe tracer correlations , 2003 .

[3]  Pierre Baldi,et al.  Enforcing Analytic Constraints in Neural Networks Emulating Physical Systems. , 2019, Physical review letters.

[4]  Pierre Gentine,et al.  Deep learning to represent subgrid processes in climate models , 2018, Proceedings of the National Academy of Sciences.

[5]  Ken Perlin,et al.  Real-Time Continuous Pose Recovery of Human Hands Using Convolutional Networks , 2014, ACM Trans. Graph..

[6]  A. Ferrari,et al.  FLUKA: A Multi-Particle Transport Code , 2005 .

[7]  Stephan Rasp Coupled online learning as a way to tackle instabilities and biases in neural network parameterizations , 2019 .

[8]  David D. Cox,et al.  Hyperopt: A Python Library for Optimizing the Hyperparameters of Machine Learning Algorithms , 2013, SciPy.

[9]  Hannah M. Christensen,et al.  Machine Learning for Stochastic Parameterization: Generative Adversarial Networks in the Lorenz '96 Model , 2019, Journal of Advances in Modeling Earth Systems.

[10]  Nitish Srivastava,et al.  Dropout: a simple way to prevent neural networks from overfitting , 2014, J. Mach. Learn. Res..

[11]  Katherine Thayer-Calder,et al.  The Role of Convective Moistening in the Madden–Julian Oscillation , 2009 .

[12]  Erik Linstead,et al.  Learning Lexical Features of Programming Languages from Imagery Using Convolutional Neural Networks , 2018, 2018 IEEE/ACM 26th International Conference on Program Comprehension (ICPC).

[13]  M. Karplus,et al.  CHARMM: A program for macromolecular energy, minimization, and dynamics calculations , 1983 .

[14]  Sergey Ioffe,et al.  Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift , 2015, ICML.

[15]  Noah D. Brenowitz,et al.  Prognostic Validation of a Neural Network Unified Physics Parameterization , 2018, Geophysical Research Letters.

[16]  Milan Curcic,et al.  A parallel Fortran framework for neural networks and deep learning , 2019, FORF.

[17]  Jose Torres-Jimenez,et al.  SAGRAD: A Program for Neural Network Training with Simulated Annealing and the Conjugate Gradient Method , 2015, Journal of research of the National Institute of Standards and Technology.

[18]  A.J. Wallcraft,et al.  Global Ocean Prediction Using HYCOM , 2006, 2007 DoD High Performance Computing Modernization Program Users Group Conference.

[19]  Erik Linstead,et al.  Exploring the applicability of low-shot learning in mining software repositories , 2019, Journal of Big Data.

[20]  G. A. Mercado,et al.  Artificial neural networks in neutron dosimetry. , 2006, Radiation protection dosimetry.

[21]  Luca Antiga,et al.  Automatic differentiation in PyTorch , 2017 .

[22]  Stephan Hoyer,et al.  Learning data-driven discretizations for partial differential equations , 2018, Proceedings of the National Academy of Sciences.

[23]  Paris Perdikaris,et al.  Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations , 2019, J. Comput. Phys..

[24]  David A. Randall,et al.  Evaluation of the Simulated Interannual and Subseasonal Variability in an AMIP-Style Simulation Using the CSU Multiscale Modeling Framework , 2008 .

[25]  Michael J. Garay,et al.  Multi-Modal Object Tracking and Image Fusion With Unsupervised Deep Learning , 2019, IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing.

[26]  Yvonne D Murray,et al.  Users Manual for LS-DYNA Concrete Material Model 159 , 2007 .

[27]  Erik Linstead,et al.  A Deep Learning Approach to Identifying Source Code in Images and Video , 2018, 2018 IEEE/ACM 15th International Conference on Mining Software Repositories (MSR).

[28]  Erdogan Madenci,et al.  The Finite Element Method and Applications in Engineering Using ANSYS , 2007 .

[29]  Philip W. Jones,et al.  The DOE E3SM Coupled Model Version 1: Overview and Evaluation at Standard Resolution , 2019, Journal of Advances in Modeling Earth Systems.

[30]  Jing Xu,et al.  A Deep Learning Algorithm of Neural Network for the Parameterization of Typhoon‐Ocean Feedback in Typhoon Forecast Models , 2018 .

[31]  Pierre Baldi,et al.  The dropout learning algorithm , 2014, Artif. Intell..

[32]  Xiao Xiang Zhu,et al.  Deep Learning in Remote Sensing: A Comprehensive Review and List of Resources , 2017, IEEE Geoscience and Remote Sensing Magazine.

[33]  Nancy Wilkins-Diehr,et al.  XSEDE: Accelerating Scientific Discovery , 2014, Computing in Science & Engineering.

[34]  Shian-Jiann Lin,et al.  Structure and Performance of GFDL's CM4.0 Climate Model , 2019, Journal of Advances in Modeling Earth Systems.

[35]  C. Bretherton,et al.  Restricting 32–128 km horizontal scales hardly affects the MJO in the Superparameterized Community Atmosphere Model v.3.0 but the number of cloud‐resolving grid columns constrains vertical mixing , 2014 .

[36]  W. Collins,et al.  The Community Earth System Model: A Framework for Collaborative Research , 2013 .

[37]  Jürgen Schmidhuber,et al.  Deep learning in neural networks: An overview , 2014, Neural Networks.

[38]  Milan Curcic,et al.  Modeling waves and wind stress , 2012 .

[39]  Michael Metcalf,et al.  Fortran , 2002, Encyclopedia of Information Systems.

[40]  Pierre Baldi,et al.  Solving the Rubik’s cube with deep reinforcement learning and search , 2019, Nature Machine Intelligence.

[41]  Jordan G. Powers,et al.  The Weather Research and Forecasting Model: Overview, System Efforts, and Future Directions , 2017 .

[42]  Javier Bernal,et al.  NEURBT: A Program for Computing Neural Networks for Classification using Batch Learning , 2015 .

[43]  Jasper Snoek,et al.  Practical Bayesian Optimization of Machine Learning Algorithms , 2012, NIPS.

[44]  Steven L. Brunton,et al.  Data-driven discovery of partial differential equations , 2016, Science Advances.

[45]  F. Archambeau,et al.  Code Saturne: A Finite Volume Code for the computation of turbulent incompressible flows - Industrial Applications , 2004 .

[46]  Yuan Yu,et al.  TensorFlow: A system for large-scale machine learning , 2016, OSDI.

[47]  W. Grabowski Coupling Cloud Processes with the Large-Scale Dynamics Using the Cloud-Resolving Convection Parameterization (CRCP) , 2001 .

[48]  Demis Hassabis,et al.  Mastering the game of Go with deep neural networks and tree search , 2016, Nature.

[49]  G. Madec NEMO ocean engine , 2008 .

[50]  SchmidhuberJürgen Deep learning in neural networks , 2015 .

[51]  А. В. Гондлях Адаптация итерационно аналитического многослойного конечного элемента в системуabaqus , 2012 .

[52]  Tjerk P. Straatsma,et al.  NWChem: A comprehensive and scalable open-source solution for large scale molecular simulations , 2010, Comput. Phys. Commun..

[53]  Pierre Gentine,et al.  Could Machine Learning Break the Convection Parameterization Deadlock? , 2018, Geophysical Research Letters.

[54]  François Chollet,et al.  Deep Learning mit Python und Keras , 2018 .

[55]  Noah D. Brenowitz,et al.  Interpreting and Stabilizing Machine-Learning Parametrizations of Convection , 2020, Journal of the Atmospheric Sciences.

[56]  D. Randall,et al.  Simulations of the Atmospheric General Circulation Using a Cloud-Resolving Model as a Superparameterization of Physical Processes , 2005 .

[57]  Geoffrey E. Hinton,et al.  ImageNet classification with deep convolutional neural networks , 2012, Commun. ACM.

[58]  Lars Hertel,et al.  Sherpa: Robust Hyperparameter Optimization for Machine Learning , 2020, SoftwareX.