Compiling IBM Open XL Fortran programs
This section explains how to compile a source program using the invocation commands.
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/openxlf/17.1.0/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, xlf90_r, xlf95_r, xlf2003_r, and xlf2008_r commands use the components for multithreading (libraries, crt0_r.o, and so on) to link and bind object files.
| Driver Invocation 1 | Chief Functionality | Linked Libraries |
|---|---|---|
| xlf | Selected Fortran language level 2 | libxlf90.a |
| xlf_r | The threadsafe version of the selected language level, operating system default POSIX pthreads API. 2 | libxlf90.a |
| f77, fort77 | FORTRAN 77 | libxlf90.a |
| xlf90, f90 | Fortran 90 | libxlf90.a |
| xlf90_r | Threadsafe Fortran 90, operating system default POSIX pthreads API | libxlf90.a |
| xlf95, f95 | Fortran 95 | libxlf90.a |
| xlf95_r | Threadsafe Fortran 95, operating system default POSIX pthreads API | libxlf90.a |
| xlf2003 | Fortran 2003 | libxlf90.a |
| xlf2003_r | Threadsafe Fortran 2003, operating system default POSIX pthreads API | libxlf90.a |
| f2003 | Fortran 2003 | libxlf90.a |
| xlf2008 | Fortran 2008 | libxlf90.a |
| xlf2008_r | Threadsafe Fortran 2008, operating system default POSIX pthreads API | libxlf90.a |
| f2008 | Fortran 2008 | libxlf90.a |
- These invocation commands are contained in the /opt/IBM/openxlf/17.1.0/bin directory.
-
The xlf and xlf_r invocation commands select the appropriate language level according to the suffix of the source file names. The other invocation commands behave consistently no matter what the Fortran source file name suffix is. See the following example:
The behavior is as follows:xlf program1.f program2.f90 program3.f95 program4.f03 program5.f08- The
program1.ffile is compiled as if the invocation command was f77. - The
program2.f90file is compiled as if the invocation command was xlf90. - The
program3.f95file is compiled as if the invocation command was xlf95. - The
program4.f03file is compiled as if the invocation command was xlf2003. - The
program5.f08file is compiled as if the invocation command was xlf2008.
- The
libxlf90.a is provided for both threaded and non-threaded applications. XL Fortran determines at run time whether your application is threaded.
IBM® Open 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, xlf90_r, xlf95_r, xlf2003_r, or xlf2008_r invocation command ensures the proper linking.
- For f77, fort77, f90, f95, f2003, xlf, xlf90, xlf95, xlf2003, and xlf2008 invocation commands, the directive trigger is IBM* by default.
- For all other invocation commands, the directive triggers are IBM* and IBMT by default.
- When -qthreaded is in effect, the compiler also recognizes the IBMT directive trigger.
