Cray C and C++ Reference Manual
Total Page:16
File Type:pdf, Size:1020Kb
Cray C and C++ Reference Manual (8.7) S-2179 Contents Contents 1 About the Cray and C++ Reference Manual...........................................................................................................4 2 The Cray Compiling Environment...........................................................................................................................5 3 Invoke the C and C++ Compilers............................................................................................................................7 4 Compiler Command Line Options.........................................................................................................................12 4.1 Standard Language Conformance Options............................................................................................. 12 4.2 C Specific Language Conformance Options........................................................................................... 15 4.3 C++ Specific Language Conformance Options....................................................................................... 15 4.4 Miscellaneous C++ Specific Options....................................................................................................... 17 4.5 General Language Options..................................................................................................................... 18 4.6 General Optimization Options................................................................................................................. 21 4.7 Cache Management Options...................................................................................................................26 4.8 Vector Optimization Options.................................................................................................................... 26 4.9 Interprocedural Analysis (IPA) Optimization Options...............................................................................27 4.10 Scalar Optimization Options.................................................................................................................. 28 4.11 Math Options......................................................................................................................................... 29 4.12 Debug Options.......................................................................................................................................31 4.13 Message Options...................................................................................................................................33 4.14 Compilation Phase Options................................................................................................................... 34 4.15 Preprocess Options............................................................................................................................... 36 4.16 Linker Options....................................................................................................................................... 38 4.17 Program Model Specific Options........................................................................................................... 39 4.18 Miscellaneous Options.......................................................................................................................... 40 5 #pragma Directives..............................................................................................................................................44 5.1 Miscellaneous Directives......................................................................................................................... 46 5.2 Vectorization Directives........................................................................................................................... 53 5.3 Scalar Optimization Directives.................................................................................................................60 5.4 Inline and Clone Directives......................................................................................................................66 5.5 PGAS Directive........................................................................................................................................69 6 OpenMP Overview................................................................................................................................................70 7 OpenACC Use...................................................................................................................................................... 77 8 Unified Parallel C (UPC)....................................................................................................................................... 83 9 C++ Libraries........................................................................................................................................................ 87 10 Coarray C++ Use................................................................................................................................................88 11 Cray C Extension Use...................................................................................................................................... 105 12 Predefined Macro Use...................................................................................................................................... 108 2 Contents 13 Run C and C++ Applications............................................................................................................................ 110 14 Debug Cray C and C++ Code...........................................................................................................................111 15 Interlanguage Communication..........................................................................................................................113 16 Implementation-defined Behavior..................................................................................................................... 130 17 Library and Linker Use......................................................................................................................................136 18 Cray C and C++ Dialect Use............................................................................................................................ 137 19 Compiler Message System Use....................................................................................................................... 147 20 Intrinsic Functions.............................................................................................................................................150 3 About the Cray and C++ Reference Manual 1 About the Cray and C++ Reference Manual The Cray® C and C++ Reference Manual includes reference information for the Cray C and C++ compilers. Cray C and C++ Reference Manual (S-2179) 8.7 This version includes updated C and C++ reference information to support CCE software release 8.7, released April 19, 2018. Scope and Audience This guide is intended as a general overview of the Cray C and C++ compilers for users and application programmers. Typographic Conventions Monospace Indicates program code, reserved words, library functions, command-line prompts, screen output, file/path names, and other software constructs. Monospaced Bold Indicates commands that must be entered on a command line or in response to an interactive prompt. Oblique or Italics Indicates user-supplied values in commands or syntax definitions. Proportional Bold Indicates a GUI Window, GUI element, cascading menu (Ctrl→Alt→Delete), or key strokes (press Enter). \ (backslash) At the end of a command line, indicates the Linux® shell line continuation character (lines joined by a backslash are parsed as a single line). Trademarks The following are trademarks of Cray Inc. and are registered in the United States and other countries: CRAY and design, SONEXION, URIKA, and YARCDATA. The following are trademarks of Cray Inc.: APPRENTICE2, CHAPEL, CLUSTER CONNECT, CRAYDOC, CRAYPAT, CRAYPORT, DATAWARP, ECOPHLEX, LIBSCI, NODEKARE. The following system family marks, and associated model number marks, are trademarks of Cray Inc.: CS, CX, XC, XE, XK, XMT, and XT. The registered trademark LINUX is used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a worldwide basis. Other trademarks used in this document are the property of their respective owners. 4 The Cray Compiling Environment 2 The Cray Compiling Environment The Cray Compiling Environment (CCE) contains both the Cray C and C++ compilers. Log in either to a login node or a standalone application development system and use the Cray XC or Cray CS series systems Programming Environment, and related products to create an application which executes on compute nodes. For further information about login nodes and the user environment, see the Cray Programming Environment User's Guide. Throughout this manual, the differences between the Cray C and C++ compilers are noted when appropriate. When there is no difference, the phrase the compiler refers to both compilers. All compiler command options apply to Cray C and C++ unless noted. The Cray C Compiler The Cray C compiler consists of a preprocessor, a language parser, an optimizer, and a code generator. Invoke the Cray C compiler with the cc compiler driver command. This command and its options are also described in the craycc(1) man page. The Cray C++ Compiler The Cray C++ compiler consists of