Qlogic Pathscale™ Compiler Suite User Guide
Total Page:16
File Type:pdf, Size:1020Kb
Q Simplify QLogic PathScale™ Compiler Suite User Guide Version 3.0 1-02404-15 Page i QLogic PathScale Compiler Suite User Guide Version 3.0 Q Information furnished in this manual is believed to be accurate and reliable. However, QLogic Corporation assumes no responsibility for its use, nor for any infringements of patents or other rights of third parties which may result from its use. QLogic Corporation reserves the right to change product specifications at any time without notice. Applications described in this document for any of these products are for illustrative purposes only. QLogic Corporation makes no representation nor warranty that such applications are suitable for the specified use without further testing or modification. QLogic Corporation assumes no responsibility for any errors that may appear in this document. No part of this document may be copied nor reproduced by any means, nor translated nor transmitted to any magnetic medium without the express written consent of QLogic Corporation. In accordance with the terms of their valid PathScale agreements, customers are permitted to make electronic and paper copies of this document for their own exclusive use. Linux is a registered trademark of Linus Torvalds. QLA, QLogic, SANsurfer, the QLogic logo, PathScale, the PathScale logo, and InfiniPath are registered trademarks of QLogic Corporation. Red Hat and all Red Hat-based trademarks are trademarks or registered trademarks of Red Hat, Inc. SuSE is a registered trademark of SuSE Linux AG. All other brand and product names are trademarks or registered trademarks of their respective owners. Document Revision History 1.4 New Sections 3.3.3.1, 3.7.4, 10.4, 10.5 Added Appendix B: Supported Fortran intrinsics 2.0 New Sections 2.3, 8.9.7, 11.8 Added Chapter 8: Using OpenMP in Fortran New Appendix B: Implementation dependent behavior for OpenMP Fortran Expanded and updated Appendix C: Supported Fortran intrinsics 2.1 Added Chapter 9: Using OpenMP in C/C++, Appendix E: eko man page. Expanded and updated Appendix B and Appendix C 2.2 New Sections 3.5.1.4, 3.5.2; combined OpenMP chapters 2.3 Added to reference list in Chapter 1, new Section 8.2 on autoparallelization 2.4 Expanded and updated Section 3.4, Section 3.5, and Section 7.9, Updated Section C.3, added Section C.4 (Fortran intrinstic extensions) 2.5Beta Updated Fortran Dope Vector info in Appendix D. 2.5 Added info in support for varying length character strings for Fortran in section 3.4.3. February 21, 2007 Version 3.0 Changes Document Sections Affected Removed sentence stating not possible to use FDO section 8.14.3 with OpenMP programs Updated -O3 option wording to be same as in man section 7.1 page Page ii 1-02404-15 QLogic PathScale Compiler Suite User Guide Q Version 3.0 Updated environment variable info for section 8.9.2 PSC_OMP_CPU_STRIDE and PSC_OMP_CPU_OFFSET Corrected bookmarks in PDF document PDF bookmarks Update version number All sections Update copyright date This page Updated man page options based on checked in appendix E changes eko.7. -OPT:malloc_algorithm, –f[no- ]exceptions, -gnu Added introductory info on processor affinity to section 8.9.2 OpenMP chapter Added section on section 8.9.2 PSC_OMP_AFFINITY_INHERITANCE and PSC_OMP_AFFINITY Added affinity glossary item appendix F © 2006, 2007QLogic Corporation. All rights reserved worldwide. © PathScale 2004, 2005, 2006. All rights reserved. First Published: April 2004 Printed in U.S.A. QLogic Corporation, 26650 Aliso Viejo Parkway, Aliso Viejo, CA 92656, (800) 662-4471 or (949) 389-6000 1-02404-15 Page iii QLogic PathScale Compiler Suite User Guide Version 3.0 Q Page iv 1-02404-15 Table of Contents Section 1 Introduction 1.1 Conventions Used in This Document . 1-1 1.2 Documentation Suite . 1-2 Section 2 Compiler Quick Reference 2.1 What You Installed . 2-1 2.2 How To Invoke the PathScale Compilers . 2-1 2.2.1 Accessing the GCC 4.x Front-ends for C and C++ . 2-2 2.3 Compiling for Different Platforms . 2-3 2.3.1 Target Options for This Release . 2-4 2.3.2 Defaults Flag . 2-5 2.3.3 Compiling for an Alternate Platform . 2-5 2.3.4 Compiling Option Tool: pathhow-compiled . 2-5 2.4 Input File Types . 2-6 2.5 Other Input Files . 2-7 2.6 Common Compiler Options. 2-8 2.7 Shared Libraries . 2-8 2.8 Large File Support . 2-9 2.9 Memory Model Support . 2-9 2.9.1 Support for "Large" Memory Model . 2-10 2.10 Debugging . 2-11 2.11 Profiling: Locate Your Program’s Hot Spots . 2-11 2.12 taskset: Assigning a Process to a Specific CPU . 2-12 Section 3 The PathScale Fortran Compiler 3.1 Using the Fortran Compiler. 3-1 3.1.1 Fixed-form and Free-form Files . 3-2 3.2 Modules . 3-3 3.2.1 Order of Appearance . 3-3 3.2.2 Linking Object Files to the Rest of the Program . 3-4 3.2.3 Module-related Error Messages . 3-4 3.3 Extensions . 3-5 3.3.1 Promotion of REAL and INTEGER Types . 3-5 3.3.2 Cray Pointers . 3-6 3.3.3 Directives . 3-6 3.3.3.1 F77 or F90 Prefetch Directives . 3-6 1-02404-15 Page v QLogic PathScale Compiler Suite User Guide Version 3.0 Q 3.3.3.2 Changing Optimization Using Directives . 3-8 3.4 Compiler and Runtime Features. 3-8 3.4.1 Preprocessing Source Files with -cpp . 3-8 3.4.2 3.4.2 Preprocessing Source Files with -ftpp . 3-8 3.4.3 Support for Varying length Character Strings . 3-9 3.4.4 Preprocessing Source Files with -fcoco . 3-9 3.4.4.1 Pre-defined Macros . 3-10 3.4.5 Error Numbers: The explain Command . 3-11 3.4.6 Fortran 90 Dope Vector . 3-12 3.4.7 Bounds Checking . 3-12 3.4.8 Pseudo-random Numbers . 3-13 3.5 Mixed Code. 3-13 3.5.1 Calls between C and Fortran . 3-13 3.5.1.1 Example: Calls between C and Fortran . 3-14 3.5.1.2 Example: Accessing Common Blocks from C . 3-17 3.6 Runtime I/O Compatibility . 3-18 3.6.1 Performing Endian Conversions . 3-18 3.6.1.1 The assign Command . 3-18 3.6.1.2 Using the Wildcard Option . 3-19 3.6.1.3 Converting Data and Record Headers . 3-19 3.6.1.4 The ASSIGN( ) Procedure . 3-19 3.6.1.5 I/O Compilation Flags . 3-19 3.6.2 Reserved File Units . 3-20 3.7 Source Code Compatibility . 3-20 3.7.1 Fortran KINDs . 3-20 3.8 Library Compatibility . 3-21 3.8.1 Name Mangling . 3-21 3.8.2 ABI Compatibility . 3-22 3.8.3 Linking with g77-compiled Libraries . 3-22 3.8.3.1 AMD Core Math Library (ACML) . 3-23 3.8.4 List Directed I/O and Repeat Factors . 3-23 3.8.4.1 Environment Variable . 3-24 3.8.4.2 assign Command . 3-24 3.9 Porting Fortran Code . 3-25 3.10 Debugging and Troubleshooting Fortran . 3-25 3.10.1 Writing to Constants Can Cause Crashes . 3-26 3.10.2 Runtime Errors Caused by Aliasing Among Fortran Dummy Arguments 3-26 3.10.3 Fortran malloc Debugging . 3-27 3.10.4 Arguments Copied to Temporary Variables . 3-27 Page vi 1-02404-15 QLogic PathScale Compiler Suite User Guide Q Version 3.0 QLogic PathScale Compiler 3.11 Fortran Compiler Stack Size. 3-29 Section 4 The PathScale C/C++ Compiler 4.1 Using the C/C++ Compilers . 4-2 4.1.1 Accessing the GCC 4.x Front-ends for C and C++ . 4-2 4.2 Compiler and Runtime Features. 4-3 4.2.1 Preprocessing Source Files . 4-3 4.2.1.1 Pre-defined Macros . 4-3 4.2.2 Pragmas . 4-4 4.2.2.1 Pragma pack . 4-4 4.2.2.2 Changing Optimization Using Pragmas . 4-5 4.2.2.3 Code Layout Optimization Using Pragmas . ..