Presentation is loading. Please wait.

Presentation is loading. Please wait.

M.Frank LHCb/CERN Using Shared Libraries ã The traditional way ã How to build shared images? ã Benefits ã Process configuration ã Fortran.

Similar presentations


Presentation on theme: "M.Frank LHCb/CERN Using Shared Libraries ã The traditional way ã How to build shared images? ã Benefits ã Process configuration ã Fortran."— Presentation transcript:

1 M.Frank LHCb/CERN Using Shared Libraries ã The traditional way ã How to build shared images? ã Benefits ã Process configuration ã Fortran

2 M.Frank LHCb/CERNGAUDI The traditional way - comparison ã The past: ä 1 Executable ä Many object files/libraries, all linked into one executable at link time ã Gaudi: ä 1 Executable ä Very few object files/libraries linked in ä Process aquires it’s “personality” at run-time ä Dynamic linkage of images ä Execution of code within these images ã Keep possibility to link statically

3 M.Frank LHCb/CERNGAUDI What type of libraries exist? ã Static libraries ä Code to be duplicated for each image ä Build using CMT as known ä Result archive library ã Implicitly linked libraries ä Equivalent to tradition shared libraries ä Public implementation code: Base classes ä On the link step use CMT macro: macro XXXXshlibflags "$(libraryshr_linkopts) …”

4 M.Frank LHCb/CERNGAUDI What type of libraries exists? ã Explicitly linked libraries ä Loaded on demand component libraries ä Private implementation code ä Single entry point extern “C” std::list & getFactoryEntries() Access to all implemented factories ä On the link step use CMT macro: macro XXXXshlibflags "$(componentshr_linkopts) …”

5 M.Frank LHCb/CERNGAUDI Benefits ã Process depends on configuration PATH LD_LIBRARY_PATH ã Modules become manageable Minimize dependencies ã Upgrades are simple No link step is involved ã Efficient use of resources No unused ballast carried around

6 M.Frank LHCb/CERNGAUDI Managing the Environment ã Unix: cmt config; source setup.(c)sh ã WNT: use CMT add-in for Developer Studio Set Environment Show Environment Show CMT macros Build projects and workspace CMT dialog Display CMT help Output

7 M.Frank LHCb/CERNGAUDI Managing the Environment ã CMT add-in determines CMT parameters from active project ã If there is no active project: Dialog is invoked

8 M.Frank LHCb/CERNGAUDI Side Remarks ã Fortran ä Must be linked directly into the executable I.e. the traditional way ä Problem of duplication of common blocks ä Do not even think of linking Fortran to shared images - unless you know what you are doing

9 M.Frank LHCb/CERNGAUDI

10 M.Frank LHCb/CERN How to make objects persistent ã What must be provided ã The musts ã I won’t bore with internals ã See Rio example in GaudiExamples

11 M.Frank LHCb/CERNGAUDI Storing objects ã From using Sicb data we know ä Writing converters is a pain for starters ä …but cannot be avoided ã Automate conversion procedure as far as possible ä Use data serialization mechanism ä inspired by Java / MFC / ROOT

12 M.Frank LHCb/CERNGAUDI Provide Class Identifier class MyObject : public DataObject / ContainedObject{... /// Retrieve reference to class definition structure virtual const CLID& clID() const { return MyObject::classID(); } static const CLID& classID() { return CLID_MyObject;}... }; ã Nothing new ã Needed by the “generic converter” and “generic object factory” ã Mandatory to handle inhomogeneous containers

13 M.Frank LHCb/CERNGAUDI Provide Data Serializers StreamBuffer& MyObject::serialize( StreamBuffer& s ) const { DataObject::serialize(s); return s << m_event << m_run << m_time; } StreamBuffer& MyObject::serialize( StreamBuffer& s ) { DataObject::serialize(s); return s >> m_event >> m_run >> m_time; } ã Accepted data types ä Primitives: int, float, … ä Smart references: e.g. SmartRef Writing Reading

14 M.Frank LHCb/CERNGAUDI Provide Factories ã Object factory for  Contained objects static const ContainedObjectFactory s_MyTrackFactory; const IFactory& MyTrackFactory = s_MyTrackFactory;  Object container e.g. ObjectVector static const DataObjectFactory > s_MyTrackVectorFactory; const Ifactory& MyTrackVectorFactory = s_MyTrackVectorFactory; ã Converter Factory static const DbUserCnvFactory > s_CnvFactory; const ICnvFactory& MyTrackCnvFactory = s_CnvFactory;

15 M.Frank LHCb/CERNGAUDI // Output Stream RootDst.ItemList = { "/Event/MyTracks#1" }; RootDst.EvtDataSvc = "EventDataSvc"; RootDst.EvtConversionSvc = "RootDbEvtCnvSvc"; RootDst.OutputFile = "resultEx.root"; // Application Mgr ApplicationMgr.ExtSvc += { "DbEventCnvSvc/RootDbEvtCnvSvc” }; ApplicationMgr.DLLs += { "DbCnvImp","DbConverters","RootDb”}; ApplicationMgr.OutStream = { "RootDst" }; // Persistency/Conversion service setup: EventPersistencySvc.CnvServices = { "RootDbEvtCnvSvc”, "SicbEventCnvSvc” }; RootDbEvtCnvSvc.DbTypeName = "RootDb::OODataBase"; RootDbEvtCnvSvc.FddbName = "RioFederation"; Job options ã Persistency setup

16 M.Frank LHCb/CERNGAUDI Conclusions ã It should be simple to make objects persistent ã Generic converters and object factories are easy to implement ã Total overhead < 20 LOC per class ã Output toWNTLinux ä RIO x x ä Objectivity/DB (not supported) x ä ODBC / RDBMS (not supported) x


Download ppt "M.Frank LHCb/CERN Using Shared Libraries ã The traditional way ã How to build shared images? ã Benefits ã Process configuration ã Fortran."

Similar presentations


Ads by Google