Cray Standard C/C++ Reference Manual S–2179–36
© 1996-2002 Cray Inc. All Rights Reserved. This manual or parts thereof may not be reproduced in any form unless permitted by contract or by written permission of Cray Inc. U.S. GOVERNMENT RESTRICTED RIGHTS NOTICE The Computer Software is delivered as "Commercial Computer Software" as defined in DFARS 48 CFR 252.227-7014. All Computer Software and Computer Software Documentation acquired by or for the U.S. Government is provided with Restricted Rights. Use, duplication or disclosure by the U.S.
New Features Cray Standard C/C++ Reference Manual S–2179–36 The Cray Standard C/C++ Reference Manual supports the Cray Standard C/C++ compiler 3.6 release. Documentation supporting the following features were added to this manual: Standard C++ The Cray Standard C++ compiler now supports the C++98 standard (ISO/IEC FDIS 14882:1998). Refer to Chapter 4, page 103 for more information.
Many Cray C++ extensions were adopted by the C++ standard, and therefore corresponding sections have been removed from this manual. Information about these features can be found in various books that document the C++ standard.
Record of Revision Version Description 2.0 January 1996 Original Printing. This manual supports the C and C++ compilers contained in the Cray C++ Programming Environment release 2.0. On all Cray systems, the C++ compiler is Cray C++ 2.0. On Cray systems with IEEE floating-point hardware, the C compiler is Cray Standard C 5.0. On Cray systems without IEEE floating-point hardware, the C compiler is Cray Standard C 4.0. 3.
Cray Standard C/C++ Reference Manual ii 3.4 August 2000 This revision supports the Cray C 6.4 and Cray C++ 3.4 releases running on UNICOS and UNICOS/mk operating systems. It includes updates to revision 3.3. 3.4 October 2000 This revision supports the Cray C 6.4 and Cray C++ 3.4 releases running on UNICOS and UNICOS/mk operating systems. This revision supports a new inlining level, inline4. 36 June 2002 This revision supports the Cray C 6.6 and Cray C++ 3.
Contents Page Preface xiii Related Publications . Ordering Documentation Conventions . . Reader Comments . . . . . . . . . . . . . . . . . . . . . . xiv . . . . . . . . . . . . . . . . . . . . . . xv . . . . . . . . . . . . . . . . . . . . . . . . xv . . . . . . . . . . . . . . . . . . . . . . . .
Cray Standard C/C++ Reference Manual Page -h [no]tolerant (cc) . . . . . . . . . . . . . . . . . . . . . . 11 . . . . . . . . . . . . . . . . . . . . . 12 -h [no]autoinstantiate (CC) . . . . . . . . . . . . . . . . . . . 12 -h one_instantiation_per_object (CC) . . . . . . . . . . . . . . . 12 -h instantiation_dir = dirname (CC) . . . . . . . . . . . . . . . .
Contents Page -h [no]vsearch (CC, cc) . Tasking Optimization Options -h taskn (CC, cc) . . . . . . . . . . . . . . . . . . . . 20 . . . . . . . . . . . . . . . . . . . . 20 . . . . . . . . . . . . . . . . . . . . . . . 20 -h taskprivate (cc) . . . . . . . . . . . . . . . . . . . . . . 21 . . . . . . . . . . . . . . . . . 21 -h taskcommon, -h common (CC, cc) -h [no]taskinner (CC, cc) . . . . .
Cray Standard C/C++ Reference Manual Page -F (CC, cc) . . . -h listing (CC, cc) Debugging Options . . . . . . . . . . . . . . . . . . . . . . . . 29 . . . . . . . . . . . . . . . . . . . . . . 29 . . . . . . . . . . . . . . . . . . . . . . 29 . . . . . . . . . . . . . . . . . 29 -G level (CC, cc) and -g (CC, cc, c89) -h [no]bounds (cc) . . . . . . . . . . . . . . . . . . . . . .
Contents Page Loader Options . . . . . . . . . . . . . . . . . . . . . . . . . 38 -d string (CC, cc) . . . . . . . . . . . . . . . . . . . . . . . . 38 -l libfile (CC, cc, c89) . . . . . . . . . . . . . . . . . . . . . . 38 -L libdir (CC, cc, c89) . . . . . . . . . . . . . . . . . . . . . . 39 -o outfile (CC, cc, c89) . . . . . . . . . . . . . . . . . . . . . . 40 . . . . . . .
Cray Standard C/C++ Reference Manual Page nopattern Directive . . . . . . . . . . . . . . . . . . . . . . 59 . . . . . . . . . . . . . . . . . . . . . . 60 . . . . . . . . . . . . . . . . 60 prefervector Directive (UNICOS Systems) . . . . . . . . . . . . . . . 60 shortloop and shortloop128 Directives . . . . . . . . . . . . . . . 61 novector Directive .
Contents Page #pragma preferstream Directive (Cray SV1 series Systems Only) Scalar Directives . . . . . . . align Directive (UNICOS Systems) Function Alignment . . . . . . . . 86 . . . . . . . . . . . . . . . . . . 86 . . . . . . . . . . . . . . . . . . 87 . . . . . . . . . . . . . . . . . . . . . . 87 . . . . . . . . . . . . . . . . . . . . . . 88 . . . . . . . . . . . . . . 90 . . . .
Cray Standard C/C++ Reference Manual Page Implicit Inclusion . . . . . . . . . . . . . . . . . . . . . . . . Predefined Macros [7] 116 117 Macros Required by the C and C++ Standards . . . . . . . . . . . . . . . . 117 Macros Based on the Host Machine . Macros Based on the Target Machine Macros Based on the Compiler . . . . . . . . . . . . . . . . . . . . 118 . . . . . . . . . . . . . . . . . . 118 . . . . . . . .
Contents Page Identifiers Types . Characters . . . . . . . . . . . . . . . . . . . . . . . . . 142 . . . . . . . . . . . . . . . . . . . . . . . . . 142 . . . . . . . . . . . . . . . . . . . . . . . . . 143 . . . . . . . . . . . . . . . . . . . . . . . 144 . . . . . . . . . . . . . . . . . . . . . . . 145 . . . . . . . . . . . . . . . . . . . .
Cray Standard C/C++ Reference Manual Page Appendix C Compiler Messages 173 Expanding Messages with the explain(1) Command Controlling the Use of Messages . . . . . . . . . . . . . 173 . . . . . . . . . . . . . . . . . . . . 174 . . . . . . . . . . . . . . . . . . . . 174 . . . . . . . . . . . . . . . . . . 174 ORIG_CMD_NAME Environment Variable . . . . . . . . . . . . . . . . . 174 Command Line Options .
Preface This publication describes the Standard C and C++ languages as implemented by the Cray Standard C 6.6 release and the Cray Standard C++ 3.6 release compilers. These compilers are supported on the following systems: • Cray SV1 series systems running UNICOS 10.0.1.0 or later. The use of the bte_move intrinsic requires UNICOS 10.0.1.1. • Cray T3E systems running UNICOS/mk 2.0.5 or later. It is assumed that readers of this manual have a working knowledge of the C and C++ programming languages.
Cray Standard C/C++ Reference Manual • Appendix B, page 157, which contains information on the Cray Standard C/C++ dialects. • Appendix C, page 173, which contains information on how to extract information on compiler messages and how to manipulate the message system. • Appendix D, page 179, which contains information on intrinsic functions.
Preface Ordering Documentation To order software documentation, contact the Cray Software Distribution Center in any of the following ways: E-mail: orderdsk@cray.com Web: http://www.cray.com/craydoc/ Click on the Cray Publications Order Form link. Telephone (inside U.S., Canada): 1–800–284–2729 (BUG CRAY), then 605–9100 Telephone (outside U.S., Canada): Contact your Cray representative, or call +1–651–605–9100 Fax: +1–651–605–9001 Mail: Software Distribution Center Cray Inc.
Cray Standard C/C++ Reference Manual user input This bold, fixed-space font denotes literal items that the user enters in interactive sessions. Output is shown in nonbold, fixed-space font. [] Brackets enclose optional portions of a syntax representation for a command, library routine, system call, and so on. ... Ellipses indicate that a preceding element can be repeated. Reader Comments Contact us with any comments that will help us to improve the accuracy and usability of this document.
Introduction [1] The Cray Standard C++ Programming Environment contains both the Cray Standard C and C++ compilers. The Cray Standard C compiler conforms to the International Standards Organization (ISO) standard ISO/IEC 9899:1999 (C99). The Cray Standard C++ compiler conforms to the ISO/IEC 14882:1998 standard, with some exceptions. The exceptions are noted in Appendix B, page 157. Note: Throughout this manual, the differences between the Cray Standard C/C++ compilers are noted when appropriate.
Cray Standard C/C++ Reference Manual individual sites. The CC(1) command is described in Section 2.1, page 4, and on the CC(1) man page. Command line examples are shown in Section 2.23, page 42. 1.2.2 Cray Standard C Compiler The Cray Standard C compiler consists of a preprocessor, a language parser, an optimizer, and a code generator. The Cray Standard C compiler is invoked by a command called cc(1) or c89(1) in this manual, but it may be renamed at individual sites. The cc(1) is discussed in Section 2.
Compiler Commands [2] This section describes the compiler commands and the environment variables necessary to execute the Cray Standard C and C++ compilers. The commands for these compilers are as follows: • CC, which invokes the Cray Standard C++ compiler. • cc, which invokes the Cray Standard C compiler. • c89, which invokes the Cray Standard C compiler. This command is a subset of the cc command. It conforms with POSIX standard (P1003.2, Draft 12). • cpp, which invokes the C language preprocessor.
Cray Standard C/C++ Reference Manual 2.1 CC Command The CC command invokes the Cray Standard C++ compiler. The CC command accepts C++ source files that have the following suffixes: .c .C .i .c++ .C++ .cc .cxx .Cxx .CXX .CC .cpp The CC command also accepts object files with the .o suffix; library files with the .a suffix; and assembler source files with the .s suffix.
Compiler Commands [2] The cc command format is as follows: cc [-c] [-C] [-d string] [-D macro[=def]] [-E] [-F] [-g] [-G level] [-h arg] [-I incldir] [-l libfile] [-L libdir] [-M] [-nostdinc] [-o outfile] [-O level] [-P] [-s] [-S] [-U macro] [-V] [-Wphase,["opt..."]] [-X npes] [-Yphase,dirname] [-#] [-##] [-###] files... See Section 2.3, page 6 for an explanation of the command line options. 2.2.1 c89 Command The c89 command invokes the Cray Standard C compiler.
Cray Standard C/C++ Reference Manual standard input (stdin) and output to standard output (stdout). Specifying a minus sign (-) for infile also indicates standard input. See Section 2.3, page 6 for an explanation of the command line options. 2.3 Command Line Options The following subsections describe options for the CC, cc, c89, and cpp commands.
Compiler Commands [2] – General language options are described in the following subsections: Section Options Section 2.7.1, page 14 -h keep=file Section 2.7.2, page 14 -h restrict=args Section 2.7.3, page 15 -h [no]calchars Section 2.7.4, page 15 -h [no]signedshifts • Optimization options: – General optimization options, described in Section 2.8, page 16. – Multi-Streaming Processor (MSP) options, described in Section 2.9, page 17. – Vectorization options, described in Section 2.10, page 18.
Cray Standard C/C++ Reference Manual will accept the option. Unless otherwise noted, the following default information applies to each option: Default option: None Operating System: UNICOS and UNICOS/mk Floating-point: IEEE and Cray floating point There are many options that start with -h. Multiple -h options can be specified using commas to separate the arguments. For example, the -h parse_templates and -h nofastmd command line options can be specified as -h parse_templates,nofastmd.
Compiler Commands [2] the is option enabled. The -h c99 option is also required for C99 features not previously supported as extensions. The -h noc99 option allows support for C99 features that were previously implemented as Cray extensions, while disabling C99 defined behavior of these same features. For example, hexadecimal floating point constants can use the Cray format only when the -h noc99 option is selected, but can use both the Cray and C99 formats when the -h c99 option is selected.
Cray Standard C/C++ Reference Manual Note: The c89 command does not accept the -h conform or -h stdc option. It is enabled by default when the command is issued. 2.4.3 -h cfront (CC) The -h cfront option causes the Cray Standard C++ compiler to accept or reject constructs that were accepted by previous cfront-based compilers (such as Cray C++ 1.0), but which are not accepted in the C++ standard. The -h anachronisms option is implied when -h cfront is specified. 2.4.
Compiler Commands [2] 2.4.7 -h [no]anachronisms (CC) Default option: -h noanachronisms The -h [no]anachronisms option enables or disables anachronisms in Cray Standard C++. This option is overridden by -h conform. 2.4.8 -h new_for_init (CC) The -h new_for_init option enables the new scoping rules for a declaration in a for-init-statement. This means that the new (standard-conforming) rules are in effect, which means that the entire for statement is wrapped in its own implicitly generated scope.
Cray Standard C/C++ Reference Manual type through a pointer to an entirely different type. For example, a pointer to int might be used to access an object declared with type double. Such references violate the C standard and should be eliminated if possible. They can reduce the effectiveness of alias analysis and inhibit optimization. 2.5 Template Language Options The following sections describe template language options. See Chapter 6, page 109 for more information on template instantiation. 2.5.
Compiler Commands [2] -h instantiate=mode option. mode is specified as none (the default), used, all, or local. 2.5.5 -h [no]implicitinclude (CC) Default option: -h implicitinclude The -h [no]implicitinclude option enables or disables implicit inclusion of source files as a method of finding definitions of template entities to be instantiated. 2.5.
Cray Standard C/C++ Reference Manual For classes that contain no such function, the default behavior is to define the virtual function table (but to define it as a local static entity). The -h forcevtbl option differs from the default behavior in that it does not force the definition to be local. 2.7 General Language Options The following sections describe general language options. 2.7.1 -h keep=file ( CC) When the -h keep=file option is specified, the static constructor/destructor object (.
Compiler Commands [2] (=f), or each this pointer (=t) points to a unique object. This assumption eliminates those pointers as sources of potential aliasing, and may allow additional vectorization or other optimizations. These options cause only data dependencies from pointer aliasing to be ignored, rather than all data dependencies, so they can be used safely for more programs than the -h ivdep option.
Cray Standard C/C++ Reference Manual 2.8 General Optimization Options The following sections describe general optimization options. 2.8.1 -O level (CC, cc, c89) Default option: Equivalent to the appropriate -h option The -O level option specifies the optimization level for a group of compiler features. Specifying -O with no argument is the same as not specifying the -O option; this syntax is supported for compatibility with other vendors.
Compiler Commands [2] updates in a single loop. On UNICOS/mk systems, this option enables the compiler to aggressively assign registers and schedule instructions. 2.8.3 -h display_opt The -h display_opt option displays the current optimization settings for this compilation. 2.8.
Cray Standard C/C++ Reference Manual Note: The MSP is an optional feature. To determine whether the MSP is enabled on your system, enter the sysconf command at your system prompt. The HARDWARE output field contains the NMSP= field that shows the number of MSPs configured. For more information, see the sysconf(1) man page. 2.9.1 -h streamn (CC, cc) (Cray SV1 Series Systems Only) The -h streamn option specifies the level of automatic MSP optimizations to be performed.
Compiler Commands [2] 2.10.2 -h [no]ivdep (CC, cc) Default option: -h noivdep The -h ivdep option instructs the compiler to ignore vector dependencies for all loops. This is useful for vectorizing loops that contain pointers. With -h noivdep, loop dependencies inhibit vectorization. To control loops individually, use the #pragma ivdep directive, as discussed in Section 3.7.1, page 58. This option can also be used with "vectorization-like" optimizations on UNICOS/mk systems. See Section 3.
Cray Standard C/C++ Reference Manual improve vectorization. Also, the aliasing assumptions specified in the standard are used (for example, it is assumed that no aliasing will occur between two pointers to different structure types). On UNICOS/mk systems, "vectorization-like" optimizations are performed. See Section 3.7, page 57, for more information. Vectorization directives are described in Section 3.7, page 57. 2.10.
Compiler Commands [2] aliasing will occur between two pointers to different structure types. 2.11.2 -h taskprivate (cc) This option gives task private status to all statically-allocated objects in the program. Unlike -h taskcommon, initialized objects can be made private to each task with the -h taskprivate option. They are initialized at startup for each task prior to the execution of the main entry point. For information on tasking and tasking directives, see Section 3.8, page 62. 2.11.
Cray Standard C/C++ Reference Manual (UNICOS systems) The -h [no]threshold option enables or disables generation of run-time threshold testing for autotasked loops. Aggressive Autotasking (-h task3) must also be specified for this option to take effect. 2.12 Inlining Optimization Options The following sections describe inlining options. 2.12.1 -h inlinen (CC, cc) Default option: -h inline2 The -h inlinen option specifies the level of inlining to be performed.
Compiler Commands [2] 2.13 Scalar Optimization Options The following sections describe scalar optimization options. 2.13.1 -h [no]interchange (CC, cc) Default option: -h interchange The -h interchange option instructs the compiler to attempt to interchange all loops, a technique that is used to gain performance by having the compiler swap an inner loop with an outer loop. The compiler attempts the interchange only if the interchange will increase performance.
Cray Standard C/C++ Reference Manual 2.13.3 -h [no]align (CC, cc) Default option: -h noalign (UNICOS systems) The -h align option specifies that all functions defined in the file are to be automatically aligned on instruction buffer boundaries. This alignment can significantly improve performance for small, frequently called functions. With -h noalign, automatic function alignment is not done. To control alignment of functions individually, use the align directive.
Compiler Commands [2] code. -h zeroinc is the safer and slower option. This option is affected by the -h scalarn option (see Section 2.13.2, page 23). 2.14 UNICOS/mk Specific Optimization Options The following sections describe UNICOS/mk specific compiler options. 2.14.1 -h pipelinen (CC, cc commands) Default option: -h pipeline0 (UNICOS/mk systems) The -h pipelinen option specifies two levels of software pipelining; on and off.
Cray Standard C/C++ Reference Manual (UNICOS/mk systems) The -h jump option generates jumps instead of branches to external functions. Branches provide slightly better performance. However, branches are limited in the distance to which they can transfer control; jumps have no such limitation. For large programs you may need to use -h jump with files that generate calls to functions loaded at too great a distance. 2.14.
Compiler Commands [2] (UNICOS systems) The -h fastmd option generates shorter code sequences for int variables when doing multiply, divide, or comparison operations, or when converting to and from floating-point operations, but allows for only 46 bits of significance. With -h nofastmd, this action is disabled. This option is affected by the scalar optimization level (see Section 2.13.2, page 23). 2.15.
Cray Standard C/C++ Reference Manual realized. For example, this option is useful in loops that contain divides with a loop-invariant divisor or sequences of divides with the same divisor. If the option is enabled, you could see slight numerical differences from compiles for which the option is not enabled. You could also see numerical differences between instances of the same computation for the same compile, depending on the context of the computation.
Compiler Commands [2] 2.16.1 -F (CC, cc) (UNICOS systems) The -F option enables the generation of additional run-time code that is needed by Perftrace or Flowtrace. Perftrace and Flowtrace are program analysis tools that display the call tree of a program and the amount of time spent in each function. To use perfview, you must also specify the -l perf option. See the perftrace or flowtrace(7) man page for more information. 2.16.
Cray Standard C/C++ Reference Manual -G option is the preferred specification. The -Gn and -g options disable all optimizations and imply -O0. The debugging options take precedence over any conflicting options that appear on the command line. If more than one debugging option appears, the last one specified overrides the others. 2.17.2 -h [no]bounds (cc) Default option: -h nobounds The -h bounds option provides checking of pointer and array references to ensure that they are within acceptable boundaries.
Compiler Commands [2] 2.18.2 -h [no]message=n[: n...] (CC, cc) Default option: Determined by -h msglevel_n The -h [no]message=n[:n...] option enables or disables specified compiler messages. n is the number of a message to be enabled or disabled. You can specify more than one message number; multiple numbers must be separated by a colon with no intervening spaces.
Cray Standard C/C++ Reference Manual 2.18.4 -h [no]abort (CC, cc) Default option: -h noabort The -h [no]abort option controls whether a compilation aborts if an error is detected. 2.18.5 -h errorlimit[=n] (CC, cc) Default option: -h errorlimit=100 The -h errorlimit[=n] option specifies the maximum number of error messages the compiler prints before it exits. n is a positive integer. Specifying -h errorlimit=0 disables exiting on the basis of the number of errors.
Compiler Commands [2] When the -P option is specified on the cpp command line, it is ignored. When both the -P and -E options are specified, the last one specified takes precedence. 2.19.3 -h feonly (CC, cc) The -h feonly option limits the Cray Standard C/C++ compilers to syntax checking. The optimizer and code generator are not executed. This option takes precedence over -S and -c. 2.19.
Cray Standard C/C++ Reference Manual Table 3. -W phase Definitions phase System phase Command p Preprocessor 0 Compiler a Assembler as on Cray PVP systems, cam on Cray MPP systems l Loader System-specific; ld or cld. Arguments to be passed to system phases can be entered in either of two styles. If spaces appear within a string to be passed, the string is enclosed in double quotes. When double quotes are not used, spaces cannot appear in the string.
Compiler Commands [2] Because there is no separate preprocessor, -Yp and -Y0 are equivalent. If you are using the -Y option on the cpp command line, p is the only argument for phase that is allowed. 2.20 Preprocessing Options The following sections describe compiler options that affect preprocessing. 2.20.1 -C (CC, cc, cpp) The -C option retains all comments in the preprocessed source code, except those on preprocessor directive lines.
Cray Standard C/C++ Reference Manual Table 5.
Compiler Commands [2] 4. Directory /usr/include. Directories for #include file are searched in the following order: 1. Directories named in -I options, in command line order. 2. Site-specific and compiler release-specific include files directories. 3. Directory /usr/include.
Cray Standard C/C++ Reference Manual 2.20.7 -nostdinc (CC, cc, c89, cpp) The -nostdinc option stops the preprocessor from searching for include files in the standard directories (/usr/include/CC and /usr/include). 2.20.8 -U macro (CC, cc, c89, cpp) The -U option removes any initial definition of macro. Any predefined macro except those required by the standard (see Section 7.1, page 117) can be undefined by the -U option.
Compiler Commands [2] libC.a (Cray Standard C++ only) libu.a libm.a libc.a libsma.a (UNICOS/mk systems only) libf.a libfi.a libsci.a If you specify personal libraries by using the -l command line option, as in the following example, those libraries are added to the top of the preceding list. (The -l option is passed to the loader.) cc -l mylib target.c When the previous command line is issued, the loader looks for a library named libmylib.
Cray Standard C/C++ Reference Manual 2.21.4 -o outfile (CC, cc, c89) The -o outfile option produces an absolute binary file named outfile. A file named a.out is produced by default. When this option is used in conjunction with the -c option and a single C or C++ source file, a relocatable object file named outfile is produced. 2.21.5 -s (CC, cc, c89) The -s option produces executable files from which symbolic and other information not required for proper execution has been removed.
Compiler Commands [2] If a file is specified, information about the compilation is displayed in addition to the version information. The additional information includes the compiler generation date, the compilation execution time, the maximum memory used by the compiler (in decimal words), and the resulting number of words used for code and data. 2.22.3 -X npes (CC, cc) (UNICOS/mk systems) The -X npes option specifies how many processing elements (PEs) are to be used on Cray T3E systems.
Cray Standard C/C++ Reference Manual In the first line, the -X option is passed only to the compiler, and the number of PEs is set to 8 at compile time. In the second line, the -X option is passed only to the loader and the number of PEs is set to 8 at load time. If the number of PEs is specified at both compile and load time, the compile-time constant overrides the load-time constant. If the two values disagree, the loader issues a message. 2.
Compiler Commands [2] • The following example compiles mydata1.C, writes object file mydata1.o, and produces a scalar optimization report to stdout. CC -c -h report=s mydata1.C • The following example compiles mydata3.c and produces the executable file a.out. A 132-column pseudo assembly listing file is also produced in file mydata3.L. cc -h listing mydata3.c • The following example compiles myfile.c and passes an option to the loader (-Dalign=modules) that causes blocks of code to be aligned.
Cray Standard C/C++ Reference Manual Note: Setting the CRAYOLDCPPLIB environment variable disables exception handling. Refer to the -h [no]exceptions option. 44 CRI_CC_OPTIONS, CRI_cc_OPTIONS, CRI_c89_OPTIONS, CRI_cpp_OPTIONS Specifies command line options that are applied to all compilations. Options specified by this environment variable are added following the options specified directly on the command line. This is especially useful for adding options to compilations done with build tools.
#pragma Directives [3] #pragma directives are used within the source program to request certain kinds of special processing. #pragma directives are part of the C and C++ languages, but the meaning of any #pragma directive is defined by the implementation. #pragma directives are expressed in the following form: #pragma [ _CRI] identifier [arguments] The _CRI specification is optional and ensures that the compiler will issue a message concerning any directives that it does not recognize.
Cray Standard C/C++ Reference Manual Compiler: Cray Standard C and Cray Standard C++ Operating System: UNICOS and UNICOS/mk Scope: Local and global 3.1 Protecting Directives To ensure that your directives are interpreted only by the Cray Standard C/C++ compilers, use the following coding technique in which directive represents the name of the directive: #if _CRAYC #pragma _CRI directive #endif This ensures that other compilers used to compile this code will not interpret the directive.
#pragma Directives [3] 3.4 Alternative Directive form: _Pragma Compiler directives can also be specified in the following form, which has the advantage in that it can appear inside macro definitions: _Pragma("_CRI identifier"); This form has the same effect as using the #pragma form, except that everything that appeared on the line following the #pragma must now appear inside the double quotation marks and parentheses.
Cray Standard C/C++ Reference Manual #ifdef _CRAY #define Pragma(S) _Pragma(S) #else #define Pragma(S) #endif When this definition is used on a UNICOS or UNICOS/mk system, the directives are interpreted as intended; when used on another vendor’s system, the directives are removed.
#pragma Directives [3] For more information on accessing BESUs, see Barrier and Eureka Synchronization (Cray T3E Systems), publication HMM-141–0. (A nondisclosure agreement must be signed with Cray Inc. before you can obtain this document.) For a convenient source of BESU state codes, see header file mpp/mpphw_t3e.h.
Cray Standard C/C++ Reference Manual 3.5.3 duplicate Directive (Cray Standard C Compiler) Scope: Global The duplicate directive lets you provide additional, externally visible names for specified functions. You can specify duplicate names for functions by using a directive with one of the following forms: #pragma _CRI duplicate actual as dupname... #pragma _CRI duplicate actual as (dupname...) The actual argument is the name of the actual function to which duplicate names will be assigned.
#pragma Directives [3] #pragma _CRI duplicate derivspeed as accel /* Error: derivspeed is not defined */ static void endtime(void) { } #pragma _CRI duplicate endtime as limit /* Error: endtime is defined as a static function */ Because duplicate names are simply additional names for functions and are not functions themselves, they cannot be declared or defined anywhere in the compilation unit.
Cray Standard C/C++ Reference Manual main.c: extern void fctn(void), FCTN(void); main() { fctn(); FCTN(); } fctn.c: #include void fctn(void) { printf("Hello world\n"); } #pragma _CRI duplicate fctn as FCTN Files main.c and fctn.c are compiled and linked using the following command line: cc main.c fctn.c When the executable file a.out is run, the program generates the following output: Hello world Hello world 3.5.
#pragma Directives [3] The following example illustrates the use of the message compiler directive: #define FLAG 1 #ifdef FLAG #pragma _CRI message "FLAG is Set" #else #pragma _CRI message "FLAG is NOT Set" #endif 3.5.5 [no]opt Directive Scope: Global The noopt directive disables all automatic optimizations and causes optimization directives to be ignored in the source code that follows the directive. Disabling optimization removes various sources of potential confusion in debugging.
Cray Standard C/C++ Reference Manual #include void sub1(void) { printf("In sub1, default optimization\n"); } #pragma _CRI noopt void sub2(void) { printf("In sub2, optimization disabled\n"); } #pragma _CRI opt void sub3(void) { printf("In sub3, optimization enabled\n"); } main() { printf("Start main\n"); sub1(); sub2(); sub3(); } 3.5.
#pragma Directives [3] Note: Use of this directive prevents the cache_bypass directive from being processed because when uses_eregs is in effect, no E registers are available to the compiler. 3.5.7 soft Directive Scope: Global The soft directive specifies external identifiers with references that are to be considered soft. Soft external references can be to a function or to a data object. Soft externals do not increase your program’s total memory requirements.
Cray Standard C/C++ Reference Manual extern long x; #pragma _CRI soft x /* x is a soft external data object */ extern void f(void); #pragma _CRI soft f /* f is a soft external function */ long y = 4; #pragma _CRI soft y /* ERROR - y is actually defined */ static long z; #pragma _CRI soft z /* ERROR - z is declared static */ void fctn(void) { #pragma _CRI soft a } /* ERROR - directive must be at global scope */ 3.5.
#pragma Directives [3] 3.5.9 ident Directive The ident directive directs the compiler to store the string indicated by text into the object (.o) file. This can be used to place a source identification string into an object file. The format of this directive is as follows: #pragma _CRI ident "text" 3.6 Instantiation Directives The Cray Standard C++ compiler recognizes three instantiation directives.
Cray Standard C/C++ Reference Manual On UNICOS/mk systems, the compiler can perform "vectorization-like" optimizations on certain loops. Vector versions of the following functions are used when the function appears in a vectorizable loop on UNICOS/mk systems: alog(3m), exp(3m), sqrt(3m), ranf(3m), sin(3m), cos(3c), coss(3m), pow(3c), and _popcnt(3i). This “vectorization” is performed using the following process: 1. The loop is stripmined.
#pragma Directives [3] On the Cray SV1 series and Cray T3E systems, the compiler assumes that the safe vector length is the maximum vector length supported by that machine. On Cray SV1 series systems, the -h [no]infinitevl compiler option can be used to change this behavior. 3.7.2 nopattern Directive Scope: Local The nopattern directive disables pattern matching for the loop immediately following the directive.
Cray Standard C/C++ Reference Manual 3.7.3 novector Directive Scope: Local The novector directive directs the compiler to not vectorize the loop that immediately follows the directive. It overrides any other vectorization-related directives, as well as the -h vector and -h ivdep command line options.
#pragma Directives [3] The prefervector directive tells the compiler to vectorize the loop that immediately follows the directive if the loop contains more than one loop in the nest that can be vectorized. The directive states a vectorization preference and does not guarantee that the loop has no memory dependence hazard.
Cray Standard C/C++ Reference Manual The formats of these directives are as follows: #pragma _CRI shortloop #pragma _CRI shortloop128 The following examples illustrate the use of the shortloop and shortloop128 directives: #pragma _CRI shortloop for (i = 0; i < n; i++) { a[i] = b[i] + c[i]; } /* 1< = n < = 64 */ #pragma _CRI shortloop128 for (i = 0; i < n; i++) { /* 1 < = n < = 128 */ a[i] = b[i] + c[i]; } 3.
#pragma Directives [3] Autotasking is enabled by specifying the -h taskn option on the command line. For more information on the -h taskn option, see Section 2.11.1, page 20. • User-directed tasking, sometimes called microtasking or simply tasking, is controlled by the directives you add to your code. This requires that you understand the requirements for tasking and perform your own analysis.
Cray Standard C/C++ Reference Manual 3.8.1.1.1 Master Code The master code contains the code that sets up the data structures needed for tasking, performs some (or all) of the work in a parallel region, and performs the cleanup operations needed after tasking is complete. The task that executes the master code is known as themaster task. A copy of the body of the parallel region is placed in the master code.
#pragma Directives [3] For debugging purposes, the names of slave functions are in the following form: __tsk_name_nnn The name is the name of the original function that contained the parallel region, and nnn is a 3-digit number indicating how many parallel regions preceded this one in the current function. If the name is longer than 200 characters, only the first 200 characters are used when the slave function’s name is created.
Cray Standard C/C++ Reference Manual Besides executing the vector loop, each processor must execute some loop overhead code for each chunk of the work. If you specify the chunksize, numchunks, guided, or vector arguments, the compiler rewrites the loop as two nested loops. The inner loop becomes a for loop that processes the iterations in a vector chunk. This inner loop will be vectorized, subject to the normal rules for vectorization of loops.
#pragma Directives [3] • Shared T registers 0–3 If you address these registers in your program (for example, using intrinsic functions), tasking may not work properly. If you are multi-streaming on a Cray SV1 system, none of the registers will be available. 3.8.2 cncall Directive (UNICOS Systems Only) Scope: Local The cncall directive allows a loop to be tasked by asserting that subroutine and function calls within the loop have no loop-related side effects.
Cray Standard C/C++ Reference Manual extern float a[], b[], c; extern void crunch( float *x, float *y, float z); void f(int n) { int i; #pragma _CRI cncall for (i = 0; i < n; ++i) { crunch( &a[i], &b[i], c ); } } In example 1, a[i] and b[i] denote unique storage locations for each iteration, so crunch can read and write *x and *y. Because c is passed by value, crunch can read and write z.
#pragma Directives [3] } /* /* /* /* /* The following tasks because the cncall directive allows the compiler to assume no loop carried dependence to/from any call-by-reference argument. unfortunately, x is socped shared, which is most likely not what the user expects.
Cray Standard C/C++ Reference Manual surprising results. In some cases the compiler’s scoping choices do not meet requirements or expectations. The defaults clause of the Autotasking parallel or taskloop directive instructs the compiler to use a simple set of heuristic scoping rules. This contrasts with cncall, in which the compiler exploits all available dependence information in its analysis.
#pragma Directives [3] explicitly do so. Unlike other loop-based directives, the taskloop directive must appear before a for loop. The taskloop directive can be used either inside or outside of a parallel region. When the directive is used inside a parallel region, the private, shared, value, defaults, if, and maxcpus arguments are not allowed. These arguments, if specified, must be specified on the parallel directive that precedes the taskloop directive.
Cray Standard C/C++ Reference Manual contains the taskloop loop. This allows a mechanism to exploit parallelism in loops that contain reduction computations. The endloop directive can appear only in a parallel region. The format of the endloop directive is as follows: #pragma _CRI endloop In the following example, a parallel region is defined that uses a taskloop/endloop pair and a guarded region to implement a reduction computation.
#pragma Directives [3] (Guarded regions are discussed in Section 3.8.7, page 74.) The endloop directive ensures that no processor can proceed beyond this point until all have contributed to the sum and big values. 3.8.6 case and endcase Directives (UNICOS Systems) Scope: Local The case directive serves as a separator between adjacent code blocks that are concurrently executable. The case directive can appear only in a parallel region.
Cray Standard C/C++ Reference Manual . . #pragma _CRI endparallel 3.8.7 guard and endguard Directives (UNICOS Systems) Scope: Local The guard and endguard directive pair delimit a guarded region and provide the necessary synchronization to protect (or guard) the code inside the guarded region. A guarded region is a code block that is to be executed by only one processor at a time, although all processors in the parallel region execute it.
#pragma Directives [3] 3.8.8 taskprivate Directive (Cray Standard C Compiler) The taskprivate directive specifies the task private storage class for variables. The format of this directive is as follows (the comma-separated list of variables can be enclosed in parentheses): #pragma _CRI taskprivate variable,...
Cray Standard C/C++ Reference Manual • A taskprivate variable cannot also be a soft external. • The address of a taskprivate variable cannot be taken in a constant expression (for example, an initializer). 3.8.9 taskshared Directive (Cray Standard C Compiler) The taskshared directive ensures that specified variables are accessible to all tasks (not stored as task private).
#pragma Directives [3] #pragma _CRI taskcommon variable, ... Variables that are given a task common storage class are placed in storage so that each task has a separate copy of the variables; all functions within a task can access the same copy of the task common variable, but no task can access any task common variables belonging to another task.
Cray Standard C/C++ Reference Manual • The address of a taskcommon variable cannot be taken in a constant expression (for example, an initializer). 3.8.11 common Directive A common directive ensures that specified variables are accessible to all tasks (not stored as taskcommon). Use this directive, for example, with the -h taskcommon option, to exempt certain variables that would otherwise be taskcommon. The common directive overrides the -h taskcommon and -h taskprivate command line options.
#pragma Directives [3] directive to take effect. Threshold testing for the loop specified by using the prefertask directive is suppressed.
Cray Standard C/C++ Reference Manual to determine their tasking context. The tasking context for these variables cannot be changed. Note: Variables default to extern and static default to shared. Function parameters and variables declared taskcommon, auto, and register default to value. Unless the defaults argument is used, all variables referenced in but declared outside the parallel region must be listed in one of the tasking context argument lists.
#pragma Directives [3] For tasked loops, array variables that are sequentially indexed by the loop control variable and modified inside the loop are often shared. Because each processor is working with a different array element, there is no chance for two processors to attempt to modify the same array element at the same time. Conversely, scalar variables and array variables that are not sequentially indexed by the loop control variable, but which are modified inside the loop, are usually not shared.
Cray Standard C/C++ Reference Manual and can cause loops inside and outside parallel regions to not vectorize. Avoid shared stack variables, where possible, because of this problem. 3.8.13.2 Context Arguments The following tasking directive arguments are used to indicate the tasking context for variables referenced in the parallel region. Tasking context is an attribute that determines how the different processors access a variable in a parallel region.
#pragma Directives [3] For all work distribution arguments except single, each chunk of iterations can be vectorized, subject to the normal rules for vectorization. S–2179–36 Argument Description single The single argument specifies that the iterations are distributed one at a time to available processors. If no work distribution arguments are specified, the default is single.
Cray Standard C/C++ Reference Manual following is an example of a guided distribution that assumes 8 processors and 1000 iterations: 125 110 96 84 74 64 56 49 43 38 33 29 25 22 19 17 15 13 11 10 9 8 7 6 5 4 4 3 3 3 2 2 2 2 1 1 1 1 1 1 1 vector The vector argument splits the iteration space into chunks of varying sizes down to a minimum size of 64 or 128, depending on the vector length of the target machine.
#pragma Directives [3] when used in conjunction with the vector or chunksize arguments) will be performed by the master processor after all the other iterations (or partitions) have been completed. This argument ensures that all private and value variables with values that are set inside the loop will have the values produced by the final loop iteration when the loop is exited; this is not ensured by default. The savelast argument has no parameters.
Cray Standard C/C++ Reference Manual #pragma _CRI nostream The following example illustrates the use of the nostream directive: #pragma _CRI nostream for ( i = 0; i < n1; i++ ) { x[i] = y[i] + z[i] } 3.9.2 #pragma preferstream Directive (Cray SV1 series Systems Only) Scope: Local The preferstream directive tells the compiler to multi-stream the following loop.
#pragma Directives [3] 3.10.1 align Directive (UNICOS Systems) The align directive causes functions, loops, or labels to be aligned on instruction buffer boundaries. This increases the size of the compiled program but improves loop performance. When used in global scope, the align directive specifies that functions be aligned on instruction buffer boundaries.
Cray Standard C/C++ Reference Manual instruction buffers, no additional instruction buffer fetches will be necessary while the function executes. The code resulting from an inlined function is not aligned, even if the function’s name is specified on an align directive. The performance improvement obtained by aligning code on an instruction buffer is generally insignificant when compared to that obtained by inlining.
#pragma Directives [3] loops in addition to those automatically aligned by the compiler. In these cases, you must use the align directive. The align directive must appear directly preceding a loop or a label; it must not appear in any other context within local scope. (As described in the previous subsection, the align directive may appear in global scope to indicate functions to be aligned.
Cray Standard C/C++ Reference Manual void fctn(void) { int i; #pragma _CRI align for (i = 0; i < 100; i++) /* This loop will be aligned. */ { . . . } i = 0; #pragma _CRI align top_of_loop: ; /* This loop will be aligned. */ . . . i++; if (i < 100) goto top_of_loop; } 3.10.2 cache_align Directive (UNICOS/mk Systems) The cache_align directive aligns each specified variable on a cache line boundary. This is useful for frequently referenced variables.
#pragma Directives [3] E registers offer fine-grained access to local memory and a higher bandwidth for sparse index array accesses such as gather/scatter operations and large-stride accesses. These operations do not exploit the spatial locality of cache references. Using this directive can greatly decrease run time for gather/scatter operations. The benefits of using this directive are higher with random index streams.
Cray Standard C/C++ Reference Manual /* References of arrays a, b and c bypass cache. References to ix and d go through cache. */ void indirect(double a[], double b[], double c[], double d[], int ix[], int n) { int i; #pragma _CRI cache_bypass a,b,c #pragma _CRI ivdep for (i = 0; i < n; i++) { a[ix[i]] = b[ix[i]] + c[ix[i]] * d[i]; } } To see the most benefit from the cache_bypass directive, you may want to enable loop unrolling.
#pragma Directives [3] n An integer constant between 1 and 63, specifying that no dependencies exist between any iteration of the loop and n subsequent iterations. This clause is only of use for pipelining on Cray T3E systems; any concurrent directive with a safe_distance= clause will have no effect on other systems. In the following example, the concurrent directive indicates that the relationship, k>=3, is true.
Cray Standard C/C++ Reference Manual The noreduction compiler directive tells the compiler to not optimize the loop that immediately follows the directive as a reduction loop. If the loop is not a reduction loop, the directive is ignored. A reduction loop is a loop that contains at least one statement that reduces an array to a scalar value by doing a cumulative operation on many of the array elements. This involves including the result of the previous iteration in the expression of the current iteration.
#pragma Directives [3] by splitting an inner loop into a set of smaller loops, each of which allocates no more than six stream buffers, thus avoiding stream buffer thrashing. The stream buffer feature reduces memory latency and increases memory bandwidth by prefetching for long, small-strided sequences of memory references. The split directive has the following format: #pragma _CRI split The split directive merely asserts that the loop can profit by splitting. It will not cause incorrect code.
Cray Standard C/C++ Reference Manual for (i = 0; i < 1000; i++) { a[i] = b[i] * c[i]; ta[i] = d[i] + a[i]; } for (i=0; i<1000; i++) { e[i] = f[i] * ta[i] * g[i]; h[i] = h[i] + e[i]; } Finally, the compiler stripmines the loops to increase the potential for cache hits and reduce the size of arrays created for scalar expansion: for (i1 = 0; i1 < 1000; i1 += 256) { i2 = (i1+256 < 1000) ? i1+256 : 1000; for (i = i1; i < i2; i++) { a[i] = b[i] * c[i] ta[i-i1] = d[i] + a[i] } for (i = i1; i < i2; i++) { e[i] =
#pragma Directives [3] from memory at the first reference following the directive. The local suppress directive has the following format: #pragma _CRI suppress [var...] The net effect of the local suppress directive is similar to declaring the affected variables to be volatile except that the volatile qualifier affects the entire program whereas the local suppress directive affects only the block of code in which it resides.
Cray Standard C/C++ Reference Manual declared in that block will be squandered. Neither of these conditions are detected by the compiler. 3.10.10 unroll Directive Scope: Local The unrolling directive allows the user to control unrolling for individual loops. Loop unrolling can improve program performance by revealing cross-iteration memory optimization opportunities such as read-after-write and read-after-read.
#pragma Directives [3] line option is specified. On UNICOS systems, the compiler may do additional unrolling over the amount requested by the user.
Cray Standard C/C++ Reference Manual /* directive will cause incorrect code due to dependencies! */ #pragma _CRI unroll 2 for (i = 0; i < 10; i++) { for (j = 1; j < 100; j++) { a[i][j] = a[i+1][j-1] + 1; } } 3.11 Inlining Directives Inlining replaces calls to user-defined functions with the code in the calling process that represents the function. This can improve performance by saving the expense of the function call overhead.
#pragma Directives [3] 3.11.1 inline Directive The inline directive specifies functions that are to be inlined. The inline directive has the following format: #pragma _CRI inline func,... The func,... argument represents the function or functions to be inlined. The list can be enclosed in parentheses. Listed functions must be defined in the compilation unit. You cannot specify objects of type pointer-to-function. The following example illustrates the use of the inline directive: #include
Cray Standard C/C++ Reference Manual #include int f(int a) { return a*a; } #pragma _CRI noinline f main() { int b = 5; printf("%d\n", f(b)); } 102 /* Direct the compiler not to */ /* inline calls to f.
Cray Standard C++ [4] The Cray Standard C++ compiler together with the Dinkum C++ Libraries support the C++98 standard (ISO/IEC FDIS 14882) and continues to support existing Cray extensions. Most of the standard C++ features are supported, except for the few mentioned in Section 4.1, page 103. The Dinkum C++ Library documentation, describes the Dinkum C++ Library and is mainly a reference. This documentation is described in Section 4.2, page 103. 4.
Cray Standard C/C++ Reference Manual Administration Guide for more information about the CrayDoc documentation system. If you have any questions about the contents of the Cray Standard C++ headers, refer to the /opt/ctl/CC/CC/include directory.
Cray Standard C Extensions [5] This chapter describes the Cray Standard C extensions to standard C. A program that uses one or more extensions does not strictly conform to the standard. These extensions are not available in strict conformance mode. The following are extensions to the C standard: • Complex data extensions (Section 5.1, page 105) • fortran keyword (Section 5.2, page 106) • Hexadecimal floating-point constants (Section 5.3, page 106) 5.
Cray Standard C/C++ Reference Manual 5.2 fortran Keyword Note: The fortran keyword is not allowed in Cray Standard C++. In extended mode, the identifier fortran is treated as a keyword. It specifies a storage class that can be used to declare a Fortran-coded external function. The use of the fortran keyword when declaring a function causes the compiler to verify that the arguments used in each call to the function are pass-by-address; any arguments that are not addresses are converted to addresses.
Cray Standard C Extensions [5] 0x7f7fffff.f 32-bit float 0x0123456789012345. 64-bit double The value of a hexadecimal floating constant is interpreted as a value in the specified floating type. This uses an unsigned integral type of the same size as the floating type, regardless of whether an object can be explicitly declared with such a type. No conversion or range checking is performed.
Cray Standard C++ Template Instantiation [6] A template describes a class or function that is a model for a family of related classes or functions. The act of generating a class or function from a template is called template instantiation. Note: The information in this chapter does not pertain to C or the Cray Standard C compiler. For example, a template can be created for a stack class, and then a stack of integers, a stack of floats, and a stack of some user-defined type can be used.
Cray Standard C/C++ Reference Manual instantiation of template entities until all source files of the complete program have been read. The Cray Standard C++ compiler provides an instantiation mechanism that performs automatic instantiation at linkage and provides command line options and #pragma directives that give the programmer more explicit control over instantiation. 6.1 Automatic Instantiation The goal of an automatic instantiation mode is to provide trouble-free instantiation.
Cray Standard C++ Template Instantiation [6] created, if one does not already exist (for example, the compilation of abc.C results in the creation of abc.ti). 2. When the object files are linked together, a program called the prelinker is run. It examines the object files, looking for references and definitions of template entities and for any additional information about entities that could be instantiated. ! Caution: The prelinker does not examine the object files in a library (.a) file. 3.
Cray Standard C/C++ Reference Manual of -h prelink_copy_if_nonlocal (see Section 2.5.8, page 13) will work as if you created a library (.a) that is shared. The -h prelink_local_copy option indicates that only local files (for example, files in the current directory) are candidates for assignment of instantiations. This option is useful when you are sharing some common relocatables but do not want them updated. Another way to ensure that shared .
Cray Standard C++ Template Instantiation [6] Automatic instantiation can coexist with partial explicit control of instantiation by the programmer through the use of #pragma directives or the -h instantiate=mode option. Automatic instantiation mode can be disabled by issuing the -h noautoinstantiate command line option. If automatic instantiation is disabled, the information about template entities that could be instantiated in a file is not included in the object file. 6.
Cray Standard C/C++ Reference Manual In the case where the CC(1) command is given a single source file to compile and link, all instantiations are done in the single source file and, by default, the used mode is used and automatic instantiation is suppressed. 6.3 One Instantiation Per Object File You can direct the prelinker to instantiate each template referenced in the source into its own object file.
Cray Standard C++ Template Instantiation [6] • A member function name. For example: A::f • A static data member name. For example: A::i • A static data declaration. For example: int A::i • A member function declaration. For example: void A::f(int, char) • A template function declaration.
Cray Standard C/C++ Reference Manual In the preceding example, f1(double) and g1(double) are not instantiated because no bodies are supplied, but no errors will be produced during the compilation. If no bodies are supplied at link time, a linker error is issued. A member function name (such as A::f) can be used as a #pragma directive argument only if it refers to a single, user-defined member function (that is, not an overloaded function).
Predefined Macros [7] Predefined macros can be divided into the following categories: • Macros required by the C and C++ standards • Macros based on the host machine • Macros based on the target machine • Macros based on the compiler Predefined macros provide information about the compilation environment. In the subsections that follow, only those macros that begin with the underscore (_) character are defined when running in strict-conformance mode (see the -h conform command line option in Section 2.4.
Cray Standard C/C++ Reference Manual required by the ISO C++ standard, but not the ISO C standard. 7.2 Macros Based on the Host Machine The following macros provide information about the environment running on the host machine: Macro Description __unix Defined as 1 if the operating system is UNIX. unix Defined as 1 if the operating system is UNIX. This macro is not defined in strict-conformance mode.
Predefined Macros [7] _CRAYMPP Defined as 1 on all UNICOS/mk systems. If the hardware is any other machine type, the macro is not defined. _CRAYSV1 Defined as 1 on all Cray SV1 series systems. If the hardware is any other machine type, the macro is not defined. _CRAYT3E Defined as 1 on Cray T3E systems; if the hardware is any other machine type, the macro is not defined.
Debugging Cray Standard C/C++ Code [8] The Cray TotalView symbolic debugger is available to help you debug C and C++ codes. In addition, the Cray Standard C/C++ compilers provide the following features to help you in debugging codes: • The -G and -g compiler options provide symbol information about your source code for use by the Cray TotalView debugger. For more information on these compiler options, see Section 2.17.1, page 29. • The -h [no]trunc option helps identify numerically unstable algorithms.
Cray Standard C/C++ Reference Manual • Edit values of variables and memory locations • Evaluate code fragments 8.2 Compiler Debugging Options To use the Cray TotalView debugger in debugging your code, you must first compile your code using one of the debugging options (-g or -G). These options are specified as follows: • -Gf If you specify the -Gf debugging option, the Cray TotalView debugger allows you to set breakpoints at function entry and exit and at labels.
Interlanguage Communication [9] In some situations, it is necessary or advantageous to make calls to assembly or Fortran functions from C or C++ programs. This chapter describes how to make such calls. It also discusses calls to C and C++ functions from Fortran and assembly language. For additional information on interlanguage communication, see Interlanguage Programming Conventions.
Cray Standard C/C++ Reference Manual • Structures and unions that are declared identically in C and C++. In order for structures and unions to be shared, they must be declared with identical members in the identical order. • Arrays and pointers to the above types. In the following example, a Cray Standard C function (C_add_func) is called by the Cray Standard C++ main function: C++ Main Program #include
Interlanguage Communication [9] The output from the execution of the calling sequence illustrated in the preceding example is as follows: Start C++ main Call C C_add_func Start C function C_add_func. p1 = 10 p2 = 20 global_int = 123 Result of C_add_func = 30 End C++ main 9.
Cray Standard C/C++ Reference Manual 9.3 Calling Fortran Functions and Subroutines from a C or C++ Function This subsection describes the following aspects of calling Fortran from C or C++. Topics include requirements and guidelines, argument passing, array storage, logical and character data, accessing named common, and accessing blank common. 9.3.1 Requirements Keep the following points in mind when calling Fortran functions from C or C++: • Fortran uses the call-by-address convention.
Interlanguage Communication [9] 9.3.2 Argument Passing Because Fortran subroutines expect arguments to be passed by pointers rather than by value, C and C++ functions called from Fortran subroutines must pass pointers rather than values. All argument passing in Cray Standard C is strictly by value. To prepare for a function call between two Cray Standard C functions, a copy is made of each actual argument.
Cray Standard C/C++ Reference Manual which they are declared and referenced in Fortran. Arrays are zero-based in C and C++ and are one-based in Fortran, so in C and C++ you should subtract 1 from the array subscripts that you would normally use in Fortran.
Interlanguage Communication [9] _fcdlen Conversion utility that extracts the byte length from the Fortran character descriptor. Because Fortran does not terminate character strings with a null character, _fcdlen can be used to determine the last character in the string. _btol Conversion utility that converts a 0 to a Fortran logical .FALSE. and a nonzero value to a Fortran logical .TRUE. _ltob Conversion utility that converts a Fortran logical .FALSE. to a 0 and a Fortran logical .TRUE. to a 1.
Cray Standard C/C++ Reference Manual #include struct { int i; double a[10]; long double d; } ST; main() { int i; /* initialize struct ST */ ST.i = 12345; for (i = 0; i < 10; i++) ST.a[i] = i; ST.d = 1234567890.1234567890L; /* print out the members of struct ST */ printf("In C: ST.i = %d, ST.d = %20.10Lf\n", ST.i, ST.d); printf("In C: ST.a = "); for (i = 0; i < 10; i++) printf("%4.1f", ST.
Interlanguage Communication [9] INTEGER I WRITE(6,100) STI, STD 100 FORMAT (’IN FORTRAN: STI = ’, I5, ’, STD = ’, D25.20) WRITE(6,200) (STA(I), I = 1,10) 200 FORMAT (’IN FORTRAN: STA =’, 10F4.1) END The previous Cray Standard C and Fortran examples are executed by the following commands, and they produce the output shown: $ $ $ $ cc -c c.c ftn -c f.f segldr c.o f.o a.out ST.i = 12345, ST.d = 1234567890.1234567890 In C: ST.a = 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 IN FORTRAN: STI = 12345, STD = .
Cray Standard C/C++ Reference Manual #include struct st { float a; float b[10]; } *ST; #ifdef __cplusplus extern "C" struct st *MYCOMMON(void); extern "C" void FCTN(void); #else fortran struct st *MYCOMMON(void); fortran void FCTN(void); #endif main() { int i; ST = MYCOMMON(); ST->a = 1.0; for (i = 0; i < 10; i++) ST->b[i] = i+2; printf("\n In C/C++\n"); printf(" a = %5.1f\n", ST->a); printf(" b = "); for (i = 0; i < 10; i++) printf("%5.
Interlanguage Communication [9] SUBROUTINE FCTN COMMON // STA,STB(10) PRINT *, "IN FORTRAN" PRINT *, " STA = ",STA PRINT *, " STB = ",STB STOP END FUNCTION MYCOMMON() COMMON // A MYCOMMON = LOC(A) RETURN END The output of the previous C or C++ source code is as follows: In C a = 1.0 b = 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 The output of the previous Fortran source code is as follows: IN FORTRAN STA = 1. STB = 2., 3., 4., 5., 6., 7., 8., 9., 10., 11. 9.3.
Cray Standard C/C++ Reference Manual /* C program (main.c): */ #include #include #include fortran double FTNFCTN (_fcd, int *); double FLOAT1 = 1.
Interlanguage Communication [9] C Fortran subprogram (ftnfctn.f): FUNCTION FTNFCTN(STR, LOG) REAL FTNFCTN CHARACTER*(*) STR LOGICAL LOG COMMON /FLOAT1/FLOAT1 COMMON /FLOAT2/FLOAT2 REAL FLOAT1, FLOAT2 DATA FLOAT2/2.4/ C ! FLOAT1 INITIALIZED IN MAIN PRINT CURRENT STATE OF VARIABLES PRINT*, ’ IN FTNFCTN: FLOAT1 = ’, FLOAT1, PRINT*, ’ ARGUMENTS: 1 C ’;FLOAT2 = ’, FLOAT2 STR = "’, STR, ’"; LOG = ’, LOG CHANGE THE VALUES FOR STR(ING) AND LOG(ICAL) STR = ’New Fortran String’ LOG = .FALSE.
Cray Standard C/C++ Reference Manual $ cc -c main.c $ ftn -c ftnfctn.f $ segldr main.o ftnfctn.o $ a.out $ In main: FLOAT1 = 1.6; FLOAT2 = 2.4 Calling FTNFCTN with arguments: string = "C Character String"; logical = 1 IN FTNFCTN: FLOAT1 = 1.6; FLOAT2 = 2.4 ARGUMENTS: STR = "C Character String"; LOG = T RETURNING FROM FTNFCTN WITH 123.4 Back in main: FTNFCTN returned 123.4 and changed the two arguments: string = "New Fortran String"; logical = 0 $ 9.3.
Interlanguage Communication [9] The Fortran program that is called from the Cray Standard C++ main function in the preceding example is as follows: INTEGER FUNCTION FORTRAN_ADD_INTS(Arg1, Arg2) INTEGER Arg1, Arg2 PRINT *," FORTRAN_ADD_INTS, Arg1,Arg2 = ", Arg1, Arg2 FORTRAN_ADD_INTS = Arg1 + Arg2 END The output from the execution of the preceding example is as follows: Start C++ main Before Call to FORTRAN_ADD_INTS FORTRAN_ADD_INTS, Arg1,Arg2 = Result of FORTRAN Add = 30 10, 20 End C++ main 9.
Cray Standard C/C++ Reference Manual C Fortran program (main.f): PROGRAM MAIN REAL CFCTN COMMON /FLOAT1/FLOAT1 COMMON /FLOAT2/FLOAT2 REAL FLOAT1, FLOAT2 DATA FLOAT1/1.6/ ! FLOAT2 INITIALIZED IN cfctn LOGICAL LOG CHARACTER*24 STR REAL RTNVAL C INITIALIZE VARIABLES STR(ING) AND LOG(ICAL) STR = ’Fortran Character String’ LOG = .TRUE.
Interlanguage Communication [9] /* C function (cfctn.c): #include */ #include #include #include double FLOAT1; /* Initialized in MAIN */ double FLOAT2 = 2.
Cray Standard C/C++ Reference Manual $ cc -c cfctn.c $ ftn -c main.f $ ftn cfctn.o main.o $ a.out $ IN MAIN: FLOAT1 = 1.6; FLOAT2 = 2.4 CALLING CFCTN WITH ARGUMENTS: STR = "Fortran Character String"; LOG = T In CFCTN: FLOAT1 = 1.6; FLOAT2 = 2.4 Arguments: str = "Fortran Character String"; log = 1 Returning from CFCTN with 123.4 BACK IN MAIN: CFCTN RETURNED 123.
Implementation-defined Behavior [10] This chapter describes compiler behavior that is defined by the implementation according to the C and/or C++ standards. The standards require that the behavior of each particular implementation be documented. 10.1 Implementation-defined Behavior The C and C++ standards define implementation-defined behavior as behavior, for a correct program construct and correct data, that depends on the characteristics of the implementation.
Cray Standard C/C++ Reference Manual 10.1.2.1 Identifiers The identifier (as defined by the standards) is merely a sequence of letters and digits. Specific uses of identifiers are called names. The Cray C compiler treats the first 255 characters of a name as significant, regardless of whether it is an internal or external name. The case of names, including external names, is significant. In Cray Standard C++, all characters of a name are significant. 10.1.2.
Implementation-defined Behavior [10] UNICOS UNICOS/mk Type Representation (bits) Memory (bits) Representation (bits) Memory (bits) long 64 64 64 64 long long2 64 64 64 64 float 64 64 32 32 double 64 64 64 64 long double 128 128 64 64 float complex3 128 128 64 64 (64 each part) double complex3 128 (32 each part) 128 (64 each part) long double complex3 256 128 128 (64 each part) 256 (128 each part) 128 128 (64 each part) void and char pointers 64 64 64 64
Cray Standard C/C++ Reference Manual character constant can contain up to 8 characters. The integer value of a character constant is the value of the characters packed into a word from left to right, with the result right-justified, as shown in the following table: Table 7.
Implementation-defined Behavior [10] 10.1.2.5 Integers All integral values are represented in a twos complement format. For representation and memory storage requirements for integral types, see Table 6, page 142. When an integer is converted to a shorter signed integer, and the value cannot be represented, the result is the truncated representation treated as a signed quantity.
Cray Standard C/C++ Reference Manual 10.1.2.6.1 Cray floating-point Representation Types float and double represent Cray single-precision (64-bit) floating-point values; long double represents Cray double-precision (128-bit) floating-point values. An integral number that is converted to a floating-point number that cannot exactly represent the original value is truncated toward 0. A floating-point number that is converted to a narrower floating-point number is also truncated toward 0.
Implementation-defined Behavior [10] Digits beyond these precisions may not be accurate. It is safest to assume only 14 or 28 decimal places of accuracy. Epsilon, the difference between 1.0 and the smallest value greater than 1.0 that is representable in the given floating-point type, is approximately 7.1 × 10-15 for types float and double, and approximately 2.5 × 10-29 for type long double. 10.1.2.6.
Cray Standard C/C++ Reference Manual For exact values, use the macros defined in the header file, float.h(3c). Rounding of 32 and 64 bit floating-point arithmetic is determined by the current rounding mode. The 128 bit floating-point arithmetic is rounded to the closest, without regard to the rounding mode.
Implementation-defined Behavior [10] Pointers on UNICOS systems differ from pointers on UNICOS/mk systems. The sections that follow describe pointer implementation on each type of system. 10.1.2.7.1 Pointers on UNICOS Systems Although a pointer value can be stored in an object of integer type, an operation may give different results when performed on the same value treated as an integer or as a pointer. An integer result should not be used as a pointer.
Cray Standard C/C++ Reference Manual 10.1.2.8 Registers Use of the register storage class in the declaration of an object has no effect on whether the object is placed in a register. The compiler performs register assignment aggressively; that is, it automatically attempts to place as many variables as possible into registers. 10.1.2.
Implementation-defined Behavior [10] 10.1.2.12 Statements The compiler has no fixed limit on the maximum number of case values allowed in a switch statement. The Cray Standard C++ compiler parses asm statements for correct syntax, but otherwise ignores them. 10.1.2.13 Exceptions In Cray Standard C++, when an exception is thrown, the memory for the temporary copy of the exception being thrown is allocated on the stack and a pointer to the allocated space is returned. 10.1.2.
Cray Standard C/C++ Reference Manual The macros __DATE__ and __TIME__ contain the date and time of the beginning of translation. For more information, see the description of the predefined macros in Chapter 7, page 117. The #pragma directives are described in section Chapter 3, page 45.
Libraries and Loaders [A] This appendix describes the libraries that are available with the Cray Standard C/C++ Programming Environment and the loaders, ld(1) and cld(1). A.1 Cray Standard C/C++ Libraries Current Programming Environments Libraries that support Cray Standard C/C++ are automatically available on all systems when you use the CC(1), cc(1), or c89(1) commands to compile your programs.
Cray Standard C/C++ Reference Manual Because of the special code needed to handle templates, constructors, destructors, and other C++ language features, object files generated by using the CC(1) command should be linked using the CC(1) command. To link C++ object files using one of the loader commands (ld(1) or cld(1)), the -h keep=files option (see Section 2.7.1, page 14) must be specified on the command line when compiling source files.
Libraries and Loaders [A] was designed specifically for use with UNICOS/mk systems, it offers several advantages. You can control cld(1) operations with options on the cld(1) command line or directives in a directives file. For more information, see the cld(1) man page.
Cray Standard C/C++ Dialects [B] This appendix details the features of the C and C++ languages that are accepted by the Cray Standard C/C++ compilers, including certain language dialects and anachronisms. Users should be aware of these details, especially users who are porting codes from other environments. B.1 C++ Conformance The Cray Standard C++ compiler accepts the C++ language as defined by the ISO/IEC 14882:1998 standard, with the exceptions listed in Section B.1.2, page 160.
Cray Standard C/C++ Reference Manual • The precedence of the third operand of the ? operator is changed. • If control reaches the end of the main() routine, and the main() routine has an integral return type, it is treated as if a return 0; statement was executed. • Pointers to arrays with unknown bounds as parameter types are diagnosed as errors. • A functional-notation cast of the form A() can be used even if A is a class without a (nontrivial) constructor.
Cray Standard C/C++ Dialects [B] • Definition of a nested class outside its enclosing class is allowed. • mutable is accepted on nonstatic data member declarations. • Namespaces are implemented, including using declarations and directives. Access declarations are broadened to match the corresponding using declarations. • Explicit instantiation of templates is implemented. • The typename keyword is recognized. • explicit is accepted to declare nonconverting constructors.
Cray Standard C/C++ Reference Manual • Explicit specification of function template arguments is supported. • Unnamed template parameters are supported. • The new lookup rules for member references of the form x.A::B and p->A::B are supported. • The notation :: template (and –>template, etc.) is supported. • In a reference of the form f()->g(), with g a static member function, f() is evaluated. Likewise for a similar reference to a static data member.
Cray Standard C/C++ Dialects [B] • extern inline functions are not supported. • Covariant return types on overriding virtual functions are not supported. B.2 C++ Anachronisms Accepted C++ anachronisms are enabled by using the -h anachronisms command line option (see Section 2.4.7, page 11). When anachronisms are enabled, the following anachronisms are accepted: • overload is allowed in function declarations. It is accepted and ignored.
Cray Standard C/C++ Reference Manual when checking for compatibility, therefore, the following statements declare the overloading of two functions named f: int f(int); int f(x) char x; { return x; } Note: In C, this code is legal, but has a different meaning. A tentative declaration of f is followed by its definition. B.
Cray Standard C/C++ Dialects [B] struct A { }; struct B : public A { B& operator=(A&); }; By default, as well as in cfront-compatibility mode, there will be no implicit declaration of B::operator=(const B&), whereas in strict-ANSI mode, B::operator=(A&) is not a copy assignment operator and B::operator=(const B&) is implicitly declared. • Implicit type conversion between a pointer to an extern "C" function and a pointer to an extern "C++" function is permitted.
Cray Standard C/C++ Reference Manual • enum tags can be incomplete as long as the tag name is defined and resolved by specifying the brace-enclosed list later. • An extra comma is allowed at the end of an enum list. • The final semicolon preceding the closing of a struct or union type specifier can be omitted. • A label definition can be immediately followed by a right brace ( } ). (Normally, a statement must follow a label definition.) • An empty declaration (a semicolon preceded by nothing) is allowed.
Cray Standard C/C++ Dialects [B] to const int **). Comparisons and pointer difference of such pairs of pointer types are also allowed. • In operations on pointers, a pointer to void is always implicitly converted to another type if necessary, and a null pointer constant is always implicitly converted to a null pointer of the right type if necessary. In ANSI C, these are allowed by some operators, and not by others (generally, where it does not make sense).
Cray Standard C/C++ Reference Manual the object and the function pointed to will not modify the object. The opposite assignment would not be safe. • Conversion operators that specify a conversion to void are allowed. • A nonstandard friend declaration can introduce a new type. A friend declaration that omits the elaborated type specifier is allowed in default mode, however, in cfront mode the declaration can also introduce a new type name.
Cray Standard C/C++ Dialects [B] struct A { void f(int); static void sf(int); typedef void A::T3(int); // nonstd typedef decl typedef void T2(int); // std typedef }; typedef void A::T(int); // nonstd typedef decl T* pmf = &A::f; // nonstd ptr-to-member decl A::T2* pf = A::sf; // std ptr to static mem decl A::T3* pmf2 = &A::f; // nonstd ptr-to-member decl In this example, T is construed to name a function type for a nonstatic member function of class A that takes an int argument and returns void; the use o
Cray Standard C/C++ Reference Manual class A { ~A(); }; class B : public A { ~B(); }; B::~B(){} // Error except in cfront mode • When disambiguation requires deciding whether something is a parameter declaration or an argument expression, the pattern type-name-or-keyword(identifier ...) is treated as an argument.
Cray Standard C/C++ Dialects [B] • No warning is issued on duplicate size and sign specifiers, as shown in the following example: short short int i; // No warning in cfront mode • Virtual function table pointer-update code is not generated in destructors for base classes of classes without virtual functions, even if the base class virtual functions might be overridden in a further derived class.
Cray Standard C/C++ Reference Manual in normal mode. In practice, this is not much of a problem, since classes that allow bitwise copying usually do not have destructors. • A union member may be declared to have the type of a class for which the user has defined an assignment operator (as long as the class has no constructor or destructor). A warning is issued. • When an unnamed class appears in a typedef declaration, the typedef name may appear as the class name in an elaborated type specifier.
Cray Standard C/C++ Dialects [B] • An uninitialized const object of non-POD class type is allowed even if its default constructor is implicitly declared as in the following example: struct A { virtual void f(); int i; }; const A a; • A function parameter type is allowed to involve a pointer or reference to array of unknown bounds.
Compiler Messages [C] This appendix describes how to use the message system to control and use messages issued by the compiler. Explanatory texts for messages can be displayed online through the use of the explain(1) command, described in the following section. For further information about the message system, see the Cray Message System Programmer’s Guide, or the message system section of the UNICOS System Libraries Reference Manual.
Cray Standard C/C++ Reference Manual C.2 Controlling the Use of Messages The following sections summarize the command line options that affect the issuing of messages from the compiler. C.2.1 Command Line Options Option Description -h errorlimit[=n] Specifies the maximum number of error messages the compiler prints before it exits. -h [no]message=n[:...] Enables or disables the specified compiler messages, overriding -h msglevel.
Compiler Messages [C] script, any message printed by the compiler appears as though it was generated by the script. For example, the following C shell script is named newcc: # setenv ORIG_CMD_NAME ’basename $0’ cc $* A message generated by invoking newcc resembles the following: CC-8 newcc: ERROR File = x.c, Line = 1 A new-line character appears inside a string literal. Because the environment variable ORIG_CMD_NAME is set to newcc, this appears as the command name instead of cc(1) in this message.
Cray Standard C/C++ Reference Manual WARNING Probable user error. Indicates that the program will probably abort or behave unpredictably. ERROR Fatal error; that is, a serious error in the source code. No binary output is produced. INTERNAL Problems in the compilation process. Please report internal errors immediately to the system support staff, so a Software Problem Report (SPR) can be filed. LIMIT Compiler limits have been exceeded.
Compiler Messages [C] An operand range error occurs when a program attempts to load or store in an area of memory that is not part of the user’s area. This usually occurs when an invalid pointer is dereferenced. • Program Range Error A program range error occurs when a program attempts to jump into an area of memory that is not part of the user’s area. This may occur, for example, when a function in the program mistakenly overwrites the internal program stack.
Intrinsic Functions [D] The C and C++ intrinsic functions either allow for direct access to some hardware instructions or result in generation of inline code to perform some specialized functions. These intrinsic functions are processed completely by the compiler. In many cases, the generated code is one or two instructions. These are called functions because they are invoked with the syntax of function calls.
Cray Standard C/C++ Reference Manual Table 9.
Intrinsic Functions [D] Function UNICOS systems UNICOS/mk systems _poppar X X _ranf X X _readSB X _readSR X _readST X X _remote_write_barrier _rtc X _semclr X _semget X _semput X _semset X _semts X _setvm X X _write_memory_barrier 3 X _writeSB X _writeST X bte_move3 X Cray SV1 series only S–2179–36 181
Index -#, 33 -##, 33 -###, 33 branches vs.
Cray Standard C/C++ Reference Manual compiler version, 40 conflicting with directives, 8 conflicting with other options, 8 -D macro[=def], 35 -d string option, 38 defaults, 6 -E option, 3, 32 examples, 42 -g option, 29 -G option, 29 -h cfront, 10 -h common, 21 -h errorlimit[=n], 32 -h feonly, 33 -h forcevtble, 13 -h ident=name, 40 -h indef, 30 -h inlinen, 22 -h instantiate=mode, 12 -h instantiation_dir, 12 -h keep=file, 14 -h listing, 29 -h matherror=method, 26 -h msglevel_n, 30 -h new_for_init, 11 -h [no]
Index remove macro definition, 38 -s option, 40 -S option, 3, 33 -U macro option, 38 -V option, 40 -W option, 33 -X npes option, 41 -Y option, 34 Command line options -g option, 121–122 -G option, 121–122 -h anachronisms, 161 -h cfront, 165 -h [no]bounds, 121 -h [no]trunc, 121 -h options errorlimit, 173 command-line options -h [no]bounds, 30 commands c89, 3 files, 5 format, 5 cc, 3 files, 4 format, 4 CC, 3 files, 4 format, 4 compiler, 3 cpp, 3 format, 5 ld, 14 options, 6 Commands c89, 1 cc, 1 CC, 1 comment
Cray Standard C/C++ Reference Manual Cray SV1 systems, 85 Cray TotalView debugger, 121 CRAYOLDCPPLIB, 43 CRI_c89_OPTIONS, 44 CRI_cc_OPTIONS, 44 CRI_CC_OPTIONS, 44 CRI_cpp_OPTIONS, 44 D -D macro[=def], 35 -d string, 38 Data types, 142 mapping (table), , 142 __DATE__ , 152 Debugger, 121 debugging, 29 -G level, 29 -g option, 29 -h indef, 30 -h [no]bounds, 30 -h zero, 30 Debugging features, 121 Debugging options, 122 Declarators, 150 declared bounds, 17 defaults directive argument, 82 Dialects, 157 directives
Index split, 94 suppress, 96 symmetric, 97 taskcommon, 76 taskloop, 70 taskprivate, 75 taskshared, 76 unroll, 98 usage, 45 uses_eregs, 54 vfunction, 56 protecting, 46 scalar, 86 tasking, 62 tasking context, 79 vectorization, 57 Directives #pragma arguments to instantiate, 114 can_instantiate, 114 do_not_instantiate, 114 instantiate, 114 message, 121 [no]bounds directive, 121 [no]opt, 121 preprocessing, 151 directories #include files, 36, 38 library files, 38–39 phase execution, 34 do_not_instantiate direct
Cray Standard C/C++ Reference Manual F _fcdlen conversion utility, 129 _fcdtocp conversion utility, 128 Features C++, 157 cfront compatibility, 157 files a.out, 3 constructor/destructor, 14 default library, 38 dependencies, 37 library directory, 39 linking, 14 listing, 29 output, 40 personal libraries, 39 Files .ii file, 111 intrinsics.
Index -h –h -h -h -h -h -h -h -h -h -h -h -h -h -h -h -h -h -h -h -h -h -h -h -h -h –h -h -h -h -h -h -h -h -h -h -h -h -h -h -h -h instantiation_dir, 12 interchange, 23 intrinsics, 17 ivdep, 19 jump, 26 keep=file, 14 listing, 29 matherror=method, 26 msglevel_n, 30, 174 new_for_init, 11 noabort, 32 noaggress, 16 noalign, 24 noanachronisms, 11 noautoinstantiate, 12 nobl, 24 nobounds, 30, 121 noc99, 8 nocalchars, 15 noconform, 9 noexceptions, 10 nofastfpdivide, 27 nofastmd, 27 nofastmodulus, 27 noieeeconfor
Cray Standard C/C++ Reference Manual ident directive, 57 identifier names allowable, 15 Identifiers, 142 IEEE floating-point representation, 147 IEEE floating-point standard conformance, 27 if (exp), 84 Imaginary constants, 105 Implementation-defined behavior, 141 Implicit inclusion, 13, 116 initialization tasking, 65 inline directive, 101 inlining level, 22 Inlining, 100 instantiate directive, 57, 114 Instantiation automatic, 110 directory for template instantiation object files, 12 enable or disable auto
Index -l libfile, 38 LANG, 44, 174 language general -h keep=file, 14 -h [no]calchars, 15 -h [no]calsignedshifts, 15 -h restrict=args, 14 standard conformance -h cfront, 10 -h new_for_init, 11 -h [no]anachronisms, 11 -h [no]c99, 8 -h [no]conform, 9 -h [no]exceptions, 10 -h [no]tolerant, 11 templates -h instantiate=mode, 12 -h instantiation_dir, 12 -h [no]autoinstantiate, 12 -h [no]implicitude, 13 -h one_instantiation_per_object, 12 -h prelink_copy_if_nonlocal, 13 -h prelink_local_copy, 13 -h remove_instanti
Cray Standard C/C++ Reference Manual _CRAYC, 119 _CRAYIEEE, 119 _CRAYMPP, 119 _CRAYSV1, 119 _CRAYT3E, 119 __DATE__, 117 _FASTMD, 119 __FILE__, 117 _LD64, 119 __LINE__, 117 _MAXVL, 119 _RELEASE, 119 __STDC__, 117 __TIME__, 117 _UNICOS, 118 unix, 118 __unix, 118 _mask, 180 _maskl, 180 _maskr, 180 master code, 64 master task, 64 math -h matherror=method, 26 -h [no]fastfpdivide, 27 -h [no]fastmd, 27 -h [no]fastmodulus, 27 -h [no]ieeeconform, 27 -h [no]rounddiv, 28 -h [no]trunc[=n], 28 maxcpus (exp), 84 mbtowc,
Index nointerchange directive, 93 nontasked code, 65 noopt directive, 53, 121 noreduction directive, 94 -nostdinc, 38 nostream directive, 85 novector directive, 60 novsearch directive, 60 NPROC, 44 _num_pes, 180 _numargs, 180 Numbered guards, 74 numchunks work distribution, 83 O -o outfile, 40 -Olevel, 16 Operand Range Error, 176 Operators bitwise and integers, 145 opt directive, 53, 121 optimization automatic scalar, 23 general -h [no]aggress, 16 -h [no]intrinsics, 17 -h [no]overindex, 17 -h [no]pattern,
Cray Standard C/C++ Reference Manual Pointers, 148–149 UNICOS systems, 149 UNICOS/mk systems, 149 _popcnt, 180 _poppar, 181 Porting code, 11, 157 #pragma directives See directives _Pragma directives, 47 Predefined macros, 117 preferstream directive, 86 prefertask directive, 78 prefervector directive, 61 Prelinker, 111 preprocessing -C option, 35 -D macro[=def], 35 -h [no]pragma=name[:name...
Index Shift operator, 145 shortloop directive, 61 shortloop128 directive, 61 single work distribution, 83 sizeof, 142 slave code, 64 slave function, 64 slave tasks, 64 slave function, 64 soft directive, 55 soft externals, 55 split directive, 94 Standard Template Library, 153 Standards, 141 arrays and pointers, 148 bit fields, 150 C violation, 11 character set, 143 example, 144 classes, 150 conformance to, 9 conformance to C99, 8 Cray floating-point representation, 146 data types, 142 mapping, , 142 declara
Cray Standard C/C++ Reference Manual problem, 66 reserved semaphores, 66 shared registers, 66 slave code, 64 unitasked code, 65 user-directed, 63 with vectorization (stripmining), Tasking status, 21 tasking level, 20 taskloop, 65 taskloop directive, 70 taskprivate directive, 75 taskshared directive, 76 Template, 109 Template instantiation, 109 automatic, 110 directives, 114 implicit inclusion, 116 modes, 113 one per object file, 112, 114 Throw expression, 10 Throw specification, 10 __TIME__, 152 TotalView