Compiling XL Fortran programs
.----------------------------------. V | >>-+-xlf-------+----+--------------+----input_file---+--------->< +-xlf_r-----+ '-cmd_line_opt-' +-xlf_r7----+ +-f77-------+ +-fort77----+ +-xlf90-----+ +-xlf90_r---+ +-xlf90_r7--+ +-f90-------+ +-xlf95-----+ +-xlf95_r---+ +-xlf95_r7--+ +-f95-------+ +-xlf2003---+ +-xlf2003_r-+ +-f2003-----+ +-xlf2008---+ +-xlf2008_r-+ '-f2008-----'
These commands all accept essentially the same Fortran language. The main difference is that they use different default options (which you can see by reading the configuration file /opt/IBM/xlf/15.1.3/etc/xlf.cfg.nn where .nn represents the operating system level).
The invocation command performs the necessary steps to compile the Fortran source files, assemble any .s files, and link the object files and libraries into an executable program. In particular, the xlf_r, xlf_r7, xlf90_r, xlf90_r7, xlf95_r, xlf95_r7, xlf2003_r, and xlf2008_r commands use the components for multi-threading (libraries, crt0_r.o, and so on) to link and bind object files.
Driver Invocation | Path or Location | Chief Functionality | Linked Libraries |
---|---|---|---|
xlf | /opt/IBM/xlf/15.1.3/bin | Selected Fortran language level | libxlf90.a |
xlf_r | /opt/IBM/xlf/15.1.3/bin | The threadsafe version of the selected language level, operating system default POSIX pthreads API. | libxlf90.a |
xlf_r7 | /opt/IBM/xlf/15.1.3/bin | The threadsafe version of the selected language level, Draft 7 POSIX pthreads API. | libxlf90.a |
f77, fort77 | /opt/IBM/xlf/15.1.3/bin | FORTRAN 77 | libxlf90.a |
xlf90, f90 | /opt/IBM/xlf/15.1.3/bin | Fortran 90 | libxlf90.a |
xlf90_r | /opt/IBM/xlf/15.1.3/bin | Threadsafe Fortran 90, operating system default POSIX pthreads API | libxlf90.a |
xlf90_r7 | /opt/IBM/xlf/15.1.3/bin | Threadsafe Fortran 90, Draft 7 POSIX pthreads API | libxlf90.a |
xlf95, f95 | /opt/IBM/xlf/15.1.3/bin | Fortran 95 | libxlf90.a |
xlf95_r | /opt/IBM/xlf/15.1.3/bin | Threadsafe Fortran 95, operating system default POSIX pthreads API | libxlf90.a |
xlf95_r7 | /opt/IBM/xlf/15.1.3/bin | Threadsafe Fortran 95, Draft 7 POSIX pthreads API | libxlf90.a |
xlf2003 | /opt/IBM/xlf/15.1.3/bin | Fortran 2003 | libxlf90.a |
xlf2003_r | /opt/IBM/xlf/15.1.3/bin | Threadsafe Fortran 2003, operating system default POSIX pthreads API | libxlf90.a |
f2003 | /opt/IBM/xlf/15.1.3/bin | Fortran 2003 | libxlf90.a |
xlf2008 | /opt/IBM/xlf/15.1.3/bin | Fortran 2008 | libxlf90.a |
xlf2008_r | /opt/IBM/xlf/15.1.3/bin | Threadsafe Fortran 2008, operating system default POSIX pthreads API | libxlf90.a |
f2008 | /opt/IBM/xlf/15.1.3/bin | Fortran 2008 | libxlf90.a |
xlf program1.f program2.f90 program3.f95 program4.f03 program5.f08
the behavior is as follows:- The program1.f file is compiled as if the invocation command was f77.
- The program2.f90 file is compiled as if the invocation command was xlf90.
- The program3.f95 file is compiled as if the invocation command was xlf95.
- The program4.f03 file is compiled as if the invocation command was xlf2003.
- The program5.f08 file is compiled as if the invocation command was xlf2008.
libxlf90.a is provided for both threaded and non-threaded applications. XL Fortran determines at run time whether your application is threaded.
XL Fortran provides the library libxlf90_t.a, in addition to libxlf90.a. libxlf90_t.a exports the same entry points as libxlf90.a does. Unlike libxlf90.a, libxlf90_t.a does not provide thread synchronization or thread-reentrant routines. Therefore, only one Fortran thread at a time can perform I/O operations or invoke Fortran intrinsics. You can use libxlf90_t.a instead of libxlf90.a in multithread applications where there is only one Fortran thread, to avoid the thread synchronization overhead in libxlf90.a.
When you bind a multithreaded executable with multiple Fortran threads, -lxlf90 should appear instead of -lxlf90_t in the command line. Note that using the xlf_r, xlf_r7, xlf90_r, xlf90_r7, xlf95_r, xlf95_r7, xlf2003_r, or xlf2008_r invocation command ensures the proper linking.
- For f77, fort77, f90, f95, f2003, xlf, xlf90, xlf95, xlf2003, and xlf2008, the directive trigger is IBM* by default.
- For all other commands, the directive triggers are IBM* and IBMT by default.
- The compiler turns on automatic parallelization.
- In addition to IBM* and IBMT, the compiler also recognizes the IBMP, SMP$, and $OMP directive triggers.
- If you specify the -qsmp=omp option, the compiler only recognizes the $OMP directive trigger.