Tuesday Nov 11, 2008

An Exciting Software Tool Realease For The Parallel Application Developers

Sun Studio Express 11/08 Release went live on November 12, 2008. This new release has many important new features, although it is an express release. The new feature list includes updated IDE based on NetBeans 6.5, remote development and debugging, new standalone light weight GUI debugging tool, integrated Dtrace plug-in and the new compiler enhancement to generate the machine code with better run time performance on both Sparc and X86 systems. Any above new feature deserves a good article to describe it. Here I like to discuss two very important tools OpenMP 3.0 and MPI Performance analysis tool for parallel programming in this blog.

Both tools are very important in their own parallel programming domain. OpenMP 3.0 is a major leap from the older version with dynamic tasking in shared memory programming model and the MPI performance analyzer is the indispensable tool for MPI distributed programming. Here I will explain why the serious parallel application developers should feel excited about these two big tools to help design their parallel applications.

OpenMP 3.0 introduces a new feature, dynamic tasking. Instead of parallelizing the code by using the OpenMP parallel loop or parallel regions statically, the parallel application developers can create the parallel tasks in the logic flow dynamically in OpenMP 3.0 and expect these tasks to run concurrently. This new feature gives the developers a much needed programmability. Graph traversal is a practical example to illustrate the programming power of dynamic tasking. Many applications are designed to find an optimal solution for a very complex problem. Usually the problem can be transformed and modeled as a large state space graph and the program algorithm is implemented as finding the optimal graphic node through traversing the graph. The programmer can map the processing of a graph node as an OpenMP task. A task during the process can create as many new tasks as the child nodes of the current node, specifically one new task for each child node. Therefore a complex graph traversal problem can be implemented simply as a task of processing an graph node and creating more new tasks for the corresponding child nodes. The program starts with a single task mapping the root node and the task will generate more and more tasks which eventually cover all the graph nodes.

OpenMP 3.0 also include some other very helpful features such as loop collapse, new environment variables and routines for runtime scheduling etc., Sun Studio compiler implements all these new features too. More importantly Sun Studio compiler keep its tradition as a very high quality performance tool to support the new OpenMP 3.0 with the top run-time performance in the industry.

MPI is the De-facto standard for distributed programming model. Today when people talk about HPC , MPI is the first thing comes to people's mind. Actually MPI programming is not easy for most developers, but the harder problem is to scale up the parallel performance of a MPI application. An application must be thirsty for multiple times performance speed up to adopt the MPI programming model. The failure of scaling up a MPI program's parallel performance is unacceptable. Therefore MPI performance analyzer is the most fundamental tool for MPI application developers besides the MPI library itself.

There are several MPI performance tools ranging from the very expensive one to the open source free one in the market place . Why does Sun Studio offers its own MPI performance analyzer? What is unique about this tool? The quick answer is that Sun Studio MPI performance analyzer is the best of its kind. Here I like to discuss the unique features of Sun Studio MPI performance analyzer in core capability and ease of use interface. When you analyze and tune the performance of a distributed program, you need to analyze both the computation and communication cost and find the right balance between the two. Sun Studio Analyzer is one of the best performance tools in analyzing the computation performance in the industry. It has the most comprehensive instrumentation mechanism to collect all the key runtime performance data and allow the programmers to analyze these data with the various analysis mechanisms from time line, call tree, source code window to data space view. The MPI performance analyzer adds the complementary capability of tracing the MPI messages to analyze the communication cost. Besides the MPI performance tool also collaborating with Sun ClusterTools team (MPI library) adds MPI states to make the measurement of communication cost more precise. Therefore Sun Studio performance analyzer has the best core capability in analyzing both computation and communication cost.

Sun Studio MPI performance analyzer also presents a new and simple user model for the MPI developers. The instrumentation is similar to the Analyzer's original data collection interface for a sequential program. It is easy to run a performance experiment to collect the performance data. The MPI analyzer provides a simple and easy user interface. The main time-line window as shown below provides a two dimensional view of each MPI process's computation time and the messages between the processes. It is quite handy to zoom in and zoom out for either dimension through the corner control console.

Additionally the tool also offers a two dimensional chart window as shown below with both X axis and Y axis configurable with any performance parameter. It is very convenient for the developer to measure the impact of any performance parameter or evaluate the interaction between any pair of performance parameters with the chart analysis window.

Parallel programming remains relative hard for most application developers even with the current advanced software technology. If you are developing a parallel application or plan to develop a parallel application, the most important thing is to use the right tools to help you. I hope this blog incites your curiosity to download and try out Sun Studio Express 11/08 release.

Tuesday Sep 09, 2008

PHP programs to convert an IP Address into the Country Code

For many web sites, the site owners need to know where the visitors come from. We at Sun Developer Tools organization want to know where the software developers downloading Sun Studio software. We needed an utility to convert an IP address into the country code. I searched the Internet and found many commercial offerings. However I only need the core functionality and don't want to buy a commercial product with complex user interface. After studying the public PHP code from www.tellinya.com, I wrote a complete utility set of PHP programs to convert an IP address into the country code. I think my utility package has the basic functionality needed by many people and decide to share the PHP programs here. You can download the complete set of PHP programs ip2c.tar.gz here. After downloading the file, you should run gunzip and tar commands to un-archive it. The tar file package contains the following programs:

initdb.php: A php program to convert the text IP DB into mysql DB.

check.php: A php verifying program to dump all the stored records in mysql DB.

ip2c.php: A php program to convert IP address into country code from text DB. (slow version)

ip2c_db.php: A php program to convert IP address into country code from mysql DB. (fast version)

Here are the simple steps to run this program:

1. Make sure the included php.ini file in your current directory

-- It is needed to increase PHP program memory size

2. Put your input IP addresses in input.txt (one address one line)

-- See the example input.txt file

3. Run the program as: php ip2c.php [php ip2c_db.php]

4. The output will show both in screen and in output.txt file.

Enjoy using this package and let me know if you encounter any problem. If you think the package is helpful, you may find may other interesting and helpful tools at Sun Studio site.

Monday Feb 26, 2007

I Like My Solaris Laptop

I have a Sony Vaio VGN-T350P laptop. This is a very light weight laptop 1” thin and 3.1 lbs with 10.6” WXGA TFT screen. It has Intel Pentium M 1.0 Ghz processor and 500 Mbyte main memory. I extended the main memory size to 1 Gbyte. Because business traveling is part of my job, I selected this light and small laptop to replace my old and heavy HP Pavilion Zt3000 in summer 2005. It turned out to be a very good decision. This Sony Laptop has accompanied me traveling to so many cities to present and meet with many Sun customers. Starting in 2006, I decided to install Solaris 10 to this laptop to make it a dual boot system. I kept upgrading it with the later Solaris releases. Now it is installed with the early access of Solaris Express, Developer Edition.

Although the initial Solaris installation was a little harder than what I expected, the later release upgrades turned out to be quite simple for me. It usually took me 100 minutes to upgrade to a new Solaris release. The reward from the Solaris installation is definitely worth the effort I put in. Now I spend more time in Solaris than Windows on this laptop. Actually I wrote and edited this blog on my Solaris laptop. The Solaris desktop environment is bundled with many utility and application tools. For example I used the Solaris GIMP image editor to edit and create the desktop wallpaper as shown in the picture below.

No doubt, the latest Solaris express release simplifies the installation process significantly. However some installation problems I encountered are machine dependent and may be too hard for the average users to solve. If you have a similar Sony laptop, you can follow the instructions here to fix the problems. Because my laptop has an odd 1280x768 screen size, the biggest challenge I encountered is to extend the Solaris image to the full screen size. The screen side problem is caused by a defect of Intel video device driver for its 855 graphics chip. The device driver doesn't work correctly for either Solaris or Linux. The video table doesn't contain the right screen resolution setting of 1280x768. Therefore even the right screen configuration in xorg.conf file still cannot make Solaris work to the full screen size. A video driver program called 855resolution is required to patch the video device driver. The program 855resolution was developed by Alain Poirier for Linux initially. Kentaro A. Kurahone ported it from Linux to Free BSD. I searched the internet and followed a couple people's advice (Mario Hakansom is one of them) to port the program from FreeBSD to Solaris and build it with Sun Studio Compiler. You can download the Solaris 855resolution package tar file 855res.tar here. The tar file includes the README file, the binary and the source code. You can follow the instructions to use the binary directly without re-building it.

The second problem is the the external display. I used this laptop to present my talks quite often, It is important to be able to plug-in an external projector to the laptop and display the computer image in the big screen at any time. I had ported a i855crt package from Linux to Solaris to solve this problem for the earlier Solaris version.But I no longer need this display driver now. Somehow the later Solaris Nevada Express releases starting from build 46 fixed the problem. Definitely you also need to have the right xorg.conf setting to make the external display work. My xorg.conf is included in the above Solaris 855resolution package. But you can also download the individual file xorg.conf here.

The third problem of configuring the wireless connection is relatively easy but a little tedious. First thing is to download Intel wireless device driver iwi 0.5 package from OpenSolaris community Intel wireless driver page After you install the Intel wireless device driver, The next step is to run wificonfig command in super user mode. My home wireless connection has WEP encryption, it is more convenient for me to just create a wireless profile for home usage. Here is the command: wificonfig createprofile <ProfileName> essid=<ID> encryption=WEP wepkey1=<password>. After the profile is created. You can run the following two commands in super user mode to complete the wireless configuration: (1) wificonfig -i iwi0 connect Profile_name (2) ifconfig iwi0 dhcp. The above steps should enable the wireless connection on your Solaris laptop. However your laptop may still not be able to access internet. The problem is caused by domain name resolution. First step to resolve DNS problem is to edit the file /etc/nsswitch.conf by adding “dns” after “files” in the line beginning with hosts:. The second step is to find out what is domain name and domain name server IP address of your home internet connection. You can find out the information easily by looking at the network connection property of the other Windows computer. Then you can edit the file /etc/resolv.conf to add the lines of domain dmain_name and nameserver name_server_IP_address. The easier way for the second step is to run Solaris network configuration tool from Start> Administration > Network. It will prompt you to enter root password first. After that, you can select “Wireless connection” from the main panel and click “DNS” tab to enter your DNS domain and name server IP addresses.

I really like my Solaris laptop and it is a very productive environment for me. The Solaris express is bundled with staroffice 8 for the design document writing and slide presentation. It is also bundled with Sun Studio and NetBeans for me to develop my program anywhere I like. Recently I just installed SAMP stack and played with it by writing a simple web application on my laptop. I was shocked by how much I can do with the PHP and MySQL in a very short time. That may be another interesting topic I should talk about next time.

Tuesday Jun 27, 2006

What Can Software Developers Learn From Hardware Designers?

Conventionally software development methodology and tools lead the hardware design counterparts. Many hardware designers look for the solution or new tool ideas from the software design territory. For example when the chip transistor count increases, the hardware designers can no longer afford designing and simulating their designs at transistor or gate abstraction level. The hardware people took many language constructs from C/C++ programing and introduced Verilog for RT and Behavioral level design representations. With the increasing computing concurrency and horizontal scalability in latest software development, it may be time for software developers to learn something from the existing hardware design domain. When an engineer faces the concurrent threads or logic devices, one big challenge is to avoid race condition problems. In hardware logic simulation, one main functionality is to assign unknown logic value to a logic node when logic contention occurs at the node. In multi-threaded programming, a shared memory location may suffer logic contention when one thread write a data different from the data read or written by another thread at the memory location. Data race detection tool in the upcoming Sun Studio express release will perform run-time checking to detect a potential data race condition problem in a OpenMP or MT program. Hardware designers also apply static timing analyzer, logic checker and formal proof to detect the critical timing and design logic faults statically. LockLint from Sun Studio is a similar static checking tool in software developer tool space. However there can be more powerful static software developer tools to detect race condition, parallel scalability bottleneck and distributed computing communication issues. No doubt the static software tools will be more complex than the hardware tools. For example, Binary Decision Diagram (BDD) is an important infrastructure to represent the hardware circuitry efficiently for formal verification. This kind of efficient logic representation cannot be done for software programs. Furthermore it is extremely hard to do sufficient data dependency analysis for a C/C++ program with pointers and template. However some software researchers begin to learn from the hardware design formal verification techniques to design new software tools. Debugging is a big challenge for distributed computing software which ranges from MPI applications to SOA world. A traditional software debugging tool become inadequate in dealing with the many concurrent processes interacting among one another. It is very hard to setup a software environment to halt and control many concurrent processes and also have transparency to look into the process states. Design For Testability DFT methodology and the related tools have a long history in hardware design world. It will not be surprising to me that software developer community embrace DFT to meet the debugging need of distributed computing software in the near future.

Thursday Jan 05, 2006

When Artificial Intelligence Became Smarter than Human Brain

I read a book “The Singularity Is Near: When Humans Transcend Biology” by Ray Kurzweil recently. The book mentions the time of artificial intelligence being smarter than human brain will come in just 2-3 decades due to the exponential technology growth rate. Personally I think the prediction is too optimistic. However my real question is whether this thing is good to human society and civilization. The golden grail of computer science is to make the computer create and self-improve the program automatically. But every few people fully know the consequence when the computing machines became smarter than humans. I just ponder on the simple case of doing my job. As a software architect I feel thrilled to have the machine designing, implementing and delivering my dream products automatically. Even better, the machine could improve my architecture plan, the product concept and marketing strategy. This will lead to the very critical issue of judgment and belief. My job requires me to judge the future technology and business trend, come out the product plan and execute the plan with full belief. When a computer threw me a different product plan, how could I convince myself it is definitely a right plan and permit the computer to act on it? If the machine was more powerful than me, it surely could ignore my objection and still proceed. Then the situation of Terminator movie became not so obscure. Therefore humans need to engrave some machine ethic rules on all the future intelligent computers. One of the ethic rules is to obey the human master(s) always. This comes back to the judgment issue again. The inferior intelligent humans make the final call. Therefore the ultimate progress is still bound by the inferior intelligence. This is not good but acceptable. The fundamantal issue is the required absolute perfectness of the machine ethic rules regulation. A trivial defect or violation of the regulation would cascade exponentially to become a singular moment of destroying the entire human society. I also call that “The Singularity Is Near”.



« October 2016