May 19, 2000 - terface for the Sugar MEMS simulator hosted on the Millennium computing ... These solutions are typically di cult to compile and adminis- ter.
M & MEMS: A Web-Based Interface for the Sugar MEMS Simulator Hosted on the Millennium Cluster David Bindel
Patrick R. Eaton
May 19, 2000
Abstract
The MEMS community has a real need for eective and ecient tools for device design, simulation, and veri cation. The Sugar simulator is a state-of-the-art tool for these tasks, but it suers from several problems. This paper presents M & MEMS, a web-based interface for the Sugar MEMS simulator hosted on the Millennium computing cluster at the University of California at Berkeley. M & MEMS helps Sugar overcome many of its shortcomings. A prototype implementation has been completed using the PHP3 embedded scripting language.
1 Introduction Many predict that our future will be shaped by MEMS devices. MEMS, micro-electromechanical systems, are tiny devices that integrate mechanical and electrical components using traditional semiconductor fabrication techniques. MEMS are already present throughout our society in such unremarkable locations as automobiles and hospital operating rooms. In the future, we may see MEMS in such such exotic scenarios as blood chemistry monitoring and human gesture to computer interfaces. This future, however, depends heavily on the development of improved CAD tools to assist with the design and validation of MEMS devices. The current MEMS design process often centers around colleagues working on a whiteboard while referring to simpli ed equations modeling the 1
device behavior. It is only nal design veri cation that can be eectively performed with the aid of computing. Even then, this step is often only capable of verifying small components of the system. Ecient techniques for veri cation of large systems are simply not available. Sugar[9], a nodal simulation package for MEMS devices, is one step towards powerful, ecient, accurate tools for MEMS simulation. Sugar; developed by Jason Clark, Ningning Zhou, and Kris Pister at the University of California at Berkeley; is inspired by the Spice family of integrated circuit simulators for analyzing electrical circuits. Sugar, implemented in Matlab for portability and ease of distribution, models mechanical motion in three dimensions as well as electrical and thermal properties. A user provides input to the simulator through an ASCII netlist which describes the components of the MEMS device. The user may then analyze the device by invoking appropriate Matlab functions. Output is available through the standard Matlab console interface or as images output by the simulation. While the power of Sugar is readily evident by its large user base which includes users in both academia and industry, its approach to development and distribution is limiting in several respects. Its exclusive use of Matlab presents several problems. First, standard Matlab does not support parallel computation. Secondly, because Matlab is an interpreted language, there is a great deal of overhead that slows both simulation initialization and computation. Finally, the cryptic text-based interface can pose a signi cant learning curve to some users. Even if the features were used to interface Matlab to high-performance numerical kernels, traditional highperformance software solutions are not feasible for the entire Sugar user community. These solutions are typically dicult to compile and administer. Even when properly con gured, they are still dicult to use. Finally, even if these software problems could be overcome and packaged for easy deployment, most users do not have access to the high-performance hardware to enable improved performance necessary to justify the extra development and support costs. 1.1
Solution
To improve the performance of the Sugar simulator while overcoming the associated problems of resource access, distribution hassles, and administrative burden, we propose M & MEMS, a web-based interface for the Sugar MEMS simulator hosted on the Millennium cluster 2
Millennium is a project at the University of California at Berkeley that aims to develop and deploy a hierarchical campus-wide "cluster of clusters" to support advanced applications in scienti c computing, simulation, and modeling [7]. Allowing Sugar users to access the Millennium resources through a web interface obviates many of the problems enumerated above. Access to Millennium provides all Sugar users with the tools for highperformance simulation, even allowing parallel computation if warranted. By isolating the administrative burden to a single site, it enables Sugar developers to utilize resources outside of the Matlab programming package. The developers can replace computation in Matlab with calls to optimized kernels in standard numerical codes in compiled languages such as SuperLU [4] and SCALAPACK [3]. A web interface is desirable for several reasons. While Matlab is commonly available in engineering environments, a web browser is both indispensable and omnipresent in today's technical arenas. Thus making Sugar available via the web increases the number of potential users and improves a user access to simulations beyond the con nes of an engineering laboratory. Secondly, HTML forms with integrated on-line help can be used to guide the user through the simulation and analysis procedure more eectively than a Matlab text interface. The next section will explain the M & MEMS system architecture. Section 3 will detail the current implementation of the interface. Section 4 will describe the performance improvement seen using M & MEMS over Sugar. Finally, Section 5 will discuss the lessons learned during this endeavor and the future plans for the work.
2 System Architecture
M & MEMS users interact with Sugar via a web interface. A typical user will log in at the front page, upload a netlist describing some device, and then request a simulation. Actual execution of the simulations is done asynchronously, so that a user can start other simulations to run simultaneously, check the results of previous simulations, or do other web-browsing while the simulation completes. When nished, the simulation is listed in the user's \completed simulations" list; a user can view the results of completed simulations at any time. The web client communicates directly with a dedicated front-end web 3
Web Client
Millennium Cluster of Web Servers
Millennium Server Cluster
hardware resources software tools Netlist Compiler
Lightweight Tools
MATLAB (running SUGAR)
Netsolve, MATLAB*P, ...
SuperLU
SCALAPACK
Other Tools
Figure 1: System Architecture Diagram server cluster consisting of two high-end Sun machines (two more are to be added soon). This cluster will eventually serve out the pages for all production services on Millennium. Besides dynamically generating web forms and maintaining a database of per-user state, the front-end cluster is responsible for low-overhead tasks such as preprocessing and syntax-checking netlists. Requests for simulations are forwarded by the web cluster to the main Millennium cluster, which consists of a large number of Intel SMPs. Different nodes in the cluster can simultaneously process dierent simulations, providing coarse-grained parallelism. The main body of the simulation runs within MATLAB; however, for large tasks we may call higher-performance external numerical kernels. For moderately large problems, the simulation might call shared memory codes to access other local processors within the SMP. We are considering multiple options for accessing more distributed computing power. One option is Netsolve [1], a client/server system for accessing remote scienti c computing resources via an RPC-style interface. Another possibility is MATLAB*P [5], a client/server system which is more tightly coupled to MATLAB. We plan to investigate the appropriate solution as larger test problems requiring such resources become available. 4
3 Implementation While developing M & MEMS required signi cant work in constructing interfaces for existing tools, the majority of original code serves to provide the web-based user interface to Sugar. The web interface was developed using the PHP Hypertext Preprocessor version 3 (PHP3), a server-side, crossplatform, HTML embedded scripting language [8]. The web interface supports individual password-protected user accounts. Any individual with web access may create an account for this service. Creating an account provides a user with a small amount of network storage to store netlists and simulation results. All password features will be protected through secure socket connections when that service is deployed on the Millennium web server cluster. M & MEMS supports simple session concepts that will automatically log a user out of the system after a time out period. Upon logging into the system, a user is presented with a general summary of his activity. Figure 2 shows this view for a sample session. The key features of this view are a list of netlists the user has uploaded to the system, a list of completed simulations, a list of running simulations, and an array of buttons for controlling session activity. All information regarding the state of a user's account is maintained in the directory structure of his private storage space; no additional database is maintained. A user will often start a session by uploading a netlist to the system. The netlist compiler checks the netlist at the time of upload and refuses to store invalid netlists. This gives users feedback about their netlists immediately, rather than at a later simulation time. Users also have the option to view or delete previously uploaded netlists from the system. After the desired netlists have been uploaded to the system, a user may initiate simulation. Buttons and text elds guide the user in providing information relevant to the desired simulation type. All entered parameters are checked and the simulation is submitted. Upon submission, the Millennium web server opens a secure connection to the regular Millennium cluster. The web server passes the user's simulation parameters to a simple script and returns immediately, displaying the simulation with the running status. This allows the user to continue working while the simulation completes. The script starts a Matlab process to interpret a Matlab simulation script. The simulation script loads the netlist, directs simulation, and writes all output, variables, error messages, and images to the users storage space. After Matlab has terminated, the status of the simulation is updated to 5
Figure 2: A screenshot of a user's general summary screen which displays currently uploaded netlists and simulations that are completed and running. 6
Sugar 1.1 Sugar Web 39 2 s 08s 20 3 s 19 9 s 143 5 s 36 2 s 203 0 s 56 8 s
Parse and Load Netlist Modal Analysis Display Mode Shape Total
:
:
:
:
:
:
:
:
Figure 3: Relative times for analysis of vibration modes of a gyroscope completed in the summary view. To view the results of a simulation, the user simply selects a completed simulation and provides any required additional information about the output to be viewed. To recover storage space, a user may also delete the results of a completed simulation. Because the M & MEMS service allows the general public to use resources on the Millennium cluster, several security concerns had to be addressed. The biggest security concern involved allowing users to run arbitrary Matlab code, including potentially destructive system calls, on Millennium. This was possible because original Sugar package evaluated netlist code without syntax checking. To eliminate this security hole, we rewrote the netlist parser using bison [6], ex [6], and C++. This new netlist compiler provided ecient netlist veri cation at upload and thorough syntax checking, in addition to eliminating the security hole. We also performed a preliminary investigation of several numerical tools such as SCALAPACK, SuperLU, and Netsolve on the Millennium. When we determined that these tools would have little impact on current Sugar code and example netlists, we redirected our eorts to other issues.
4 Performance results
While we expect that Sugar simulations will eventually spend most of their time in numerical work, we were surprised to nd only a small fraction of the processing time in Sugar 1.1 spent in solvers. In a simulation to determine the vibrational modes of a moderate sized gyroscope composed of 140 anchors and beams, we discovered that only about 4% of the run time was spent in the eigensolver kernel. Most of the time, in fact, was spent parsing the netlist describing the device and displaying the output. The timings for 7
a typical run are shown above. Note that the situation, if anything, is portrayed optimistically; for most simulations of interest, there will be multiple visualizations of the results (e.g. pictures of shapes corresponding to dierent modes of vibration). Furthermore, the algorithms used were not scalable, and would likely be a bottleneck even for larger problems. By rewriting the MATLAB version of the parser to use standard topdown compiler techniques, we were able to reduce the parse time by roughly a factor of two. The second rewrite of the parser, done using bison, ex, and C++, reduced the compile time to a manner of milliseconds. Thus, the time reported above for this version of the code to \parse and load" is actually the time for MATLAB to load a pre-parsed version of the le. While we initially rewrote the parser in order to more conveniently do syntax-checking, we were pleased with the speed improvement. Pro ling revealed that most of the time in the display routines was spent in string operations. In fact, we discovered that a great deal of time was spent scanning through a list of node names to nd an array index. By augmenting the netlist parser, we were able to output the name to index mapping with trivial overhead during the parse phase, thus reducing the asymptotic complexity of that section of code from ( 2 ) to ( ). Similar bottlenecks still comprise at least 16 seconds of the run time reported above for the current version. Though we have made substantial progress, we still plan to continue pro ling and streamlining the code for several iterations. In order to progress beyond removing obvious non-numerical bottlenecks, we will also need to develop larger and more complicated test cases. Part of the diculty simply comes from formulating netlists; currently most SUGAR netlists are hand-generated. Research into automatically creating netlists from a graphical description [2] may ease this problem. We expect that providing better tools will also lead to increased interest in larger simulations, which will then provide us larger test cases to use in further development. O n
O n
5 Future Work There remain some known non-numerical speed bottlenecks in the current version of Sugar, which we hope to remove soon. Once those bottlenecks have been removed, we plan to further investigate how to parallelize the numerical work. In order to do further tuning, however, we will need to obtain larger realistic test cases. 8
The system for deploying web-based applications on Millennium is still in development. M & MEMS is among the rst of what we hope will be many scienti c web services for the Millennium, and we expect that our tool and the web service infrastructure will co-evolve rapidly over the summer. We hope to have a completely functional service available by the beginning of the fall semester for use in EE245, the introductory MEMS design course.
6 Acknowledgments We would like to give special thanks to Matt Massie, Eric Fraser, and the rest of the Millennium sta for their assistance in developing the web server and cluster communication infrastructure we use in M & MEMS. Furthermore, we would also like to thank Jason Clark and Ningning Zhou for the help in understanding the Sugar simulator.
References [1] D. Arnold, S. Blackford, and J. Dongarra. User's Guide to NetSolve v1.3. Department of Computer Science, University of Tennessee. Available at http://www.cs.utk.edu/netsolve/. [2] B. Baiyda. MUMPS extraction module. http://www2.ece.cmu.edu/ mems/memsyn/extract/. [3] L. S. Blackford, J. Choi, A. Cleary, E. D'Azevedo, J. Demmel, I. Dhillon, J. Dongarra, S. Hammarling, G. Henry, A. Petitet, K. Stanley, D. Walker, and R. C. Whaley. ScaLAPACK Users' Guide. SIAM. Available at http://www.netlib.org/scalapackslug/scalapack slug.html. [4] J. Demmel, J. Gilbert, and X. Li. SuperLU users' guide. http://www.nersc.gov/ xiaoye/SuperLU, 1999. [5] P. Husbands and C. Isbell. The parallel problems server: A client-server model ... for interactive large scale scienti c computation. In Proceedings of VECPAR, 1998. [6] J. R. Levine, T. Mason, and D. Brown. lex & yacc. O'Reilly and Associates, 1992. 9
[7] The Millennium Group. Millennium web page. http://www.millennium.berkeley.edu. [8] The PHP Group. PHP web page. http://www.php.net. [9] N. Zhou, J. V. Clark, and K. S. J. Pister. MEMS simulation using SUGAR 0.5. In Proc. Solid-State Sensors and Actuators Workshop, pages 191 { 196, June 1998.
10