Time really flies! About six years ago, the Fortran 2003 standard (commonly abbreviated as F03) was officially published in an attempt to modernize the language. Over the past few years, we've seen a steady increase of interest in adoption of F03 features in the field, particularly the object-oriented programming (OOP) and C interoperability features. F03's C interoperability features struck a chord in the scientific computation community as mixed language applications are becoming the mainstream. In addition, more and more scientific and... [More]
Our colleague Jim Xia recently coauthored a new book: Scientific Software Design: The Object-Oriented Way (ISBN: 978-0521888134). The book is a great example of how to use the object-oriented features of Fortran 2003 in scientific design patterns. BTW, the examples in the book compile with XL Fortran.
The Back Cover: This book concerns software design. Although many current discussions of scientific programming focus on scalable performance, this book focuses on scalable design. The authors analyze how the structure of a package... [More]
IBM marks its centennial today. As part of our 100 days of celebration, IBM highlighted 100 of its best achievements in the Icons of Progress site. FORTRAN is featured as the March 3rd icon.
Since its release in 1957, the Fortran language has continued to evolve, with the latest versions adding object-orientation, parameterized derived types, and distributed programming. No one knows what innovations the next 100 years will bring, but who knows, Fortran's innovation, longevity, and high performance might be highlighted in the next... [More]
XL Fortran 13.1 provides a new utilization tracking and reporting feature to help you understand the compiler utilization within your organization. You use this feature to help determine whether your organization’s use of the compiler matches your compiler license entitlements. When enabled, each invocation of the compiler is recorded in a compiler utilization file. The utilization reporting tool can then be used to generate a report of the overall usage of the compiler within your organization. In particular, the report indicates whether the... [More]
The latest release of XL Fortran introduces new data types and intrinsic functions for the Vector Scalar eXtension (VSX) instruction set tuned for the POWER7 processor. With the VSX instruction set and the original Vector Multimedia eXtension (VMX) intrinsic functions; you can efficiently manipulate vector operations in your application. The Mathematical Acceleration Subsystem (MASS) libraries contain an accelerated set of frequently used mathematical intrinsic functions that provide improved performance over the corresponding standard system... [More]
One of the main features of Fortran 2003 is object-orientation (OO). Derived types can now have specific and generic type-bound procedures, type-bound defined operators, type-bound defined assignment, type-bound finalizers (destructors), and type-bound user-defined derived type IO routines. For example, type base below has specific type-bound procedures find, assign, add and writef, defined operator +, type bound assignment, and a user-defined derived type IO formatted write routine:
integer, allocatable ::... [More]
With multicore and manycore machines becoming popular nowadays, more and more applications are using multi-threading to take advantage of the hardware capabilities and get better performance. Fortran applications are no exception. This blog provides tips on creating thread-safe Fortran applications with XL Fortran.
Like other languages, protect global and heap variables that may be accessed directly or indirectly by multiple threads. In Fortran, global variables are common blocks and module variables. Heap variables are ALLOCATABLE... [More]
Last week, I wrote about user-defined constructors in Fortran 2003. This week, I'd like to discuss user-defined assignment bindings and their role as "copy constructors" for allocatable components.
Like Fortran 90's user-defined assignment interface blocks, Fortran 2003's user-defined assignment bindings define a set of subroutines the compiler must call to perform assignment between objects of two types. User-defined assignment bindings are treated differently from interface blocks when you have intrinsic assignment between types... [More]
C interoperability is one of the most popular features of Fortran 2003. Recently, I was part of a discussion about why XL Fortran flags the following as invalid:
logical(8), target :: logicalarray(20)
p = c_loc(logicalarray) ! XLF will flag an error here
According to Fortran 2003 (and Fortran 2008), the argument to the C_LOC function must either be of an interoperable type or must be a nonpolymorphic scalar. The standard tries to be interoprable with the _Bool type in C, which is of size 1. So... [More]
In the Fortran language, the kind type parameter of an intrinsic type is specified between parenthesis following the intrinsic type keyword. For example if you declare a variable of type REAL(8), the variable will have a kind type parameter equal to 8 and it will occupy 8-bytes in memory. A variable of type COMPLEX consists of a real and an imaginary part. Both the real and the imaginary parts are of type REAL. By specifying the kind type parameter in a COMPLEX type declaration, you specify the kind type parameter of each part of the complex... [More]
Last week, an XLF user asked a question in the comp.lang.fortran newsgroup about how to get make to compile some Fortran files with fixed form and others with free form. There are several ways of doing this in XLF:
If you use the ".f" file extension only for FORTRAN 77 files, you can use the generic "xlf" command to compile. The "xlf" command checks the file extension of the source file, and chooses default options, including source form, that are appropriate for that extension. For example, if you compile... [More]
Check-out this tutorial to learn how to use the interoperability features of the IBM XL Fortran and the IBM XL C/C++ compiler to integrate Fortran, C and Java source code into an application. The demonstration shows how to call Java source routines from Fortran and vice versa. Interoperability is useful for integrating parts written in different languages into an application. This enables developers to take advantage of language best situated for the job or easily integrate legacy assets into a new application. Interoperability of IBM XL... [More]
If you've tried calling system functions from a Fortran program, you might have run into difficulties because these functions don't have a Fortran interface. For example, the following code will fail execution:
p = malloc(40)
if (p == 0) then
! malloc error. Print errno
print *, "malloc failed. errno=", errno()
x = [10.0, 5.0, 4.0, 7.0, 2.0, 1.0, 3.0, 6.0, 9.0, 8.0]
print *, x
The reason is that malloc , errno , exit , and free do not have an... [More]
Just a quick note to let you know that these Fortran PTFs are available! October 2011 Update for XL Fortran for Linux, V13.1 Compiler: http://www-01.ibm.com/support/docview.wss?uid=swg24031171 October 2011 Update for XL Fortran for Linux V13.1 Runtime: http://www-01.ibm.com/support/docview.wss?uid=swg24031172 Can't find the updates for your compilers? Check out our Fortran compilers latest updates page: http://www-01.ibm.com/support/docview.wss?rs=43&uid=swg21156900
The November 2011 PTF for XL Fortran for AIX, V13.1 is now available at the following links and on Fix Central . November 2011 PTF for XL Fortran for AIX, V13.1 November 2011 PTF for XL Fortran Runtime for AIX, V13.1 Can't find the updates for your compilers? Check out our C/C++ compilers latest updates page here .