What's New in Sun WorkShop 6 update 1 | ![]() ![]() ![]() ![]() ![]() |
New Features in Sun WorkShop 6 update 1
This chapter describes the new features of the Sun WorkShopTM 6 update 1 compilers and tools. The primary focus of this release is improved performance on the UltraSPARCTM III processor.
Each updated Sun WorkShop component has a section that includes a table that summarizes the new features. Explanations of some new features follow the summary tables.
This chapter has the following sections:
- C Compiler
- C++ Compiler
- Fortran Compilers
- Interval Arithmetic
- dbx
- Sun Performance Library
- Sampling Analyzer
C Compiler
TABLE 1-1 lists the new features available with the Sun WorkShop 6 update 1 release of the C compiler. Some of the features are described in greater detail in the sections following the table.
TABLE 1-1 C Compiler New Features Support for the UltraSPARC III Processor -xtarget
-xchipThe -xtarget
and-xchip
options now acceptultra3
. See the following discussion for the recommended flags to use for optimal UltraSPARC III performance.Optimizing Through Type-Based Analysis -xalias_level
The C compiler now accepts options and pragmas which allow it to perform type-based alias analysis and optimizations. Enhancing Math Routine Performance With New Pragmas __MATHERR_ERRNO_DONTCARE
cc -fast
now expands to include the macro__MATHERR_ERRNO_DONTCARE
. This macro causesmath.h
in the Solaris 8 operating environment to assert performance-related pragmas for some of the math routines prototyped inmath.h
.Inlining Standard Library Functions -xbuiltin
Use this command to improve performance of generated code through substitution of intrinsics, or inlining, of standard library functions where the compiler determines it is profitable. Enabling and Disabling Trigraph Recognition -xtrigraphs
The new -xtrigraphs
option enables and disables trigraph translation.Prefetch Latency Specifier -xprefetch=
...,latx:
factorThis new suboption determines how far apart the instruction the compiler generates to prefetch data will be from the subsequent use of the data in a load or store instruction. Overriding the Default Search Path With the -I- Option -I-
The new -I-
option gives you more control over the algorithm that the compiler uses when searching for include files.
Support for the UltraSPARC III Processor
Use the following options to compile for optimal performance when compiling and running your program on an UltraSPARC III processor:
-fast -xcrossfile -xprofile={collect:|use:}
- For cross-compilation (compiling on a platform other than UltraSPARC III but generating object binaries to run on an UltraSPARC III system), add the following options to insure correct cache sizes and optimization strategies:
-xtarget=ultra3 -xarch={v8plusb|v9b}
- Specify
-xarch=v8plusb
for 32-bit code generation andv9b
for 64-bit code. For programs accessing very large data files, 64-bit code provides better performance. However,-xarch=v9b
should only be used when 64-bit code generation is required. In some cases it can result in slower performance.- The
-fast
option enables optimizations that favor speed of execution and raises the optimization level to-xO5
. Note that-fast
allows substitution of faster arithmetic operations where possible (-fsimple=2
), so some inaccuracies might result.-xcrossfile
enables the compiler to apply optimizations across all the source files specified on the command line, including some interprocedural optimizations.-xprofile={collect:|use:}
enables program performance profiling. Profiling allows the compiler to identify the most frequently executed sections of code and to perform localized optimizations to best advantage.
Note Programs compiled specifically for the UltraSPARC III platform with-xarch={v8plusb|v9b}
will not operate on platforms other than the UltraSPARC III platform. Use-xarch={v8plusa|v9a}
to compile programs to run compatibly on UltraSPARC I, UltraSPARC II, and UltraSPARC III platforms.
Optimizing Through Type-Based Analysis
You can use the new
-xalias_level
C compiler command and several new pragmas to enable the compiler to perform type-based alias analysis and optimizations. Use these extensions to express type-based information about the way pointers are used in your C program. The C compiler uses this information, in turn, to do a significantly better job of alias disambiguation for pointer-based memory references in your program.For more information on this new compiler command, see the C User's Guide Supplement available from
http://docs.sun.com
(in the ForteTM Developer 6 update 1/Sun WorkShop 6 update 1 Collection).Enhancing Math Routine Performance With New Pragmas
Now when you issue the
-fast
option, the macro__MATHERR_ERRNO_DONTCARE
is defined. This macro causesmath.h
in the Solaris 8 operating environment to assert performance-related pragmas such as the following for some math routines prototyped in<math.h>
:
#pragma does_not_read_global_data
#pragma does_not_write_global_data
#pragma no_side_effect
If your code relies on the return value of
errno
in exceptional cases as documented in thematherr
(3M) man page, you must turn off the macro by issuing the-U__MATHERR_ERRNO_DONTCARE
macro after the-fast
option.Inlining Standard Library Functions
Use the
-xbuiltin[=%all|%none]
command when you want to improve the optimization of code that calls standard library functions. Many standard library functions, such as the ones defined inmath.h
andstdio.h
, are commonly used by various programs. This command lets the compiler substitute intrinsic pure functions for system functions to improve performance. The-xbuiltin
command has the following syntax:
-xbuiltin=%all
-xbuiltin=%none
The first default of this command is
-xbuiltin=%none
, which means no functions from the standard libraries are inlined. The first default applies when you do not specify-xbuiltin
.The second default is
-xbuiltin=%all
, which means the compiler inlines standard library functions as it determines the optimization benefit. The second default applies when you specify-xbuiltin
but do not provide an argument.If you compile with the
-fast
option, then-xbuiltin
is set to%all
.Enabling and Disabling Trigraph Recognition
The
-xtrigraphs
option determines whether the compiler recognizes trigraph sequences as defined by the ISO/ANSI C standard.By default, the compiler assumes
-xtrigraphs=yes
and recognizes all trigraph sequences throughout the compilation unit.If your source code has a literal string containing question marks (
?
) that the compiler is interpreting as a trigraph sequence, you can use the-xtrigraph=no
suboption to turn off the recognition of trigraph sequences. The-xtrigraphs=no
option turns off recognition of all trigraphs throughout the entire compilation unit.Consider the following example source file named
trigraphs_demo.c
.
#include <stdio.h>int main (){(void) printf("(\?\?) in a string appears as (??)\n");return 0;}Here is the output if you compile this code with
-xtrigraphs=yes
.
example%cc -xtrigraphs=yes
trigraphs_demo.c
example%a.out
(??) in a string appears as (]Here is the output if you compile this code with
-xtrigraphs=no
.
example%cc -xtrigraphs=no
trigraphs_demo.c
example%a.out
(??) in a string appears as (??)For more information on using the
-xtrigraphs
option, see thecc
(1) man page. For information on trigraphs, see the C User's Guide chapter about transitioning to ANSI/ISO C.Prefetch Latency Specifier
(SPARC platform) If you are running computationally intensive codes on large multiprocessors, you might find it advantageous to use the new
-xprefetch
suboptionlatx:
factor. This suboption instructs the code generator to adjust the default latency time between a prefetch and its associated load or store by the specified factor.For more information, see the
cc
(1) man page.Overriding the Default Search Path With the
-I-
OptionThe new
-I-
option gives you more control over the algorithm that the compiler uses when searching for include files. This section first describes the default search algorithms, then it describes the effect of-I-
on these algorithms.Default Search Algorithm for Quote-Included Files
For statements of the form
#include
"foo.h"
(where quotation marks are used), the compiler searches for include files in the following order:
- The current directory (that is, the directory containing the "including" file)
- The directories named with
-I
options, if any- The
/usr/include
directoryDefault Search Algorithm for Bracket-Included Files
For statements of the form
#include
<foo.h>
(where angle brackets are used), the compiler searches for include files in the following order:Using the
-I-
Option to Change the Search AlgorithmThe new
-I-
option gives more control over the default search rules. When-I-
appears in the command line:
- The compiler never searches the current directory, unless the directory is listed explicitly in a
-I
directive. This effect applies even for include statements of the form#include
"foo.h"
.- For include statements of the form
#include
"foo.h",
the compiler searches for include files in the following order:- For include statements of the form
#include
<foo.h>,
the compiler searches for include files in the following order:The following example shows the results of using
-I-
when compilingprog.c
.
The following command shows the default behavior of searching the current directory (the directory of the including file) for include statements of the form
#include
"foo.h"
. When processing the#include
"c.h"
statement ininc/a.h
, the preprocessor includes thec.h
header file from theinc
subdirectory. When processing the#include "c.h"
statement inprog.c
, the preprocessor includes thec.h
file from the directory containingprog.c
. Note that the-H
option instructs the compiler to print the paths of the included files.
example%cc -c -Iinc -H prog.c
inc/a.hinc/c.hinc/b.hinc/c.hc.hThe next command shows the effect of the
-I-
option. The preprocessor does not look in the including directory first when it processes statements of the form#include
"foo.h"
. Instead, it searches the directories named by the-I
options in the order that they appear in the command line. When processing the#include "c.h"
statement ininc/a.h
, the preprocessor includes the./c.h
header file instead of theinc/c.h
header file.
example%cc -c -I. -I- -Iinc -H prog.c
inc/a.h./c.hinc/b.hinc/c.h./c.hFor more information, see the entry for
-I-
in thecc
(1) man page.C++ Compiler
TABLE 1-2 lists the new features available with the Sun WorkShop 6 update 1 release of the C++ compiler (5.2). Some of the features are described in greater detail in the sections following the table.
TABLE 1-2 C++ Compiler New Features Support for the UltraSPARC III Processor -xtarget
-xchipThe -xtarget
and-xchip
options now acceptultra3
. See the following discussion for the recommended flags to use for optimal UltraSPARC III performance.Compile-Time Performance The compiler is substantially faster for many large programs, particularly those that use templates heavily. Lifetime of Temporary Objects -features=tmplife
(Standard mode only) A new -features=tmplife
suboption instructs the compiler to destroy temporary objects according to the requirements of the C++ standard.Overriding the Default Search Path With the -I- Option -I-
The new -I-
option gives you more control over the algorithm that the compiler uses when searching for include files.Interval Arithmetic Support for C++ -xia
-library=[no%]interval(SPARC platform) This release of the C++ compiler provides a C++ interface to the interval arithmetic library. Mixed-Language Linking -xlang
-staticlibThe new -xlang
option enables linking of mixed Fortran and C++ object files.Enabling and Disabling Trigraph Recognition -xtrigraphs
The new -xtrigraphs
option enables and disables trigraph translation.Filtering Linker Error Messages -filt
The new -filt
option allows you to customize the filtering of linker error messages. For example, you can request mangled names.Shared libCstd A shared version of libCstd
is available in thelib
directory of the C++ compiler.Shared libiostream A shared version of libiostream
is available in thelib
directory of the C++ compiler.Optimization Pragmas The C++ compiler recognizes the new optimization pragmas no_side_effects
andreturns_new_memory
.Recognition of .c++ Extension The C++ compiler now recognizes .c++
as a valid filename suffix.Prefetch Latency Specifier -xprefetch=
...,latx:
factorThis new suboption determines how far apart the instruction the compiler generates to prefetch data will be from the subsequent use of the data in a load or store instruction.
Support for the UltraSPARC III Processor
Use the following options to compile for optimal performance when compiling and running your program on an UltraSPARC III processor:
-fast -xcrossfile -xprofile={collect:|use:}
- For cross-compilation (compiling on a platform other than UltraSPARC III but generating object binaries to run on an UltraSPARC III system), add the following options to insure correct cache sizes and optimization strategies:
-xtarget=ultra3 -xarch={v8plusb|v9b}
- Specify
-xarch=v8plusb
for 32-bit code generation andv9b
for 64-bit code.-xarch=v9b
should only be used when 64-bit code generation is required. In some cases it can result in slower performance.- The
-fast
option enables optimizations that favor speed of execution and raises the optimization level to-xO5
. Note that-fast
allows substitution of faster arithmetic operations where possible (-fsimple=2
), so some inaccuracies might result.-xcrossfile
enables the compiler to apply optimizations across all the source files specified on the command line, including some interprocedural optimizations.-xprofile={collect:|use:}
enables program performance profiling. Profiling allows the compiler to identify the most frequently executed sections of code and to perform localized optimizations to best advantage.
Note Programs compiled specifically for the UltraSPARC III platform with-xarch={v8plusb|v9b}
will not operate on platforms other than the UltraSPARC III platform. Use-xarch={v8plusa|v9a}
to compile programs to run compatibly on UltraSPARC I, UltraSPARC II, and UltraSPARC III platforms.
Lifetime of Temporary Objects
When the compiler evaluates expressions, it sometimes creates temporary objects. For example, the compiler may create a temporary object when a function is called or when a cast creates a class object. The old language definition allowed such temporary objects to be destroyed at any time up until the end of the block in which the temporary object was created. The C++ standard specifies that the compiler must destroy a temporary object at the end of the full expression in which the object is created, unless the object is used to initialize a reference.
By default, the C++ compiler (5.2) implements the old language definition; it destroys temporary objects at the end of the block in which they are created. To make the compiler destroy temporary objects according to the requirements of the C++ standard, use the new
-features=tmplife
suboption.For example, consider the following block.
{ foo(ClassA()); bar(ClassB()); some-statement; }If you specify
-features=tmplife
in the command line, the call sequence is as shown here.
tmp1=ClassA(); foo(tmp1); tmp1.~ClassA();tmp2=ClassB(); bar(tmp2); tmp2.~ClassB();some-statement;If you do not specify the
-features=tmplife
suboption, the call sequence is as shown here.
tmp1=ClassA(); foo(tmp1);tmp2=ClassB(); bar(tmp2);some-statement;tmp2.~ClassB();tmp1.~ClassA();This suboption is not available in compatibility mode (
-compat[=4]
).Overriding the Default Search Path With the
-I-
OptionThe new
-I-
option gives you more control over the algorithm that the compiler uses when searching for include files. This section first describes the default search algorithms, then it describes the effect of-I-
on these algorithms.Default Search Algorithm for Quote-Included Files
For statements of the form
#include
"foo.h"
(where quotation marks are used), the compiler searches for include files in the following order:
- The current directory (that is, the directory containing the "including" file)
- The directories named with
-I
options, if any- The directories for compiler-provided C++ header files, ANSI C header files, and special-purpose files
- The
/usr/include
directoryDefault Search Algorithm for Bracket-Included Files
For statements of the form
#include
<foo.h>
(where angle brackets are used), the compiler searches for include files in the following order:
- The directories named with
-I
options, if any- The directories for compiler-provided C++ header files, ANSI C header files, and special-purpose files
- The
/usr/include
directory
Note If the name of the include file matches the name of a standard header, also refer to Section 5.7.4 Standard Header Implementation in the C++ User's Guide.
Using the
-I-
Option to Change the Search AlgorithmThe new
-I-
option gives more control over the default search rules. When-I-
appears in the command line:
- The compiler never searches the current directory, unless the directory is listed explicitly in a
-I
directive. This effect applies even for include statements of the form#include
"foo.h"
.- For include statements of the form
#include
"foo.h",
the compiler searches for include files in the following order:
- The directories named with
-I
options (both before and after-I-
)- The directories for compiler-provided C++ header files, ANSI C header files, and special-purpose files
- The
/usr/include
directory- For include statements of the form
#include
<foo.h>,
the compiler searches for include files in the following order:The following example shows the results of using
-I-
when compilingprog.cc
.
The following command shows the default behavior of searching the current directory (the directory of the including file) for include statements of the form
#include
"foo.h"
. When processing the#include
"c.h"
statement ininc/a.h
, the compiler includes thec.h
header file from theinc
subdirectory. When processing the#include "c.h"
statement inprog.cc
, the compiler includes thec.h
file from the directory containingprog.cc
. Note that the-H
option instructs the compiler to print the paths of the included files.
example%CC -c -Iinc -H prog.cc
inc/a.hinc/c.hinc/b.hinc/c.hc.hThe next command shows the effect of the
-I-
option. The compiler does not look in the including directory first when it processes statements of the form#include
"foo.h"
. Instead, it searches the directories named by the-I
options in the order that they appear in the command line. When processing the#include
"c.h"
statement ininc/a.h
, the compiler includes the./c.h
header file instead of theinc/c.h
header file.
example%CC -c -I. -I- -Iinc -H prog.cc
inc/a.h./c.hinc/b.hinc/c.h./c.hFor more information, see the entry for
-I-
in theCC
(1) man page.Interval Arithmetic Support for C++
(SPARC platform) Sun WorkShopTM 6 update 1 Compilers C++ (5.2) provides a C++ interface to the C++ interval arithmetic library. For more information, see Interval Arithmetic in this document and the C++ Interval Arithmetic Programming Reference available from
http://docs.sun.com
(in the ForteTM Developer 6 update 1/Sun WorkShop 6 update 1 Collection).For information about related compiler options, see the entries for the following in the
CC
(1) man page:
-xia
-library=[no%]interval
Note The C++ interval arithmetic library is compatible with interval arithmetic as implemented in the Fortran compiler.
Mixed-Language Linking
The new
-xlang
option allows you to link Fortran and C++ object files. For example, you can link a C++ main program with Fortran object files.To determine which driver to use for mixed-language linking, use the following language hierarchy:
When linking Fortran 95, Fortran 77, and C++ object files together, use the driver of the highest language. For example, use the following C++ compiler command to link C++ and Fortran 95 object files.
example%CC -xlang=f95
...To link Fortran 95 and Fortran 77 object files, use the Fortran 95 driver, as follows.
example%f95 -xlang=f77
...For more information, see the entries for the following in the
CC
(1) man page:
-xlang=f77,f90,f95
-staticlib=[no%]f77,[no%]f90,[no%]f95,[no%]sunperf
Enabling and Disabling Trigraph Recognition
The
-xtrigraphs
option determines whether the compiler recognizes trigraph sequences as defined by the ISO/ANSI C standard.By default, the compiler assumes
-xtrigraphs=yes
and recognizes all trigraph sequences throughout the compilation unit.If your source code has a literal string containing question marks (
?
) that the compiler is interpreting as a trigraph sequence, you can use the-xtrigraph=no
suboption to turn off the recognition of trigraph sequences. The-xtrigraphs=no
option turns off recognition of all trigraphs throughout the entire compilation unit.Consider the following example source file named
trigraphs_demo.cc
.
#include <stdio.h>int main (){(void) printf("(\?\?) in a string appears as (??)\n");return 0;}Here is the output if you compile this code with
-xtrigraphs=yes
.
example%CC
-xtrigraphs=yes
trigraphs_demo.cc
example%a.out
(??) in a string appears as (]Here is the output if you compile this code with
-xtrigraphs=no
.
example%CC
-xtrigraphs=no
trigraphs_demo.cc
example%a.out
(??) in a string appears as (??)For more information on using the
-xtrigraphs
option, see theCC
(1) man page. For information on trigraphs, see the C User's Guide chapter about transitioning to ANSI/ISO C.Filtering Linker Error Messages
The new
-filt
option controls the filtering thatCC
normally applies to linker error messages.
-filt=no%names
suppresses the demangling of C++ mangled linker names.-filt=no%returns
suppresses the demangling of return types of functions. This suppression helps you identify function names more quickly, but note that in the case of co-variant returns, some functions differ only in the return type.-filt=no%errors
suppress the C++ explanation of linker error messages. This suppression is useful when the linker diagnostics are provided directly to another tool.The following example shows the effects of using
-filt
when compiling this code.
// filt_demo.ccclass type {public:virtual ~type(); // no definition provided};int main(){type t;}When you compile the code without the
-filt
option, the compiler assumes-filt=names,returns,errors
and displays the standard output.
The following command suppresses the demangling of the of the C++ mangled linker names and suppresses the C++ explanations of linker errors.
For more information, see the
CC
(1) man page.Shared
libCstd
Sun WorkShop 6 update 1 Compilers C++ (5.2) includes a shared version of the
libCstd
library.To use the shared version of
libCstd
, compile the program in the usual way, but use a separate link step. In the link step, use the-library=no%Cstd
option, and put the shared library name explicitly on the command line, as shown in this example.
example%CC -library=no%Cstd *.o
\-o myprog /opt/SUNWspro/WS6U1/lib/libCstd.so.1
If Sun WorkShop 6 update 1 is not installed in
/opt
, ask your system administrator for the equivalent path.
Note If you use-library=no%Cstd
in a command that compiles any C++ source code, the compiler will not find C++ standard headers.
Shared
libiostream
Sun WorkShop 6 update 1 Compilers C++ (5.2) includes a shared version of the classic iostream library,
libiostream
.To use the shared version of
libiostream
, compile the program in the usual way, but use a separate link step. In the link step, put the shared library name explicitly on the command line, and do not use the-library=iostream
option, as shown in this example.
example%CC *.o -o myprog
\/opt/SUNWspro/WS6U1/lib/lib/libiostream.so.1
If Sun WorkShop 6 update 1 is not installed in
/opt
, ask your system administrator for the equivalent path.
Note You must use-library=iostream
on each compilation of the program build, but you must not use-library=iostream
on the link step.
Optimization Pragmas
To help the optimizer generate better code, you can use the following new pragmas:
#pragma no_side_effects (
name . . .)
- Use this pragma to indicate that the function does not change any persistent state.
#pragma returns_new_memory (
name,
. . .)
- Use this pragma when the function returns the address of the newly allocated memory and you can guarantee that the pointer does not alias with any other pointer.
For both pragmas, name refers to the most recently declared function that uses that name.
Place these pragmas immediately after the functions to which they refer. For example, the first code example shows the correct placement of the
no_side_effects
pragma and the second example shows an incorrect placement.
class good_example {void no_op();#pragma no_side_effects (no_op) // correct placement}class bad_example{void no_op();}#pragma no_side_effects (no_op) // incorrect placementRecognition of
.c++
ExtensionWhen a file name appears on the command line, the compiler looks at the suffix to determine how to process the file. For example, the compiler processes files ending with
.o
as object files. The Sun WorkShop 6 update 1 Compilers C++ (5.2) recognizes files with the following extensions as C++ source files.
.c
.C
.cc
.cpp
.cxx
.c++
.i
Prefetch Latency Specifier
(SPARC platform) If you are running computationally intensive codes on large multiprocessors, you might find it advantageous to use the new
-xprefetch
suboptionlatx:
factor. This suboption instructs the code generator to adjust the default latency time between a prefetch and its associated load or store by the specified factor.For more information, see the
CC
(1) man page.Fortran Compilers
Both the Fortran 95 and Fortran 77 compilers are released with Sun WorkShop 6 update 1.
TABLE 1-3 lists the new features available with the Sun WorkShop 6 update 1 release that are common to both the Fortran 95 and Fortran 77 compilers. Some of the features are described in greater detail in the sections following the table.
TABLE 1-3 Fortran Compilers New Features Support for the UltraSPARC III Processor -xtarget
-xchipThe -xtarget
and-xchip
options now acceptultra3
. See the following discussion for the recommended flags to use for optimal UltraSPARC III performance.Support for int2 Intrinsic The int2
intrinsic supports compatibility with older Fortran 77 programs. It is equivalent to the preferred Fortran 95int(
var,2)
intrinsic for conversion of data argument var to a 2-byte integer.Enhanced -fast Option -fast
The -fast
option now includes the-xprefetch
option.Prefetch Latency Specifier -xprefetch=
...,latx:
factorThis new suboption determines how far apart the instruction the compiler generates to prefetch data will be from the subsequent use of the data in a load or store instruction. Mixed-Language Linking -xlang
The new -xlang
option enables linking of mixed Fortran and C++ object files.
Support for the UltraSPARC III Processor
Use the following options to compile for optimal performance when compiling and running your program on an UltraSPARC III processor:
-fast -xcrossfile -xprofile={collect:|use:}
- For cross-compilation (compiling on a platform other than UltraSPARC III but generating object binaries to run on an UltraSPARC III system), add the following options to insure correct cache sizes and optimization strategies:
-xtarget=ultra3 -xarch={v8plusb|v9b}
- Specify
-xarch=v8plusb
for 32-bit code generation andv9b
for 64-bit code. For programs accessing very large data files, 64-bit code provides better performance. However,-xarch=v9b
should only be used when 64-bit code generation is required. In some cases it can result in slower performance.- The
-fast
option enables optimizations that favor speed of execution and raises the optimization level to-xO5
. Note that-fast
allows substitution of faster arithmetic operations where possible (-fsimple=2
), so some inaccuracies might result.-xcrossfile
enables the compiler to apply optimizations across all the source files specified on the command line, including some interprocedural optimizations.-xprofile={collect:|use:}
enables program performance profiling. Profiling allows the compiler to identify the most frequently executed sections of code and to perform localized optimizations to best advantage.
Note Programs compiled specifically for the UltraSPARC III platform with-xarch={v8plusb|v9b}
will not operate on platforms other than the UltraSPARC III platform. Use-xarch={v8plusa|v9a}
to compile programs to run compatibly on UltraSPARC I, UltraSPARC II, and UltraSPARC III platforms.
Support for
int2
IntrinsicThe Fortran 95 and Fortran 77 compilers now support the
int2
intrinsic for conversion of data types to 2-byte integer. Use ofint2
as an intrinsic appears in many legacy Fortran 77 codes in the formM=int2(J)
.The preferred Fortran 95 usage is
M=int(J,2)
.Enhanced
-fast
OptionThe
-xprefetch
option has been added to the list of options included in the-fast
option. This enables the compiler to strategically generate prefetch instructions. Using the-xprefetch
option can add a substantial performance gain in code with loops that process data. The prefetch mechanism of the UltraSPARC III platform is much improved over that used by the UltraSPARC II platform.Prefetch Latency Specifier
(SPARC platform) If you are running computationally intensive codes on large multiprocessors, you might find it advantageous to use the new
-xprefetch
suboptionlatx:
factor. This suboption instructs the code generator to adjust the default latency time between a prefetch and its associated load or store by the specified factor.See the
f77
(1) andf95
(1) man pages for details.Mixed-Language Linking
The new
-xlang
option allows you to link Fortran and C++ object files. For example, you can link a Fortran main program with C++ object files.To determine which driver to use for mixed-language linking, use the following language hierarchy:
When linking Fortran 95, Fortran 77, and C++ object files together, use the driver of the highest language. For example, use the following C++ compiler command to link C++ and Fortran 95 object files.
example%CC -xlang=f95
...To link Fortran 95 and Fortran 77 object files, use the Fortran 95 driver, as follows.
example%f95 -xlang=f77
...Interval Arithmetic
TABLE 1-4 lists the new features available with the Sun WorkShop 6 update 1 release of interval arithmetic.
TABLE 1-4 Interval Arithmetic New Features Interval Arithmetic Support for C++ (SPARC platform) This release of the C++ compiler provides a C++ interface to the interval arithmetic library. New f95 INTERVAL Intrinsic Operators and Functions f95
interval arithmetic adds support for the dependent subtraction operator, a division with intersection function, and the interval version of the generic random number generation subroutineRANDOM_NUMBER
.
Interval Arithmetic Support for C++
The Sun WorkShop 6 update 1 release includes a C++ version of the interval functions and operators that are contained in Fortran 95 Interval Arithmetic. For more information about the C++ interval arithmetic library, see the C++ Interval Arithmetic Programming Reference available from
http://docs.sun.com
(in the ForteTM Developer 6 update 1/Sun WorkShop 6 update 1 Collection).Interval Arithmetic support for C++ provides a C++ header file and library that implements three interval classes, one each for float, double, and long double. The interval classes include:
- Interval arithmetic operations and mathematical functions that form a closed mathematical system, which means that valid results are produced for any possible operator-operand combination, including division by zero and other indeterminate forms involving zero and infinities
- Three types of interval relational functions:
- Interval-specific functions, such as
intersect
andinterval_hull
- Interval-specific functions, such as
inf
,sup
, andwid
- Interval input/output, including single-number input/output
For standard mode compilation, all symbols in the library are in the namespace
SUNW_interval
.The compilation interface consists of the following:
- A new value,
interval
, for the-library
flag, which expands to the appropriate libraries.- A new value,
interval
, for the-staticlib
flag, which at present is ignored because only static libraries are provided with this release.- A new flag,
-xia
, which is the same flag used with the Fortran compilers, although the expansion is different.To use the C++ interval arithmetic features, add the following header file to the code.
#include <suninterval.h>An example of compiling code using the
-xia
command-line option is shown below.
example%
CC -o
filename
-xia
filename
.cc
New
f95
INTERVAL
Intrinsic Operators and FunctionsThe following features have been added to
f95
interval arithmetic:Dependent Subtraction Operator
The dependent subtraction operator
.DSUB.
can be used to recover either operand of an interval arithmetic addition.Two interval variables are dependent when one interval variable is a result of an interval arithmetic operation applied to the other interval variable. For example, if X = A + B, then X depends on both A and B. Dependent interval subtraction produces narrower interval results when recovering A or B from X.
Note Dependent operations cannot be applied to interval constants because constants are independent. Applying dependent operations to interval constants produces a compile-time error.
The result of
X.DSUB.A
contains the solution for B of the interval equation X = A + B. The result is[-inf,inf]
if there is no solution.
- Arguments.
X
andA
must be intervals with the same kind type parameter value.- Result type. Same as
X
.The following examples show the behavior of
DSUB.
X
.DSUB.
X
=
[0]
if![]()
X
.DSUB.
A =
[-inf,inf]
ifWID(X)
<WID(A)
becauseWID(X)
must be greater than or equal toWID(A)
if X = A + B.[empty]
.DSUB.
[empty]
=
[-inf,inf]
[empty]
.DSUB.
A
=
[empty]
ifA
![]()
[empty]
X
.DSUB.
[empty]
=
[-inf,inf]
ifX
![]()
[empty]
. This result follows becauseX
![]()
[empty]
andA
![]()
[empty]
is an impossible combination.Division With Intersection Function
The function
DIVIX
returns C(B/A), the interval enclosure of the result of the interval division operation (B/A) intersected with the interval C.
In the case when A contains zero, the mathematical result of the interval division operation (B/A) is the union of two disjoint intervals. Each interval in the union can be represented in the currently implemented interval arithmetic system. The
DIVIX
function allows one or part of these intervals to be returned.
- Arguments.
A
,B
, andC
must be intervals with the same kind type parameter value.- Result type. Same as
A
.The following example shows the output of
DIVIX
.
Random Number Subroutine
RANDOM_NUMBER(HARVEST)
returns through the interval variableHARVEST
one pseudorandom interval or an array of pseudorandom intervals.
0
![]()
![]()
![]()
< 1 holds for the interval endpoints, where
is the lower endpoint, and
is the upper endpoint. Therefore,
is uniformly distributed on the interval [0, 1], and, given
,
is uniformly distributed on the interval
.
dbx
TABLE 1-5 lists the new features available with the Sun WorkShop 6 update 1 release of
dbx
.
Sun Performance Library
Sun Performance LibraryTM is a set of optimized, high-speed mathematical subroutines for solving linear algebra and other numerically intensive problems. Sun Performance Library is based on a collection of public domain applications available from Netlib at
http://www.netlib.org
. These routines have been enhanced and bundled as the Sun Performance Library.TABLE 1-6 lists the new features and enhancements available with the Sun WorkShop 6 update 1 release of the Sun Performance Library.
Sampling Analyzer
TABLE 1-7 lists the new features available with the Sun WorkShop 6 update 1 release of the Sampling Analyzer.
TABLE 1-7 Sampling Analyzer New Features Hardware Counter Overflow Profiling Hardware counter overflow profiling records the callstack of each light-weight process (LWP) at the time the hardware counter of the CPU on which the LWP is running overflows. Standalone collect Command The new collect
command allows you to collect performance data on your applications independent of Sun WorkShop anddbx
.Improved Support for MPI Applications The new collect
command provides improved message-passing interface (MPI) support.Improved Support for OpenMP ( libmtsk
) ApplicationsYou can now distinguish when a slave thread is waiting for synchronization at the end of a parallel region and when it is waiting because the code is in a serial region. Improved Mapfile Generation The mapfile is now produced so that it orders the executable by whatever metric is being used for sorting the function list. Additions to the Select Filters Dialog Box The Experiment list and Select All, Clear All, and Reverse buttons in the Select Filters dialog box let you select experiments for which you want to change the data displayed. The Enable All, Enable All Selected, Disable All, and Disable All Selected buttons let you enable and disable data display for experiments.
Hardware Counter Overflow Profiling
Hardware counter overflow profiling records the callstack of each light-weight process (LWP) at the time the hardware counter of the CPU on which the LWP is running overflows. The data recorded includes a timestamp and the IDs of the CPU, the thread, and the LWP. Hardware counter overflow profiling can be done only on UltraSPARC III systems running the Solaris 8 Operating Environment SPARC Platform Edition and on Intel systems (Pentium II or III) running the Solaris 8 Operating Environment Intel Platform Edition. For more information, see "Hardware Counter Overflow Profiling Data" and "Choosing the Data to Collect" in the Using the Debugging Window section of the Sun WorkShop online help.
Standalone
collect
CommandThe new
collect
command allows you to collect performance data on your applications independent of Sun WorkShop anddbx
. It provides arguments for specifying the types of data to be collected, naming experiments and experiment groups, and requesting that the target process be left stopped on the exit from theexec
system call, in order to allow a debugger to attach to it. For more information, see thecollect
(1) man page.Improved Support for MPI Applications
The new
collect
command provides the following improved message-passing interface (MPI) support:
- The
collect
command lets you specify experiment groups, which allows experiments from all the processes of an MPI run to be grouped and processed together.- Synchronization delay tracing records all calls to the various thread synchronization routines where the real-time delay in the call exceeds a specified threshold.
Sun Microsystems, Inc. Copyright information. All rights reserved. Feedback |
Library | Contents | Previous | Next | Index |