Sun Java Solaris Communities My SDN Account Join SDN
 
Article

Solaris Developer Chat Sessions

 
 

Solaris Live Transcripts Index

November 16, 2000

Chat Title: Getting the Most Out of Compilers (CC) in a Multi-Threaded Environment
Guest Speaker: Krishna Ramachandran, Ph.D

This is a moderated forum

LizA: Hello, and welcome to Solaris Live Online Chat. Our guest is Krishna Ramachandran, Ph.D, a staff engineer at Sun. Krishna has several years experience in porting and tuning apps to Solaris and SPARC. He has developed algorithms for multi-threading and parallel processing for Solaris and other UNIX platforms.

LizA: Krishna, let me open the Chat by asking, "What are the recommended strategies for tackling C++ compile/run time performance problems?"

Krishna: LizA, It is best to use Sun's latest set of compilers/tools (forte6_update1). Let me address the compile time issue first, try adding +d flag. This turns off front end inlining. In some extreme cases inlining can cause huge code bloats ...

Krishna: If your template instantiation model can bypass the use of template repositoryit will be helpful. All instances of template instantiations are placed inSunWS_cache directory. Repository management takes bulk of compilation.

Krishna: -instance=explicit, global, static all bypass the repository. As for runtime performance, using optimization options like -fast (a macro) is very efficient for compultationally intensive applications.

Krishna: Also, for applications that make heavy use of iostreams can take advantage of -library=iostream option which uses classic iostream and performs faster. Other standard strategies like profiling the application, monitoring the system performance via utilities like mpstat, vmstat will identify bottlenecks. There a very recent and efficient collector/analyzer tool that is currently available with Forte6 will accurately pinpoint the time spent in various functions and libraries for multi-threaded codes. This tool can be invoked via the dbx or the workshop GUI tool.

gil: What is compat mode in Workshop/Forte 6 for C++?

Krishna: Gil, -compat=4 mode invokes a C++ ABI which provides binary compatibility with older releases of sun compilers like WorkShop4 (C++ version 4 and SC4.2.) By default, if nothing is specified one gets ABI 2 which is ANSI compliant mode.

CraigD: I need an STL. Where do I get it? Is there one for -compat mode?

Krishna: Sun officially, supports STL only in standard mode that is -compat=5. But one can plug in many of available STLs. The most popular STL STLport, works with our compilers in both modes. While using a different STL in standard or default mode an additional flag -library=no%Cstd, iostremas has to be used to avoid conflicts and to invoke the classic iostreams.

LizA: Krishna, what is compat mode in WorkShop/Forte6? and what is alternate libthread and how does it help applications?

Krishna: Solaris 8 and higher versions supports/will support a second threads library in addition to the conventional /usr/lib/libthread.so. This alternate model is available on Solaris 8 under /usr/lib/lwp and one can invoke this version simply by setting the environment variable LD_LIBRARY_PATH to point to this library. That is LD_LIBRARY_PATH=/usr/lib/lwp; export LD_LIBRARY_PATH. Briefly, this library uses 1x1 scheduling model as opposed to the mxn model one gets with /usr/lib/libthread.so. Since, both versions support identical threads library APIs (including POSIX) user need not make any code level modification to use one or the other.

Krishna: As for performance benefits?It is very application dependent. We have seen huge performance increments for certain applications that show a lot of contention on schedlock it is hard to accurately say which one is better and when.

gil: How can I figure out which patches exist and what problems are solved in the current patches?

Krishna: Gil, for the most up-to-date information check, www.sun.com/workshop/users/ws.html. They can also be downloaded from http://sunsolve.sun.com

gil: Do I need to have patches to libC.so.5 and libCrun.so.1?

Krishna: Gil, Typically, Solaris versions ship with the recent versions of these libraries. But whenever a bug fix or a performance fix occurs these libraries are patched.So it is good idea to grab the latest patch for these libraries. The package is called SUNWlibCx and SUNWlibC. There are 32 and 64 bitversions of these patches

CraigD: How do I get a stdlib that is fully compliant? Or, what functionality does the current libCstd not support?

Krishna: CriagD, The current libCstd, is compatible with the one that was shipped originally with workshop 5. Some of the functionality that are not supported are mainly in container classes that have conmstructor templates allowing implicit type conversion.

LizA: Thanks, Krishna. We've reached the end of our time. Are there anycomments you want to make in conclusion?

Krishna: In conclusion, I would highly recommend migrating to Solaris 8 and use most recent of oru workshop tools (forte6_update1). Identify if the bottleneck is on the user code or the time spent in the kernel using simple and less intrusive utilities like vmstat and mpstat. If bulk of the time is in the user functions, use the collector/analyzer tool to identify "hot" functions and explore if multi-threading can be explored...

Krishna: If the bulk of the time is spent in kernel, contending on a resource like file IO or a lock identify the lock via lockstat, dbx and explore if using alternate libthread would help for lock contention related bottlenecks.Otherwise look into other IO possibilities like mt IO, async. io or direct IO Thanks again!!!

LizA: Thank you....

November 2000


Back to Top