360 likes | 533 Views
www. ing.unipi . it. Open Microelectronics architecture considerations. Marek Gayer , Ph.D. Some of goals of framework. Interactive input of simulation parameters and interactive visualization Programmable flow of simulation modules Open source Multiplatform (at least Windows + Linux)
E N D
www.ing.unipi.it Open Microelectronicsarchitecture considerations Marek Gayer, Ph.D.
Some of goals of framework • Interactive input of simulation parameters and interactive visualization • Programmable flow of simulation modules • Open source • Multiplatform (at least Windows + Linux) • Easy installation and updates • Easily extendible by user without recompiling • Server based simulation • Ability to develop and contribute without necessity to understand whole problems and technologies • Should encourage others to contribute
Basics of Architecture Server(like deckbuild)Server Scripting – CGI, PHP, JSP, Python, PerlFlow Control – XML, XSLT, Python, PHP Simulator modules and their bindings (C/C++, Fortran) Data interchange between modules (C++ library, files) Visualization creating / assistance modules (reduced XML grid, web graphics formats) Interactive Device designer(like devedit) User Interface - C++ with Qt / GTK / etc.UI – Java / Java Web Start / Applet UI - ECMAScript + SVG + DHTML Design and flow visualization - SVG, OpenGL, Library capabilities Task to solve XMLover TCP/IP Interactive Visualization(like tonyplot/3d) Visualization by: OpenGL , SVG , VRML – X3D, Java2D/3D Common video formats Statistics Visualization Interaction Data Storage of results on server: Files, SQL, XML, ...
Interactive designer • Will specify the task to compute server(shape, materials, doping, …) • Will also specify flow of simulation modules, perhaps by an interactive graph editor • Can create a grid, eventually meshing • Result will be send to server • Will use 2D shapes graphics, with control of Z axis • Could be made as a master thesis(es)
Interactive designer –C++ • + Fast performance • +C/C++ will be probably used for simulation modules and passing data • - We must make and test binaries for supported platforms • - Easy delivery and update via web browser not possible (like in Java)
Interactive designer –User Interface –C++ with Qt • + Most professional solution for multiplatform UI • + Windows / Linux / Mac (native widgets) • + Good documentation • + Completeness • + User Interface Designer (Qt Designer) • + Bindings for Python, Java • - GPL / commercial license • + Used by Google Earth, Skype (Linux), KDE (Linux) • http://en.wikipedia.org/wiki/QT • http://www.trolltech.com/
Interactive designer User Interface –C++ with GTK+ • + Often used for multiplatform UI • + Windows / Linux / Mac (native widgets) • - User Interface Designer • + Bindings for Python, Java • + LGPL license • - Written in C, although C++ wrapper exists (gtkmm) • + Used by Gnome, GIMP, Firefox • http://en.wikipedia.org/wiki/GTK • http://www.trolltech.com/
Interactive designer User Interface –C++ • Other alternatives: • wxWidgets • FoxToolkit • FLTK • Ultimate++
Interactive designer –Java • + Ability to deploy application in various ways(web start, applet, java binaries) • + Rich library (e.g. java2d) http://java.sun.com/products/java-media/2D/ • + Many open source projects are in Java (SF: 23.000 Java, 20.000 C++, 18.000 C) • +Java Web start • - Java apps need considerable more memory • - Java runtime must be installed
Interactive designer – Java – SWING library • + Made by Sun • + Looks similar on each platform • + Good object model design(more pure Java) • - Native GUI applications looks still better • http://en.wikipedia.org/wiki/Swing_(Java) • http://java.sun.com/products/jfc/tsc/sightings/
Interactive designer – Java – SWT library • + Made by IBM • + Looks more native on each platform • -Worser object model design • - Harder to develop then Swing • - More neccessary to test each platform • + More professional look • http://en.wikipedia.org/wiki/SWT
Interactive designer –Java Web Start • + Allows easy installation and launching of software through web browser • + Easy update of new versions of software • + When installed once, it is not necessary to install again (under the condition that no changes were made) • + During update, new jars are downloaded • + Ability to use all features of Java: menus, user interface, graphics, … • http://en.wikipedia.org/wiki/Java_Web_Start
Interactive designer ECMAScript (AJAX) • + Not necessary to install anything (Firefox) • + Easy delivery of new versions of application • + Fast start of application • - Considerably harder to develop complex applications then with C++ / Java(hard testing, debugging) • - No IDE, no GUI designer, unmature tools • - Strange class/object model syntax • - Poor general class library (e.g. strings) • - Cannot access local filesystem due to security • - Limitations of UI due to DHTML • - Differences in each browser => necessary to test and maintain for new browsers • - Memory requirements • - Interpreted, not compiled => slow • +- Graphics would have to be in SVG • http://en.wikipedia.org/wiki/Ajax_(programming)
Designer and simulation flow visualization • Using the visualization in the UI package: • Graphics View for Qt • Cairo for GTK • Java2D for Java • Using SVG • Using OpenGL
SVG • Standard for vector and raster graphics based on XML used namely on the web • With Batik, generation of SVG is as easy as in Java2D (implements same interface)http://en.wikipedia.org/wiki/Batik • Possibility to add ECMAScript functionality • Possibility to generate SVG from XML using XSLT transformations • Good support in browsers and other software • http://en.wikipedia.org/wiki/Scalable_Vector_Graphics
OpenGL • + Portable library for 3D/2D graphics • - No object layer • - Uses state machine concept • - More complex to learn and to use due to less abstraction level (compared to e.g. Java2D) • + Very fast performance • + Bindings for different languages, including Java: http://en.wikipedia.org/wiki/Java_OpenGL
Inside Web Server Visualization / Data assitance (SVG / VRML / MPG / XML) Interactive visualization User defined flow in e.g. Python / XML Interactive designer Server core – CGI/PHP/JSP/Python Sim.mod. 1 Sim.mod. 2 Data Synchronizing libraries / (XSLT) data converters Sim.mod. 3 File/ SQL Shared Memory
Server Side (1/2) • PHP/Python/JSP/CGI scripts on HTTP server will maintain communication with interactive and visualization parts (including translation of data) • Will control the flow of simulation by launching simulation modules (written in C++/Fortran) • Data exhange between simulator modules will be realized using e.g. special C++ library, shared memory, PHP/Python glue code • Mechanism for calling C functions from Python/PHP glue should be investigated (something better then exec with files as arguments) – e.g. PHP extensions. • How modules will be compiled and linked together should be investigated
Server Side (2/2) • Possibility of using shared memory should be investigated • Input and output of modules could be defined XSD schema • Parts of glue could be defined by XML data (programmable by user / generated by designer) • XSLT transformations could be used for translation of data to format that module expects • http://en.wikipedia.org/wiki/XSLT • Results (including partial ones could be saved in files and/or SQL DB
Interactive visualization of results • Interaction with server for selecting part of currently visualized data of transistor • At least at beginning of project 2D visualization should be sufficient • Possibility to implement one or more of: • OpenGL • SVG (created on server) • VRML/X3D (created on server) • JPG / MPEG (created on server) • Delivering numerical data and stats. (XML)
VRML/X3D • 3D Model scene is defined in text format • Can be zoomed, rotated, etc. • Requires plugin in web browser • Those plugins are not fully compatible (Scripting …) • For using in standalone application, library is needed (CyberX3D, OpenVRML, Xj3D, H3D) • X3D (ISO standard) is successor of VRML, adds support XML • For modification of visualization data, new VRML/X3D file is usually created on server • http://en.wikipedia.org/wiki/VRML • http://en.wikipedia.org/wiki/X3D
Progress (1/3) • Established working environment for Python, Numpy and building extensions in CygWin • Even possible to run KDevelop and KDBG (possible to debug extensions!) • Read important parts on Python and Numpy programming book (“Python Scripting For Computational Science”) • Created sample module in C, with one and two dimensional float arrays and pointer to function. Various programming styles (3 version of wrapper func used) • The 2D and 1D arraysarenow accessible in both C and Python. Able to also use Python dictionary type
Progress (2/3) • With NUMPY, converting to type * and type ** does not need additional memory and values do not have to be copied (in type **, helper mapping array of pointers must be created) • NUMPY alone is a reason to stick with Python • Python extensions cannot be build easily with Windows (requires 5 packages including.net framework SDK – hundreds of MBs) • Able to compile ViDES as library, then to link with wrapper as Python extension (no need to change a single line in original source code).
Progress (3/3) • Wrote wrapper accepts tens of NumPY arrays and converts them to C type *(*) • Wrote allocations and file operations to fill all needed variables for module struttura to Python • Compiles and links, but I am getting Segmentation fault (debug needed)
Progress2 (1/3) • Succesfully debugged ViDES struttura - results in binary files are 100% same • NumPy basic operations under matrixes should be same as C extension (for example I tested scalar multiplying on 1000x1000 matrix: 0.21s vs 0.20s) • Compared performance of versions of array accessing in Python and NumPy array as C extension - 2D arrays (NumPy, C), 1D (NumPy), and 2D lists (Python)
Progress2 (2/3) • defPythonArray2dGridLoop (a, x, y, f): • for i in xrange(x.size): • for j in xrange(y.size): • a[i][j] = f(x[i], y[j]);# OR # • a[i][j] = x[i] + y[j];# OR # • return a; • Results: (e.g. 0.02s C vs. 3.5s Python), but with one Python callback 0.75s C vs. 3.9s Python • Howeever, direct manipulation in cycles is still slow; i.e. fast code is expected to be moved to C extension
Progress2 (3/3) • Could be a good idea to buy NumPy book, for $39.99 (electronic pdf version), I read first 50 sample pageshttp://www.tramy.us/guidetoscipy.html Documentation for older package, Numeric is available here: http://numpy.sourceforge.net/numdoc/numdoc.pdffor most case it should be enough • TODO: make C++ class with overloaded operators, as possible recommended datatype to use in C++ modules and check performance againts double **
Progress2 Notes (1/2) • Shape of NumPy array can be anytime changed in python, but we must keep the number of items • Extended slice operations, which has base in python are inspired from Numeric/Numpy package • Numpy natively supports hundreds of operations: • Aritmetic operators (*+-^%+=): • Concetation of matrices • Slices and indexing • Creation of Matrices and Vectors (filling arrays e.g. identity matrix) • Reshaping • Assigment of multiple values • Transposing • Inverting
Progress2 Notes (2/2) • Determinant • Summary of various elements • Sorting • Finding maximum and minimum • Flipping • Rotating • Various kind of multiplications • Finding values based on conditions • Statistics (average, median, variance, correlation, covariance) • Solving differential equation (diff function) • Fourier transformation • Direct reading from/to file. these operations are implemented in C
Thank you for your attention. ??? Do you have any questions ?