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]
Operator overloading is a key ingredient of object-oriented programming. Fortran (starting from Fortran 90) supports operator overloading through defined operator which allows you to extend an intrinsic operator or define a new operator. For example, you can extend "+" to perform "var1 = var2 + var3" where var1, var2, and var3 are derived-type objects. Likewise, you can define a new operator, such as ".UNION.", to compute the union of two sets " set3 = set1 .UNION. set2", where set1, set2, and set3 could... [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]
You might have noticed that the compiler creates files with the mod file extension. These are what we call module symbol files.
A module symbol file contains information about the specification part of a Fortran module. The file name is made of the module name followed by the mod extension. For example, if your Fortran module is called weather , the compiler will generate a module symbol file called weather.mod . The same module symbol file can be used in 32-bit and 64-bit compilations, provided you add the required information to it.
Author: Ka Lin, Pooja Dayanand
We're trying to summarize the benefit of using the BLOCK construct that is introduced by the Fortran 2008 standard. However, we finally draw a conclusion that the BLOCK construct is useful in very large programs, because in small programs, variables are much easier to keep track of.
Nevertheless, we would like to use the following small programs to illustrate the benefits.
The BLOCK construct improves the readability of code by allowing you to declare variables closer to where they are... [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]
IBM’s Blue Gene/Q supercomputer, Sequoia, at the Lawrence Livermore National Lab took the number one ranking in the TOP500 list of the world’s fastest machines. And 21 other Blue Gene/Q configurations also earned spots on the list – including four in the top 10. Quite an achievement, given that IBM only started shipping these systems in volume to clients earlier this year. Read more
The short answer is no. However, Fortran has its own mechanisms for providing additional flexibility in procedure references. For instance you can declare a dummy argument as "optional" by giving it the OPTIONAL attribute. This allows you to skip the actual argument that would normally get associated with that dummy argument in a call. For instance, in the following program:
call sub(10, 20)
call sub(10, 20, 30)
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]
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]
Looking to see and learn about the latest compiler enhancements in XL Fortran on AIX and Linux. Download a trial. Here is quick recap of some of the highlights of these new compilers: Compliance to ISO programming language standards including the Fortran 2003
standard and partial support for the Fortran 2008 standard Support for the OpenMP 3.1 industry specification Compile-time performance and scalability improvements Enhancements to the diagnostic reports that can help you identify
opportunities to improve the performance of your... [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]
Are you concerned about program security? The XL Fortran v13.1 and XL C/C++ v11.1 compilers have a stack protection feature. It is not an active system that protects or denies write access to the stack. Instead, it is a defensive mechanism that can detect a corrupted or overwritten stack and take the appropriate action. Regardless of how the corruption occurred, either due to programming error or an attack on your system, stack protection always terminates the executing program.
The compilers have two new command line options dealing... [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]
New and enhanced features in XL Fortran Version 14.1 include support of language
features that you can use to port code easily when moving to IBM Power Systems,
as well as improved compilation time at commonly used optimization levels. This
article for those who have some experience with previous versions of XL Fortran
gives the details and describes other highlights. Read more .
Check out new exercises in the Power sandbox. You can find them below.
You can learn about compiling with a list of options defined in a file, debugging optimized code, new OpenMP3.1 constructs, performance benefits of using F2008 CONTIGUOUS attribute and the F2008 BLOCK construct. Optimize server performance and programmer productivity with IBM
compilers Compile with a list of options defined in a file Debugging optimized XL Fortran code New and enhanced atomic constructs in OpenMP 3.1 The final clause in OpenMP 3.1... [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]
Check out this webinar by IBM Systems Magazine about Smart Tools on IBM i, AIX, and Linux for Faster Time to Market Get an early look at the next version of Rational's offerings for Power Systems. New advancements in compilers and significantly enhanced development tools will give your organization a competitive advantage! Listen to the replay .
The July 2012 PTF for XL Fortran for AIX, V13.1 (VRMF: 184.108.40.206) is now available at the following links and on Fix Central . July 2012 PTF for XL Fortran for AIX, V13.1 July 2012 PTF for XL Fortran Runtime for AIX, V13.1 Can't find the updates for your compilers? Check out our Fortran compilers latest updates page here .