Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECMWF 1 Com Intro training course - 2004 Compiling environment Compiling Environment – ecgate Dominique Lucas User Support.

Similar presentations


Presentation on theme: "ECMWF 1 Com Intro training course - 2004 Compiling environment Compiling Environment – ecgate Dominique Lucas User Support."— Presentation transcript:

1 ECMWF 1 Com Intro training course - 2004 Compiling environment Compiling Environment – ecgate Dominique Lucas User Support

2 ECMWF 2 Com Intro training course - 2004 Compiling environment Content Introduction Fortran Compiler Compiler Options Word Lengths Fortran I/O Linking Libraries Debugging Profiling Practical session

3 ECMWF 3 Com Intro training course - 2004 Compiling environment Introduction Why compiling at ECMWF? decoding of (MARS) data model runs Which platforms available? Unix IBM server (ecgate) IBM Supercomputers (hpca) Which compilers? Fortran (77/90/95) C/C++ Which platform to use? High Performance Computing Facility (HPCF) for computing intensive work, including any // work. IBM server for decoding or I/O bound work.

4 ECMWF 4 Com Intro training course - 2004 Compiling environment Compilers IBM compilers: xlf[90|95] for Fortran xlc for C xlC for C++ Which version do I use? lslpp –l xlf* lslpp –l xlC* How to select a different version of a Compiler? If a different version is available, this can be set with a ECMWF local utility called use, e.g.: use xlf_8113

5 ECMWF 5 Com Intro training course - 2004 Compiling environment Compilers File suffixes for fortran.f or.F to run the C preprocessor.f90 with -qsuffix=f=f90.F90 with –qsuffix=f=f90:cpp=F90

6 ECMWF 6 Com Intro training course - 2004 Compiling environment Compilers Common file suffixes and files.o :object file.a : archive file (library).so:share object (library).s: assembler listing.list: source listing.mod:fortran 90 module files a.out:default name of executable

7 ECMWF 7 Com Intro training course - 2004 Compiling environment Fortran source code format Fixed with xlf Free with xlf[90|95] Format can be given with options –qfixed or -qfree A few examples $ xlf prog.f # fixed f77 $ xlf prog.F # fixed f77 via cpp $ xlf90 –qsuffix=f=f90 prog.f90# free f90 $ xlf90 prog.F# free f90 via cpp Fortran compiler

8 ECMWF 8 Com Intro training course - 2004 Compiling environment Setting options – given by increasing precedence In the configuration file – system wide less /etc/xlf.cfg At the command line – used for all the file xlf –qfixed prog.f As a directive in the source code – for the next unit. head prog.f @PROCESS FIXED Fortran Compiler options

9 ECMWF 9 Com Intro training course - 2004 Compiling environment Fortran 77 / f90 -ccompilation only, no linking -qsource listing -qrealsize=8 64bit real variables -O optimisation -g debugging -v verbose -help display usage Defaults: underscores (-qextname) and 32-bit addressing mode (-q32) Well over 100 options. See man page for full list of options. Fortran Compiler common options

10 ECMWF 10 Com Intro training course - 2004 Compiling environment 32bit reals and integer by default The option –qrealsize=8 promotes real variables to 64bit Integer*8 and 128bit floating point computation available and slightly slower than integer*4 or real*8 computation. When using a library, check its precision, e.g. for EMOSLIB. Word lengths – precision

11 ECMWF 11 Com Intro training course - 2004 Compiling environment Unit numbers: Units 0, 5 and 6 reserved, respectively for STD error, input and output. Connecting files to Units: open (1,file="data",...) ln -s data fort.1 Fortran record types: formatted/unformatted read (1)length list-directed write(*,*)'lenght=',length Namelist read(5,NML=name_l) Fortran I/O

12 ECMWF 12 Com Intro training course - 2004 Compiling environment Access method: sequential access direct access record length - in bytes IEEE format - big-endian real*4 bit 31: sign bits 30-23: exponent bits 22-0: mantissa real*8 bit 63: sign bits 62-52: exponent bits 51-0: mantissa Fortran I/O – data representation

13 ECMWF 13 Com Intro training course - 2004 Compiling environment Use xlf to link, eg. $ xlf -o prog prog.f $EMOSLIB duplicated entries. Static vs. dynamic linking: Option –bdynamic or –bstatic Default: -bdynamic Loadmap useful to identify duplicated entries or unresolved symbols $ xlf –bloadmap:map –o prog prog.f $EMOSLIB $ less map Linking

14 ECMWF 14 Com Intro training course - 2004 Compiling environment Static and shared/dynamic libraries Use "ar" to build static libraries, eg. $ ar -vr libmy.a *.o Use xlc" to build shared/dynamic libraries, $ cc -G *.o –o libmy.a $ xlf -o prog prog.f -L. –lmy $ export LIBPATH=${LIBPATH}:. $./prog Alternatively, see http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/genprogc/create_shared_lib.htm#HDRA144C1671 http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/genprogc/create_shared_lib.htm#HDRA144C1671 Building libraries

15 ECMWF 15 Com Intro training course - 2004 Compiling environment checking: argument checking: -qextchk xlf –qextchk prog.f –o prog checking done at compilation/linking array bounds checking: -C xlf –C prog.f –o prog./prog checking done at runtime undefined reference checking xlf –qinitauto=FF –qflttrap prog.f –o prog checking done at runtime Debugging

16 ECMWF 16 Com Intro training course - 2004 Compiling environment nothing generated on floating point exception. Floating point trapping % xlf –qflttrap=overflow:invalid:zerodivide:enable \ –qsigtrap prog.f –o prog %./prog... interactive window based debugger: - totalview Core files – how to get a traceback % dbx./prog core <<eof where eof Debugging – floating point exceptions

17 ECMWF 17 Com Intro training course - 2004 Compiling environment timex - command timer $ timex [-ops] a.out -O and other options at compilation for faster execution. See man page. other AIX applications, like prof, gprof $ xlf –p prog.f $ a.out $ prof Profiling - tuning


Download ppt "ECMWF 1 Com Intro training course - 2004 Compiling environment Compiling Environment – ecgate Dominique Lucas User Support."

Similar presentations


Ads by Google