Subscribe via RSS
create your own banner at mybannermaker.com!

Sun Studio 12 Update 1 Unleashed


Sun Studio software provides compilers and tools for C, C++, and Fortran development on Solaris, OpenSolaris, and Linux platforms, with support of multicore x86- and SPARC-based systems. The release of a new version of Sun Studio is always an exciting moment for Sun Studio enthusiasts. Sun Studio 12 came out pretty much two years ago, and a lot has changed in that time.

Sun has just released the Sun Studio 12 Update 1 which focuses more on improving performance through parallelism. Sun studio is a set of compilers, tools and libraries, similar to GCC (Gnu Compiler Collection), for developing applications in C, C++ and FORTRAN. You can use it to develop applications for Linux, Solaris and Open Solaris operating systems or rather x86 or SPARC platforms. The latest production release includes improved binary application performance, full OpenMP 3.0 support, profiling of distributed MPI applications, unified application and system profiling using Solaris DTrace technology (DLight), a new standalone graphical debugger (dbxTool) and much more.


It comes with:

  1. C/C++/Fortran compilers and support libraries
  2. The Sun Studio IDE based on NetBeans
  3. dbx command-line and GUI based debuggers
  4. Performance Analyzer
  5. Thread Analyzer
  6. Sun Performance Library
Traditionally developers use GCC as their favorite tool. It’s true that one can’t forget GCC, but evolution is unavoidable, new and better tools keep coming and it’s good for us to upgrade than to stick to old tools. Sun Studio 12 boasts a boatload of new features, but in particular the new graphical IDE really stands out. Sun Studio is now a great development tool for command-line programmers and those who have never worked outside a GUI.

Graphical capabilities have been added and more issues can be detected than before. A visual profiling tool based on Dynamic Tracing technology in Solaris is featured.

The tools package, which is offered free of charge with optional support plans available, can be used to build applications for OpenSolaris, Solaris, and different forms of Linux on Intel, AMD, and Sun Sparc chips.

Also featured is improved performance and optimizations for delivering optimized code for Solaris. The update also supports libraries and tools from the OpenMP 3.0 API specification, featuring capabilities for scheduling and synchronization to control code execution.

Let’s first look at the features provided by Sun Studio and how it is better than GCC.

New Features:

  • C, C++ and Fortran Compilers: Optimizing compilers, with auto-parallelization features and OpenMP 3.0 directives, for Intel x86, AMD x86, Sun UltraSPARC and Fujitsu SPARC64-based systems. Numerous SPEC world records have been announced with OpenSolaris on the latest Sun platforms.

  • Debuggers: Multi-thread aware code-level and memory debuggers available via the command-line, IDE and new standalone graphical debugger dbx

  • Thread Analyzer: Thread analysis tool that identifies race and deadlock conditions in multithreaded code. The Thread Analyzer can detect data races that occur in code that is written using the POSIX thread API, Solaris OS thread API, OpenMP directives, Sun parallel directives, Cray parallel directives or a mix of these.

  • Performance Analyzer: Application profiling and analysis tool that identifies performance hotspots in single, multithreaded and distributed MPI applications. The Performance Analyzer collects data using timing metrics, hardware counters, memory allocation metrics and synchronization delay metrics. It enables profiling of production codes without recompiling.

  • DLight: New tool that unifies applications and system profiling using DTrace (dynamic tracing) technology on Solaris / OpenSolaris platforms
DTrace GUI in OS X 10.5 Leopard

  • Compiler, debugger and profiling support for OpenMP 3.0

  • New Next-Generation IDE based on NetBeans 6.5.1: Based on the NetBeans project, an advanced IDE specifically geared for C/C++ developers. It offers dynamic language-aware editor (code completion, syntax highlighting, code folding, etc.), dynamic class-browser and Makefile support - all geared toward improving developer productivity in writing code
"Sun Studio 12 Update 1 software is not only significant in helping developers take applications to the next level of performance, but it is also leading the industry with tooling that allows developers to more easily create parallel and concurrent software applications on today's and tomorrow's platforms," said Jim McHugh, Sun's vice president of data center software marketing. "With more than 20,000 developers participating in our Express and Early Access programs, this release is full of functionality driven by and for the developer community."
One particular trend has been that multicore processors have become mainstream. One way of illustrating that is to look at the number of threads per chip for all the submitted SPEC® CPU2006 integer speed results. The following chart shows the cumulative number of submitted results since the benchmark came out in 2006 until the middle of June 2009 broken down by the number of threads that the chip could support.

The relevance of this chart to Sun Studio is that Sun Studio has always been a tool that supports the development of multi-threaded applications. Every release of the product improves on the support in the previous release. Sun Studio 12 Update 1 includes improvements in the compiler's ability to automatically parallelise codes - afterall the easiest way to develop parallel applications is if the compiler can do it for you; improvements to the support of parallelisation specifications like OpenMP, this release includes support for the latest OpenMP 3.0 specification; and improvements in the tools and their ability to provide the developer meaningful feedback about parallel code, for example the ability of the Performance Analyzer to profile MPI code.

Sun™ Studio 12, which includes a NetBeans™-based integrated development environment (IDE), simplifies the development of applications on the newest multi-core SPARC® and x86/64-based systems. In addition, Sun Studio 12 provides C, C++ and Fortran compilers and an advanced suite of static and dynamic tools for memory debugging, application profiling and multi-core optimizations, as well as libraries targeting the high performance market. Sun is collaborating closely with both Intel and AMD to ensure that Sun Studio compilers and libraries take full advantage of the Quad-Core AMD Opteron™ processor, code-named "Barcelona" and the Intel® Xeon® processor 5300 series.

Comparing performance of Sun Studio with GCC: An article written by Vijay Tatkar here shows that Sun Studio generates at least 80% more optimized code than its GCC counterpart.

Higher number is Better and so also in the Ratio's column, a ratio > 1 means SunStudio is better than GCC


Test

GCC4.1

SunStudio11

Ratio(SS11/GCC)

Numeric Sort

12.68

10.63

0.84

String Sort

16.07

20.93

1.30

Bitfield

15.15

16.15

1.06

FP Emulator

14.46

31.77

2.19

Fourier

11.69

25.55

2.19

Assignment

37.59

25.11

0.67

Idea

18.52

32.87

1.77

Huffman

15.10

17.02

1.13

Neural Net

24.87

33.98

1.37

Lu Decomposition

45.55

50.20

1.10

Memory Index

20.78

20.397

0.98

Integer Index

15.09

20.844

1.39

FP Index

23.772

35.190

1.48


Conclusion: Sun Studio is far ahead in terms of performance optimization, leveraging the power of multi processor and multi threaded machines. It also comes with numerous tools for performance and thread analysis. Its distributed make system takes building software a step ahead.

Install Sun Studio 12 (includes CC) on a Linux Operating System

1) Go to http://developers.sun.com/sunstudio/downloads/index.jsp and join the Sun Developer's Network (SDN).

2) Now select to download Sun Studio.

3) Select to Download the Product Tar file.

4) If the login windows pops up, enter your SDN user's name and password.

5) Accept the license and download both the x86 Linux Sun Studio 12 installation tar file and system preparation tool.

6) Right click on the Sun Studio installation tar file and open it with the archive tool; extract it to a subdirectory (suggest "sun") in your home directory (this may take a while).

7) Right click on the system preparation tool tar file and open it with the archive tool; extract it to a subdirectory in your home directory; execute the following commands.

a) To list the missing software
./prepare_system -C
b) To install the missing software
  • on Ubuntu or other Debian Linux distribution
sudo ./prepare_system -s missing_software_name,missing_software_name,...
  • on Red Hat, Centos or Fedora
su
./prepare_system -s missing_software_name,missing_software_name,...
exit
8) Finally, go to /usr/bin and make the following links (Note: "sun" is the name of the directory that you created in your home directory during step #6):
  • on Ubuntu or other Debian Linux distribution
sudo ln -s ~/sun/sunstudio12/bin/sunstudio
sudo ln -s ~/sun/sunstudio12/bin/CC
  • on Red Hat, Centos or Fedora
su
ln -s ~/sun/sunstudio12/bin/sunstudio
ln -s ~/sun/sunstudio12/bin/CC
exit
9) Test the compiler and link by :
CC -version
10) Test Sun Studio by :
sunstudio
You can make a launcher with this command as well.

Ubuntu, Red Hat, Fedora and CentOS come with the gedit program compiler, which is a very decent basic programming editor. Check out "Edit, Preferences" to set it up the way you want it.

On Ubuntu, nedit may be installed using apt-get with the command
sudo apt-get install nedit
or by the following instructions (which work for any Linux distribution).

If you wish, you can download nedit stable binaries from http://www.nedit.org/download.php. After the download, use the archive manager to extract it to a subdirectory in your home directory. Finally, go to /usr/bin and create the following link (note: "###" is whatever the rest of the nedit directory is named)
  • on Ubuntu or other Debian Linux distribution
sudo ln -s ~/nedit-###/nedit
  • on Red Hat, Centos or Fedora
su
ln -s ~/nedit-###/nedit
exit
  • Test it by typing
nedit
Installing Sun Studio 12 on OpenSUSE 11

Sun Studio 12 Compile Times

Here are some results I did on a test compiling MySQL 5.0.41 with Sun Studio 12 vs GCC 3.4.5. This was on a x4100.

Single threaded test:

GCC 3.4.5:

# time make
real 8m36.944s
user 6m53.556s
sys 1m24.685s

Sun Studio 12:

# time dmake
real 6m54.376s
user 9m34.147s
sys 2m3.422s

Conclusion: Sun Studio 12 owns.

Here are some other results of a threaded compile with Sun Studio 12 just to show off:

# time dmake -j 8
real 6m11.507s
user 9m44.306s
sys 2m17.845s

# time dmake -j 4
real 5m52.583s
user 9m52.261s
sys 2m16.401s

4 threads is the sweet spot which is the number of CPU’s in the system.

Exploring -xO1 on the Sun Studio 12 C compiler

Investigating the "-xO1" optimization flag on a test program, I found that the generated code didn't quite made much sense to me. Here's the code I used for the test:
#include
#include
struct test {
int i1;
int i2;
int i3;
};

int test(struct test* p) {
{
p->i1 += p->i1;
p->i2 += p->i2;
p->i3 += p->i3;
if ( p->i1 > 0 ) goto newtest;
}

{
/*
p->i1 += p->i1;
p->i2 += p->i2;
p->i3 += p->i3;
*/
if ( p->i2 > 0 ) goto newtest;
}

newtest:
printf("here i am");
}

int main(int argc, char** argv) {
int index = atoi(argv[1]);
struct test *t = malloc(sizeof(struct test));
t->i1 = 1;
t->i2 = t->i1+1;
t->i3 = t->i2+1;
test(t);
return (EXIT_SUCCESS);
}
Compiling the above code under "-xO1", I found that the generated code for the function "test" was puzzling. Concentrate on the line 23
9. int test(struct test* p) {

[ 9] 8050a74: pushl %ebp
[ 9] 8050a75: movl %esp,%ebp
[ 9] 8050a77: subl $8,%esp
10. {
11. p->i1 += p->i1;
[11] 8050a7a: movl 8(%ebp),%ecx
[11] 8050a7d: movl (%ecx),%eax
[11] 8050a7f: addl %eax,%eax
[11] 8050a81: movl %eax,(%ecx)
12. p->i2 += p->i2;
[12] 8050a83: movl 8(%ebp),%ecx
[12] 8050a86: movl 4(%ecx),%eax
[12] 8050a89: addl %eax,%eax
[12] 8050a8b: movl %eax,4(%ecx)
13. p->i3 += p->i3;
[13] 8050a8e: movl 8(%ebp),%ecx
[13] 8050a91: movl 8(%ecx),%eax
[13] 8050a94: addl %eax,%eax
[13] 8050a96: movl %eax,8(%ecx)
14. if ( p->i1 > 0 ) goto newtest;
[14] 8050a99: movl 8(%ebp),%eax
[14] 8050a9c: cmpl $0,(%eax)
[14] 8050a9f: jg .+9 [ 0x8050aa8 ]
15. }
16.
17. {
18. /*
19. p->i1 += p->i1;
20. p->i2 += p->i2;
21. p->i3 += p->i3;
22. */
23. if ( p->i2 > 0 ) goto newtest;
[23] 8050aa1: movl 8(%ebp),%eax
[23] 8050aa4: cmpl $0,4(%eax)
24. }
25.
26. newtest:
27. printf("here i am");
[27] 8050aa8: subl $0xc,%esp
[27] 8050aab: pushl $0x8050b40
[27] 8050ab0: call printf [ 0x805091c, .-0x194 ]
28. }
[28] 8050ab5: leave
[28] 8050ab6: ret
Considering the semantics of the "goto", you would agree that the code sequence generated for line 23 would be redundant.
23. if ( p->i2 > 0 ) goto newtest;
[23] 8050aa1: movl 8(%ebp),%eax
[23] 8050aa4: cmpl $0,4(%eax)
Probably a peephole optimization is needed.

Support Services for Developers

Sun offers a tiered set of support services for developer software, including Sun Studio software, which ranges from single incident to comprehensive developer plans. In addition, with a broad portfolio of training and certification offerings, developers can enhance their skillsets to take advantage of cutting-edge technologies. To learn more, please visit http://developers.sun.com/services.

Sun is "collaborating closely" with AMD and Intel - the latter announced its status as a Sun hardware partner at JavaOne last month- to ensure Studio 12 works on their respective multi-core Barcelona and Woodcrest chip architectures.

"We have this visual experience that you don't get with the tools around GCC," Jeet Kaul, developer partner veep, told The Register. "Eclipse has a comparable visual experience, but doesn't have the performance or multithreading."

For all its talk of supporting GNU/Linux and AMD and Intel, Sun obviously wants application developers to target Solaris and Sparc. That means Studio 12 should be seen as a gateway IDE, to help developers slowly move across. "[Studio 12] opens up the Solaris market to all the Linux developers out there," according to Kaul.

"This is the same IDE and compilers running on Sparc, Opteron, Woodcrest and different versions of Linux. You can move back and forth between all those systems quite easily," he said.

But how successful will Sun be in convincing non-Solaris developers to build for Sun as well as for Linux? In light of the trend for users to abandon Unix for Linux, the notion that Studio 12 will propel many non-Sun shops to migrate fully to Solaris seems somewhat fanciful.

About Sun Microsystems, Inc.

A singular vision - "The Network Is The Computer"™ - guides Sun in the development of technologies that power the world's most important markets. Sun's philosophy of sharing innovation and building communities is at the forefront of the next wave of computing: the Participation Age. Sun can be found in more than 100 countries and on the Web at sun.com.

Sun Studio 12 is available now as a free download here . The company is offering a tiered set of support services for the software, ranging from single-incident to comprehensive developer plans. You can even stand a chance to win $500 by just sharing you experience about Sun Studio.

[ Download Sun Studio 12 ]

Stumble
Delicious
Technorati
Twitter
Digg
Facebook
Reddit

0 Comments:

Post a Comment

ads by affiliateindian
 

www.vavuni.tk Copyright © 2010 Designed by Shankar