Babel F2003 Struct Support Update and FACETS integration Funded by DOE (TASCS) Grant No DE-FC02-07ER25805, DOE Grant No DE-FG02-04ER84099 and Tech-X Stefan Muszala John Cary, Tom Epperly, Ammar Hakim, Scott Kruger, Gary Kumfert, Alexander Pletzer, Rooparani Pundaleeka, Srinath Vadlamani, Nanbor Wang January 17, 2008
13
Embed
Babel F2003 Struct Support Update and FACETS integration Funded by DOE (TASCS) Grant No DE-FC02-07ER25805, DOE Grant No DE-FG02-04ER84099 and Tech-X Stefan.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Babel F2003 Struct Support Update and FACETS
integration
Funded by DOE (TASCS) Grant No
DE-FC02-07ER25805, DOE Grant No DE-FG02-04ER84099
and Tech-X
Stefan MuszalaJohn Cary, Tom Epperly, Ammar
Hakim, Scott Kruger, Gary Kumfert, Alexander Pletzer,
Rooparani Pundaleeka, Srinath Vadlamani, Nanbor Wang
January 17, 2008
Distcomp: One of the goals of the Distcomp work is to implement Fortran 2003 bindings in Babel for struct support. This work is aligned with the work of the Common Component Architecture (TASCS).
What are the Tech-X scopes of theDistcomp and TASCS projects?
TASCS: Part of the TASCS work is a collaboration with the FACETS*project in which we are integrating a C++ framework withFortran modules (eventually Python, C). We are using the newly developed Fortran 2003 bindings in Babel to achieve our goal.
* FACETS-(Framework Application for Core-Edge Transport Simulations) is a SCIDAC project led by Tech-X which aims to integrate core, edge and wall fusion simulations.
mmm95 glf23
Interfacesf1,f2,...,fM
FMCFM
tglf
C++Methods
BABEL
Interfacesw1,w2,...,wN
WallPSI
C++Methods
Fortran
BABEL
Fortran
C++Class Interfaces
FACETS+Babel integration only requirescomponents at end of call chain
What work has been Completed?
•Distcomp:•F2003 Implementation of Primitive Types in Babel.•F2003 Implementation of Array Types in Babel.•F2003 Implementation of R-array Types in Babel.
•TASCS work related to Fusion Projects:•Have SIDL versions of FACETS Fortran Derived Types. Runs in a test FACETS Framework using R-arrays.•Have SIDL prototype of FACETS interface which passes Babel struct from C++ to Fortran transport module•Added timing infrastructure to test codes in order to compare with original (non-Babel) test code.
What still needs to be completed?
•Distcomp:• Regression tests for F2003 structs.
•Includes all Fortran->”other language” combinations.• Add examples - have some of these in Tech-X repo.•Enumeration Types• Documentation.• Check pointer _init - (OK?) for non-static rarrays.• Check pointer _destroy - (OK?) for non-static rarrays.• Make sure copy works - (OK?) For non-static rarrays.• _serialize/_deserialize for RMI calls.• Provide access to every struct member.
•TASCS work related to Fusion Projects:•Complete transport module interfaces. •Continue working on SIDL interfaces for other modules.
package addRand version 1.0{ struct fStruct{ double bX; int bY; };…}
module addRand_fStrucuse,intrinsic :: iso_c_binding type,bind(c) :: addRand_fStruct_t real(c_double) :: bX integer(c_int32_t) :: bY end type addRand_fStruct_tend module addRand_fStruct
How we use BindC to provide Babel Primitive type capability in Babel
Structs.
How we use BindC to provide Babel Array type capability in Babel
Structs.package addRand version 1.0{ struct fStruct{ double bX; int iY; array<double,1,column-major> testArr; }; class modStruct{ void doWork(in int n, inout fStruct
structTest); }}
addRand::fStruct fTest;
… for (size_t i = 0 ; i < N ; i++) { sidl_double__array_set1(fTest.testArr,i,double(i)); }…addRand::modStruct bS = addRand::modStruct:: _create();
bS.doWork(10,fTest);
… type(addRand_fStruct_t) :: structTest! inout…
do i=0,structTest%iY call get(structTest%testArr, i, temp) call set(structTest%testArr,i,temp*5.0) enddo
module addRand_fStruct use,intrinsic :: iso_c_binding use sidl_double_array type,bind(c) :: addRand_fStruct_t real(c_double) :: bX integer(c_int32_t) :: iY type(sidl_double_1d) :: testArr end type addRand_fStruct_tend module addRand_fStruct
What is the best way to pass the converted F pointer
to deeply nested procedure calls?
struct Flags {… double glfCbetae; /*FD set cbetae=1 for fully electromagnetic */ double glfCnu; /*FD factor for the collisionality */ rarray<int,1> glfIflagin(5); /*FD Transport flags internal to the GLF module */ rarray<double,1> glfXparam(30); /*FD Normalizers and calibration coefficients */
/* internal to the module */ int mmmNroot; /*FD number of moments */ int mmmNpoints; /*FD should be always 1 */… };
REAL(kind=r8) :: glfCbetae !*FD set cbetae=1 for fully electromagnetic REAL(kind=r8) :: glfCnu !*FD factor for the collisionality INTEGER, DIMENSION(5) :: glfIflagin !*FD Transport flags internal to the GLF module REAL(kind=r8), DIMENSION(30) :: glfXparam !*FD Normalizers and calibration c
!* coefficients internal to the module INTEGER :: mmmNroot !*FD number of moments INTEGER :: mmmNpoints !*FD should be always 1
How do we convert the transport module Flags type to SIDL?
How do we provide the transport modules interface
using Babel?
fmcfmWrap::fmcfm FM = fmcfmWrap::fmcfm::_create(); retVal=t_start("TmInitFlags");FM.siInitFlags(flags,funit_input);retVal=t_stop("TmInitFlags");