LLNL-PRES-697177 This work was performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under contract DE-AC52-07NA27344. Lawrence Livermore National Security, LLC
ConduitAScien-ficDataExchangeLibraryforHPCSimula-onsh?p://soCware.llnl.gov/conduitSciPy2016–The2016Scien0ficCompu0ngwithPythonConference
CyrusHarrison,BrianRyujin,AdamKunenWednesday July 13, 2016 Austin, Texas
LLNL-PRES-697177 2
OurConduitprojectisnotfocusedondevelopingavirus(ormalware,adware,etc).
https://software.llnl.gov/conduit
Introduction
LLNL-PRES-697177 3
ProjectInfo:§ Languages:C++,Python,C,Fortran
§ Docs:hEps://soGware.llnl.gov/conduit
§ GithubRepo:hEps://github.com/llnl/conduit
§ License:BSDStyle
§ Timeline:— 2011–2013:Neuronsstartfiringanddevelopingconcepts— November2013:CodedevelopmentstartsataLLNLHackathon— Fall2014–Spring2015:HarveyMuddClinicProject— January2015:ReleasedOpenSource— 2015–Present:Earlyuseinapplica0onsatLLNL
Conduitisanopensourceprojectfocusedonsimplifyingin-coredataexchangeintheHPCsimula-onecosystem.
Introduction
LLNL-PRES-697177 4
Conduitissmallcollabora-vedevelopmenteffortwithinLLNL’sWeaponsSimula-onandCompu-ng(WSC)program.
Cyrus Harrison [email protected]
Brian Ryujin [email protected]
Adam Kunen [email protected]
CoreTeam:
Manyotherpeoplehavecontributedideasandcode!
Introduction
LLNL-PRES-697177 5
Conduitdevelopmentwasboostedbya2014-2015HarveyMuddClinicProjectexploringitsuseinHPCproxyapplica-ons.
TheHarveyMuddClinicprogramhelpedusrefineConduitforimportantusecases
Introduction
LLNL-PRES-697177 6
Whatmo-vatedConduit?
LLNL-PRES-697177 7
SnapshotofScaleandComplexityofLLNL’sWSCCPProgram:§ DevelopmentEfforts
— ~120Developers(Physicists,Engineers,ComputerScien0sts,SoGwareQuality,etc…)— ~15projectteams— ~15–30+yearapplica0onlife0mes— ~12millionlinesofproduc0oncodeacrossprojects(w/morethan100third-partydependencies)
§ DiversityofProgrammingLanguages— C++/C,Fortran,Python,Lua
§ DiversityofData— Scalars,Arrays,Strings— Tables,Contours— CADGeometry,Computa0onalMeshes
LLNL’sWSCComputa-onalPhysics(CP)programdevelopsproduc-onHPCmul--physicssimula-onapplica-ons.
CP’seffortsareamicrocosmofthebroaderHPCsimula0oncommunity.
Motivation
LLNL-PRES-697177 8
ThesoCwareecosystemsuppor-ngHPCmul--physicssimula-onsisverycomplex.
Visualization and Analysis • Mesh Rendering • Feature Extraction • Simulated Diagnostics
Problem Setup • Computational Geometry • Mesh Generation • Mesh Decomposition
Uncertainty Quantification • Ensemble Generation • Parametric Studies • Statistical Models
Workflow Applications
Multi-physics Simulation Applications
CS Infrastructure • Input Parsing • Steering • Communication • Parallelism Abstractions • I/O • In Situ Coupling
Physics Libraries • Material Properties • Material Models
Numerical Libraries • Linear Algebra • Finite Elements
Physics Packages • Hydrodynamics • Chemistry • Thermal radiation • {and many more …}
Motivation
LLNL-PRES-697177 9
Visualization and Analysis Problem Setup Uncertainty Quantification
Workflow Applications
Multi-physics Simulation Applications
CS Infrastructure
Physics Libraries
Numerical Libraries
Physics Packages
AmixofC++,Python,FortranandLuaareusedtodevelopapplica-ons.
C++ Python
C++ Fortran
C++ Fortran
C++ Lua
Python Fortran
C++ Python
Fortran C++ Python
Lua
Python
Motivation
LLNL-PRES-697177 10
Visualization and Analysis Problem Setup Uncertainty Quantification
Workflow Applications
Multi-physics Simulation Applications
Amixofcustominputlanguages,GUIs,PythonandLuaareusedtorunandscriptapplica-ons.
Python Python GUIs
Custom Input Language
Python
Lua
Python GUIs
Motivation
LLNL-PRES-697177 11
In-coredataexchangehasreceivedlessfocusthanfile-baseddataexchange:
§ File-basedI/Olibrarieshaveevolvedintodefactointerfacesbetweencomponents.
§ File-basedI/Oisacceptableasacoarse-grainandlow-frequencydatacouplingsolu0on.
Datacouplingisakeyaspectinsimula-onsoCwaredesignanduserworkflows.
Toachievefine-graineddatacouplingweneedtoolstohelpwithin-coredataexchange.
Motivation
LLNL-PRES-697177 12
KeyRequirements:
§ Provideadescrip0onmechanismfornumericprimi0ves— Scalars,stridedarrays,etcwithexplicitprecision
§ Supportmixedmemoryownershipseman0cs— Enablezero-copywherefeasible— Playfriendlywithexis0ngdatastructuresinmul0plelanguages
§ Enablehigherlevelconven0ons— Hierarchicalcontext(“paths”aregreatinterface…)— Humanreadabledescrip0ons
Suppor-ngin-coredataexchangethroughoutthesimula-oneco-systemisquitedifferentfromtrivialsinglecomponentusecases.
Motivation
LLNL-PRES-697177 13
WhatisConduit?
LLNL-PRES-697177 14
Conduit’smul--languagedatamodelprovides:
§ Aflexiblewaytodescribecomplexdata— AJSON-basedschemafordescribingthelayoutofhierarchicalin-coredata.
§ AsaneAPItoaccesscomplexdata— DynamicAPIsforrapidconstruc0onandconsump0onofhierarchicalobjects.
Conduitprovidesasetoftoolsfocusedonin-coredatadescrip-ontoaidwithdatacouplingacrosstheHPCecosystem.
Conduitprovidesamul0-languagedatamodel,notamul0-languagewrappingsolu0on.
About Conduit
LLNL-PRES-697177 15
ANodeactsasoneoffollowingbasicroles:§ Object:Anorderedassocia0vearraymappingnamestochildren
§ List:Anorderedlistofunnamedchildren
§ Leaf:Scalaror1DArrayofabitwidth-specifiedprimi0ve:— SignedIntegers:int8,int16,int32,int64— UnsignedIntegers:uint8,uint16,uint32,uint64— Floa1ngPointNumbers:float32,float64— Strings:char8_str
§ Empty:Nodata
TheheartofConduitisahierarchicalvarianttypenamedNode.
About Conduit
ExperiencewithNumPyandJSONmo0vatedConduit’sdatamodel.
LLNL-PRES-697177 16
ConduitPythonAPIExample:CreateatreeofNumPydataarrays
import syssys.path.append(".")#-----------
import numpy as npfrom conduit import Node
# create a "Node", the primary actor in conduitn = Node()
# create example numpy datax_coords = np.array(range(3),dtype='float64')y_coords = np.array(range(3),dtype='float64')den = np.ones(4,dtype='float64')
#-----------
# create dynamic a tree hierarchy with a Node by # copying our numpy data into named pathsn["coords/x"] = x_coordsn["coords/y"] = y_coordsn["fields/density/values"] = den# show the treeprint(n)
LLNL-PRES-697177 17
ConduitPythonAPIExample:CreateatreeofNumPydataarrays
import syssys.path.append(".")#-----------
import numpy as npfrom conduit import Node
# create a "Node", the primary actor in conduitn = Node()
# create example numpy datax_coords = np.array(range(3),dtype='float64')y_coords = np.array(range(3),dtype='float64')den = np.ones(4,dtype='float64')
#-----------
# create dynamic a tree hierarchy with a Node by # copying our numpy data into named pathsn["coords/x"] = x_coordsn["coords/y"] = y_coordsn["fields/density/values"] = den# show the treeprint(n)
{ "coords": { "x": [0.0, 1.0, 2.0], "y": [0.0, 1.0, 2.0] }, "fields": { "density": { "values": [1.0, 1.0, 1.0, 1.0] } }}
{ "u": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], "v": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]}
{ "u": [3.14159, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], "v": [2.71828, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]}
LLNL-PRES-697177 18
ConduitPythonAPIExample:MixingexternallyallocatedandConduitowneddata
#-----------
# you can mix external and conduit owned data within a# Node hierarchyvel_u = np.ones(9,dtype='float64')vel_v = np.ones(9,dtype='float64')# use set_external() to inits the "u" and "v" nodes of # the tree to point to the same memory location as their# source numpy arraysn["fields/velocity/values/u"].set_external(vel_u)n["fields/velocity/values/v"].set_external(vel_v)
#-----------
# show the elements of the "u" arrayprint(n["fields/velocity/values"])
# change the first element of the u array (via src)vel_u[0] = 3.14159;# change the first element of the v array (via conduit)n["fields/velocity/values/v"][0] = 2.71828
# show the elements of the "u" array againprint(n["fields/velocity/values"])
#-----------
# mixed ownership semantics allow you to organize,# extend, and annotate existing data n["coords/type"] = "uniform"n["fields/density/units"] = "g/cc"n["fields/velocity/units"] = "m/s"# show the entire treeprint(n)
#-----------
LLNL-PRES-697177 19
ConduitPythonAPIExample:MixingexternallyallocatedandConduitowneddata
#-----------
# you can mix external and conduit owned data within a# Node hierarchyvel_u = np.ones(9,dtype='float64')vel_v = np.ones(9,dtype='float64')# use set_external() to inits the "u" and "v" nodes of # the tree to point to the same memory location as their# source numpy arraysn["fields/velocity/values/u"].set_external(vel_u)n["fields/velocity/values/v"].set_external(vel_v)
#-----------
# show the elements of the "u" arrayprint(n["fields/velocity/values"])
# change the first element of the u array (via src)vel_u[0] = 3.14159;# change the first element of the v array (via conduit)n["fields/velocity/values/v"][0] = 2.71828
# show the elements of the "u" array againprint(n["fields/velocity/values"])
#-----------
# mixed ownership semantics allow you to organize,# extend, and annotate existing data n["coords/type"] = "uniform"n["fields/density/units"] = "g/cc"n["fields/velocity/units"] = "m/s"# show the entire treeprint(n)
#-----------
#-----------
# you can mix external and conduit owned data within a# Node hierarchyvel_u = np.ones(9,dtype='float64')vel_v = np.ones(9,dtype='float64')# use set_external() to inits the "u" and "v" nodes of # the tree to point to the same memory location as their# source numpy arraysn["fields/velocity/values/u"].set_external(vel_u)n["fields/velocity/values/v"].set_external(vel_v)
#-----------
# show the elements of the "u" arrayprint(n["fields/velocity/values"])
# change the first element of the u array (via src)vel_u[0] = 3.14159;# change the first element of the v array (via conduit)n["fields/velocity/values/v"][0] = 2.71828
# show the elements of the "u" array againprint(n["fields/velocity/values"])
#-----------
# mixed ownership semantics allow you to organize,# extend, and annotate existing data n["coords/type"] = "uniform"n["fields/density/units"] = "g/cc"n["fields/velocity/units"] = "m/s"# show the entire treeprint(n)
#-----------
{ "coords": { "x": [0.0, 1.0, 2.0], "y": [0.0, 1.0, 2.0] }, "fields": { "density": { "values": [1.0, 1.0, 1.0, 1.0] } }}
{ "u": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], "v": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]}
{ "u": [3.14159, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], "v": [2.71828, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]}
{ "coords": { "x": [0.0, 1.0, 2.0], "y": [0.0, 1.0, 2.0] }, "fields": { "density": { "values": [1.0, 1.0, 1.0, 1.0] } }}
{ "u": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], "v": [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]}
{ "u": [3.14159, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], "v": [2.71828, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]}
LLNL-PRES-697177 20
ConduitPythonAPIExample:MixingexternallyallocatedandConduitowneddata
#-----------
# you can mix external and conduit owned data within a# Node hierarchyvel_u = np.ones(9,dtype='float64')vel_v = np.ones(9,dtype='float64')# use set_external() to inits the "u" and "v" nodes of # the tree to point to the same memory location as their# source numpy arraysn["fields/velocity/values/u"].set_external(vel_u)n["fields/velocity/values/v"].set_external(vel_v)
#-----------
# show the elements of the "u" arrayprint(n["fields/velocity/values"])
# change the first element of the u array (via src)vel_u[0] = 3.14159;# change the first element of the v array (via conduit)n["fields/velocity/values/v"][0] = 2.71828
# show the elements of the "u" array againprint(n["fields/velocity/values"])
#-----------
# mixed ownership semantics allow you to organize,# extend, and annotate existing data n["coords/type"] = "uniform"n["fields/density/units"] = "g/cc"n["fields/velocity/units"] = "m/s"# show the entire treeprint(n)
#-----------
LLNL-PRES-697177 21
ConduitPythonAPIExample:MixingexternallyallocatedandConduitowneddata
{ "coords": { "x": [0.0, 1.0, 2.0], "y": [0.0, 1.0, 2.0], "type": "uniform" }, "fields": { "density": { "values": [1.0, 1.0, 1.0, 1.0], "units": "g/cc" }, "velocity": { "values": { "u": [3.14159, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], "v": [2.71828, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] }, "units": "m/s" } }}
LLNL-PRES-697177 22
Weareaimingtoprovideintui-veC++,Python,andFortranAPIs.
Conduit Examples
den = np.ones(4,dtype='float64')
n = Node();
n["fields/density/values"] = den;n["fields/density/units"] = "g/cc";
n_density = n["fields/density"]
den_vals = n_density["values"];den_units = n_density["units"];
print(n_density)
print('\nDensity ({}):\n{}'.format(den_units, den_vals))
std::vector<float64> den(4,1.0);
Node n;n["fields/density/values"] = den;n["fields/density/units"] = "g/cc";
Node &n_density = n["fields/density"];
float64 *den_ptr = n_density["values"].value();std::string den_units = n_density["units"].as_string();
n_density.print();
std::cout <<"\nDensity (" << den_units << "):\n";
for(index_t i=0; i < 4; i++){ std::cout << den_ptr[i] << " ";}std::cout << std::endl;
do i = 1,4 den(i) = 1.0enddo
n = conduit_node_obj_create()call n%set_path_ptr("fields/density/values",den,4_8)call n%set_path("fields/density/units","g/cc")
n_den = n%fetch("fields/density")
call n_den%fetch_path_as_float64_ptr("values",d_arr)
n_den_units = n%fetch("fields/density/units")call n_den_units%as_char8_str(units)units_len = n_den_units%number_of_elements()
call n_den%print()print *,print *,"Density (",(units(i),i=1,units_len),"): "
do i = 1,4 write(*,"(f5.2,1x)",advance="no"), d_arr(i)enddoprint *
call conduit_node_obj_destroy(n)
Python C++ Fortran
LLNL-PRES-697177 23
Weareaimingtoprovideintui-veC++,Python,andFortranAPIs.
Python
Conduit Examples
C++ Fortran
PY
{ "values": [1.0, 1.0, 1.0, 1.0], "units": "g/cc"}
Density (g/cc):[ 1. 1. 1. 1.]
CPP
{ "values": [1.0, 1.0, 1.0, 1.0], "units": "g/cc"}
Density (g/cc):1 1 1 1
FORTRAN
{ "values": [1.0, 1.0, 1.0, 1.0], "units": "g/cc"}
Density (g/cc): 1.00 1.00 1.00 1.00
PY
{ "values": [1.0, 1.0, 1.0, 1.0], "units": "g/cc"}
Density (g/cc):[ 1. 1. 1. 1.]
CPP
{ "values": [1.0, 1.0, 1.0, 1.0], "units": "g/cc"}
Density (g/cc):1 1 1 1
FORTRAN
{ "values": [1.0, 1.0, 1.0, 1.0], "units": "g/cc"}
Density (g/cc): 1.00 1.00 1.00 1.00
PY
{ "values": [1.0, 1.0, 1.0, 1.0], "units": "g/cc"}
Density (g/cc):[ 1. 1. 1. 1.]
CPP
{ "values": [1.0, 1.0, 1.0, 1.0], "units": "g/cc"}
Density (g/cc):1 1 1 1
FORTRAN
{ "values": [1.0, 1.0, 1.0, 1.0], "units": "g/cc"}
Density (g/cc): 1.00 1.00 1.00 1.00
LLNL-PRES-697177 24
§ Completelyrun0mefocused— Avoidsincompa0ble(orunsharable)code-genera0onsolu0ons
§ Emphasizesdatadescrip0onasacorecapability— Doesnotrequirerepacking— Providesafounda0ononwhichtobuildserializa0on,I/O,andmessagingfeatures
§ Providesamul0-languagedatamodel— CurrentlyincludesAPIsforC++,Python,C,andFortran— JSONfriendly
ConduitwasdesignedwithsoCwareengineeringecosystemlogis-csinmind.
Philosophy:Sharedatawithoutmassivecodeinfrastructure.
About Conduit
LLNL-PRES-697177 25
Supports shared higher level conventions for using Conduit to represent data.
• Computational Meshes • Multi-Component Arrays
Implements interfaces to Conduit’s in-core data model. • Core Objects • JSON parsing • Basic I/O • Basic transforms
Provides advanced I/O features built on top of Conduit’s data model. • HDF5 • MPI • WebSockets
Conduit’sRelayandBlueprintlibrariesprovidefeaturesbuiltontopofConduit’scoredatamodel.
Conduit Relay Blueprint
About Conduit
LLNL-PRES-697177 26
WhereareweusingConduit?
LLNL-PRES-697177 27
Ourcurrentproduc-onsimula-oncodeprojectsdevelopandmaintaintheirownCSinfrastructure.
Visualization and Analysis • Mesh Rendering • Feature Extraction • Simulated Diagnostics
Problem Setup • Computational Geometry • Mesh Generation • Mesh Decomposition
Uncertainty Quantification • Ensemble Generation • Parametric Studies • Statistical Models
Workflow Applications
Multi-physics Simulation Applications
CS Infrastructure • Input Parsing • Steering • Communication • Parallelism Abstractions • I/O • In Situ Coupling
Physics Libraries • Material Properties • Material Models
Numerical Libraries • Linear Algebra • Finite Elements
Physics Packages • Hydrodynamics • Chemistry • Thermal radiation • {and many more …}
Uses of Conduit
CS Infrastructure • Input Parsing • Steering • Communication • Parallelism Abstractions • I/O • In Situ Coupling
LLNL-PRES-697177 28
LLNL’sASCCSToolkitisanewprojectworkingtorefineandshareCSinfrastructureacrosssimula-onapplica-ons.
Visualization and Analysis • Mesh Rendering • Feature Extraction • Simulated Diagnostics
Problem Setup • Computational Geometry • Mesh Generation • Mesh Decomposition
Uncertainty Quantification • Ensemble Generation • Parametric Studies • Statistical Models
Workflow Applications
Multi-physics Simulation Applications
CS Infra.
Physics Libraries • Material Properties • Material Models
Numerical Libraries • Linear Algebra • Finite Elements
Physics Packages • Hydrodynamics • Chemistry • Thermal radiation • {and many more …}
CS Infrastructure • Data Management • Communication • Parallelism Abstractions • I/O • In Situ Coupling
ASC CS Toolkit
Uses of Conduit
LLNL-PRES-697177 29
Simula-oncomponentswillusetheASCCSToolkitandcommonconven-onstosharedata.
Mesh Fields
Mesh
Physics A
Mesh Fields
Mesh
Hydro B
Tools and Libraries Toolkit Components Physics Packages
Blueprint (“Mesh-aware”
data description)
Conduit (In-core data schemas)
Sidre (Datastore)
(Manages data shared by applications, Toolkit, tools, etc.)
ASC CS Toolkit “Core”
Relay (HDF5 I/O)
Uses of Conduit
LLNL-PRES-697177 30
LLNLisdevelopinganewcode,MARBL,whichemploystwomodularhydrodynamicsalgorithms.
BLAST is an unstructured mesh finite element ALE code that uses high-order elements and geometry
MIRANDA is a structured mesh Eulerian code that uses high-order finite difference methods
MARBL will be the first application to incorporate the data management and I/O features of the ASC CS Toolkit.
Uses of Conduit
LLNL-PRES-697177 31
Strawmanisanproxyapplica-onforinsiturenderinginmesh-basedHPCsimula-ons.
LULESH Kripke CloverLeaf3D Hydrodynamics Neutron Transport Hydrodynamics
Unstructured Uniform Rectilinear
C++ C++ Fortran
Strawman
Simulation
ConduitIn-CoreDataDescrip0on
In Situ Pipelines
EAVL,VTK-mDataModel+Rendering
MeshData Actions
IceTParallelCompositing
StreamingWebClientImageFilesImageFilesImageFiles
RenderedImages
Publish Execute
Uses of Conduit
Examplerendersfrombuilt-insamplesimula-ons:
LLNL-PRES-697177 32
StrawmanusesConduittodescribeandpasssimula-onmeshdatastructurestoMPI+Xrenderingpipelines.
Strawman
Simulation
ConduitIn-CoreDataDescrip0on
In Situ Pipelines
EAVL,VTK-mDataModel+Rendering
MeshData Actions
IceTParallelCompositing
StreamingWebClientImageFilesImageFilesImageFiles
RenderedImages
Publish Execute
Example:DescribingmeshdatausingConduit(C++):
Uses of Conduit
conduit::Node data;data["state/time"].set_external(&time);data["state/cycle"].set_external(&cycle);data["state/domain"] = my_mpi_rank;data["coords/type"] = "explicit";data["coords/x"].set_external(x);data["coords/y"].set_external(y);data["coords/z"].set_external(z);data["topology/type"] = "unstructured";data["topology/coordset"] = "coords";data["topology/elements/shape"] = "hexs";data["topology/elements/connectivity"].set_external(nodelist);data["fields/e/association"] = "element";data["fields/e/type"] = "scalar";data["fields/e/values"].set_external(e);
LLNL-PRES-697177 33
Conduitisanopensourceprojectfocusedonsimplifyingin-coredataexchangeintheHPCsimula-onecosystem.ProjectInfo:
§ Docs:hEps://soGware.llnl.gov/conduit
§ Repo:hEps://github.com/llnl/conduit
§ License:BSDStyle
ContactInfo:
§ CyrusHarrison([email protected])
§ BrianRyujin([email protected])
§ AdamKunen([email protected])
Conduitisaworkinprogress!
§ FutureWork:— UsingConduitinHPCapplica0ons— ExpandingAPISupport
• CurrentState:C++>Python>C/Fortran
• Lua(?)
— RefiningRelayandBlueprint— Windowssupport— Binarydistribu0ons(?)
Conclusion
Top Related