R. Bartlett , J. Campbell , B. Collins , S. Johnson , A ...

3 downloads 0 Views 576KB Size Report
Complete assessment of tools for automating Fortran to C++ code ... C++ code. #include void sort(double* arr, int n). { std::sort(arr, arr + n);. }.
ForTrilinos †

?

?













Team: M. Heroux (PI), K. Evans (Co-PI), R. Bartlett , J. Campbell , B. Collins , S. Johnson , A. Prokopenko , G. Rockefeller , M. Young ?

Sandia National Laboratories



Oak Ridge National Laboratory



Los Alamos National Laboratory

Description and scope Project description Produce a sustainable, full-featured Fortran environment for Trilinos, including access to manycore/GPU, inversion of control for Fortran kernels, tools for future extensibility. ECP scope ECP provides sole funding for this project. Fortran applications will gain ready access to Trilinos capabilities on all platforms, and the ability to customize behaviors similar to C++ app users. ATDM provides matching funds for SNL efforts and collaboration funding for LANL users.

Trilinos overview What is Trilinos? The Trilinos Project is an effort to develop algorithms and enabling technologies within an object-oriented software framework for the solution of large-scale, complex multi-physics engineering and scientific problems. A unique design feature of Trilinos is its focus on packages. Unique features of Trilinos I Huge library of algorithms . Linear and nonlinear solvers, preconditioners . Optimization, transients, sensitivities, uncertainty I Growing support for multicore & hybrid CPU/GPU . Built into the new Tpetra linear algebra objects . Unified intra-node programming model

Maturity Level and Accessibility Maturity indicators and metrics I Numerous ad hoc API provide proof of concept I Annual release of ForTrilinos I Toolset that provides future extensibility, sustainability Accessibility I ForTrilinos repository on GitHub I 3-clause BSD license Current users I Several ad hoc APIs in use, e.g., CESM/ACME, MFIX, CASL

SWIG Input C++ code # include < algorithm > void sort ( double * arr , int n ) { std :: sort ( arr , arr + n ) ; }

Synergistic projects xSDK4ECP, SLATE, PEEKS, Li/Sparse solvers, ATDM, ACME Target applications I ACME (Accelerated Climate Model for Energy) I CAM (Community Atmosphere Model) I MPACT (neutron transport) First year plan I Complete review of existing ad hoc interfaces I Document design of the basic Interface based on the review I Complete assessment of tools for automating Fortran to C++ code documentation and testing, leveraging existing Trilinos infrastructure I Release basic interface with standard Trilinos release

% module algorithm %{ # include " algorithm . hh " %} % apply ( SWIGTYPE * ARRAY , int SIZE ) { ( double * arr , int n ) } % include " algorithm . hh "

Generated code

Collaborators Potential ties to other ECP projects Fortran applications with linear solver needs (especially manycore/GPU), C++/C/Fortran. (AD, U, R)

SWIG code

C++ wrapper code # include " algorithm . hh " extern " C " { SWIGEXPORT void swigc_sort ( double * farg1 , int * farg2 ) { double * arg1 = ( double *) 0 ; int arg2 ; arg1 = farg1 ; arg2 = * farg2 ; sort ( arg1 , arg2 ) ; } }

FORTRAN code module algorithm use , intrinsic :: ISO_C_BINDING implicit none ! PUBLIC METHODS AND TYPES public :: sort private interface ! WRAPPER DECLARATIONS subroutine swigc_sort ( farg1 , farg2 ) & bind (C , name = " swigc_sort " ) use , intrinsic :: ISO_C_BINDING real ( C_DOUBLE ) , dimension (*) , & intent ( inout ) :: farg1 integer ( C_INT ) , intent ( in ) :: farg2 end subroutine end interface contains ! FORTRAN PROXY CODE subroutine sort ( arr ) use , intrinsic :: ISO_C_BINDING real ( C_DOUBLE ) , dimension (:) , & intent ( inout ) :: arr call swigc_sort ( arr , size ( arr ) ) end subroutine end module algorithm