The main new feature introduced in version 6.0 is support for coarrays.
print *, “Hello from”, this_image(), &
“out of”, num_images(), “images.”
print “(a, i2, a, f6.2)”, &
“The product of the image number”, this_image(), &
” and pi is”, this_image() * pi
end program hello
Hello from 1 out of 4 images.
The product of the image number 1 and pi is 3.14
Hello from 2 out of 4 images.
The product of the image number 2 and pi is 6.28
Hello from 3 out of 4 images.
The product of the image number 3 and pi is 9.42
Hello from 4 out of 4 images.
The product of the image number 4 and pi is 12.57
Both versions of 6.1 include four versions of Lapack and Blas–single, double, complex, and double comples.
Beginning with version 6.0, a portion of the revenue from the Fortran Tools will be donated to the gfortran project.
Support for Windows 10 was added in version 5.3.
Version 6.1 includes all of the features of the previous versions, with an installer, the latest gfortran that supports coarrays, an updated Code::Blocks, books, and other software.
Plplot was added in 5.1; here is a sample output:
More information about this feature can be seen in Section 11.2 of the Fortran Tools manual.
New Pro Fortran 2016 now available for Windows!
- CPU specific optimizations involving AVX, SSE4.1 and SSE4.2
- Enhanced compatibility with Windows 10
- Upgrade to the Microsoft OpenTools 2013 toolkit
- Performance enhancements to AWE including AWE Menu command key short cuts
- Support for MS-MPI v6 – AbsoftTools plug-in and the compiler
- Support for f03gl the f2003 interface to OpenGL
- Existing third party programs including IMSL v7 libraries that ran under Pro Fortran 2014-2015 should run fine without modification with the new 2016 release.
GINO Lite ($395 value) is still included for FREE!
We’ve added this compiler to our Fortran Store, go have a look!
A training class is available from The Fortran Company that covers the new features of The Fortran 03 and Fortran 08 (also known as Fortran 2003 and 2008) standards including many new features that can assist the Fortran programmer in the construction of new programs and the maintenance of existing programs.
More details may be found here.
Contact email@example.com for more information and pricing/availability.
A new development tool for Fortran programmers called Doctran is now available. Doctran is a documentation generator specifically targeted at the Fortran language. The tool allows the creation of attractive HTML documentation from your source codes. Doctran’s home is at http://www.doctran.co.uk, where more information, example outputs and downloads are available.
Doctran is a cross platform software allowing the creation of documentation from your Windows, Linux and Mac machines. The generated documentation benefits from the following navigational elements:
Treeview style navigation.
A search facility.
Linked references to kinds, interfaces and derived types.
This ensures you find the information you need quickly and helps users and developers of your codes understand their structure more easily.
Similarly to other documentation generators you can add comments within your code so that additional information can be displayed within the final output. Doctran supports both Markdown and HTML markup within comments. An advantage of Doctran over other similar tools is that it is specifically designed for Fortran codes and therefore refers to definitions using terms specific to the language.
Currently, the Fortran 95 standard is fully supported, as are the object oriented features from the Fortran 2003 standard. Doctran is under active development and new updates are being released regularly. To find out about the current set of features and how to use them, the user guide is available. A forum is also available to suggest any features you would like to see in future versions.
Doctran is a modular project and additional features are included within plugins. For instance, the features of the Fortran 95 standard are offered within a plugin. Each plugin is sold separately, meaning you only have to purchase the plugin enabling the features you require. Of course, please try out the available full featured trial which can be downloaded from http://www.doctran.co.uk/download.
To keep up to date with news about Doctran you can follow the developer’s Twitter account @DoctranApp, where updates are announced.
In many, of not most, cases, the time it takes to execute a program is not important. But there are exceptions, such as compute-intensive applications like weather prediction and simulation. Also, in some applications, response to a human must be timely, so even a few extra seconds can be significant.
Thus, in most cases, the time spent writing a program and especially debugging and modifying it are far more important than the time it takes to run it. This implies that programs should be written in a way that is clear, conforms well to the algorithms being implemented, and is easy to maintain.
To optimize a program, the first task is to figure out where the execution time is being spent; it is wasteful to tinker with parts of a program that do not contribute significantly to the execution time. In order to experiment with something, we consider the following program, some of which was extracted from a real program, but does nothing useful by itself. This program in the file
loops.f90 is included in the
Examples folder of the Fortran Tools distribution and this topic is discussed more fully in the Fortran Tools Manual.
module data implicit none integer, parameter :: N_ROWS = 150 integer, parameter :: N_COLS = 250 integer, parameter :: ABCD_SIZE = 1000 integer, dimension(:,:), allocatable :: MAT real, dimension(:,:), allocatable :: A, B, C, D integer, dimension(:), allocatable :: temp end module data module setup use random use data implicit none private public :: setup_data contains subroutine setup_data() integer :: alloc_stat allocate(MAT(N_ROWS, N_COLS), & stat=alloc_stat) if (alloc_stat > 0) then print *, "Allocation of MAT failed" stop end if allocate(A(ABCD_SIZE, ABCD_SIZE), & B(ABCD_SIZE, ABCD_SIZE), & C(ABCD_SIZE, ABCD_SIZE), & D(ABCD_SIZE, ABCD_SIZE), & stat=alloc_stat) if (alloc_stat > 0) then print *, & "Allocation of A, B, C, or D failed" stop end if call random_int(MAT, 0, ABCD_SIZE) call random_number(B) call random_number(D) call mix_mat() end subroutine setup_data ! Rearrange MAT just for something to do subroutine mix_mat() integer, parameter :: mixes = 1000000 integer :: i, ir, jr do i = 1, mixes call random_int(ir, 1, N_ROWS) call random_int(jr, 1, N_ROWS) temp = mat(ir, :) mat(ir, :) = mat(jr, :) mat(jr, :) = temp end do end subroutine mix_mat end module setup module compute use data implicit none private public :: do_loops contains subroutine do_loops() integer :: I, J, K, L, II, JJ A = 0 C = 0 DO 379 I=1,N_ROWS DO 379 J=1,N_ROWS DO 378 K=1,N_COLS DO 378 L=1,N_COLS II=MAT(I,K) JJ=MAT(J,L) IF(II .EQ. 0 .OR. JJ .EQ. 0)GO TO 378 A(II,JJ)=A(II,JJ)+B(I,J) C(II,JJ)=C(II,JJ)+D(I,J) 378 CONTINUE 379 CONTINUE end subroutine do_loops end module compute program loops use setup use compute use data, only: A, C implicit none real :: start_time, stop_time call cpu_time(start_time) call setup_data() call cpu_time(stop_time) print *, "Setup time:", & stop_time - start_time, "seconds" call cpu_time(start_time) call do_loops() call cpu_time(stop_time) print *, "Original loop time:", & stop_time - start_time, "seconds" print *, sum(A), sum(C) end program loops
This program uses a generic subroutine named
random_int in the module
random, which is also contained in the file
loops.f90. The subroutine uses the intrinsic subroutine
random_number to fill the first argument with pseudo-random integers between the second and third arguments.
Timing a Program
In order to time portions of the program, the intrinsic subroutine
cpu_time may be used. It returns the time in seconds since the beginning of execution of the program. Thus, to time a portion of a program, record the cpu time just before and just after the portion of the program to be timed. Then the execution time of the portion of the program is the difference between the two times.
Note: If a program is run on multiple processors using, for example, coarrays, OpenMP, or MPI,
cpu_time returns the total time for all of the processors. For this situation, the intrinsic subroutine
system_clock is better, as it returns elapsed time, which is probably a better indicator of the performance of the program.
system_clock is discussed in a future blog about OpenMP.
This scheme is used to time the portion of the program used to set up some values in the arrays and also to time the execution of the quadruple loops.
The result of running this program is as follows.
Setup time: 3.86882401 seconds Original loop time: 88.6865692 seconds 699112512. 702719552.
The program prints
sum(C) because some compilers could optimize away the entire quadruple loops if the results computed in the loops were never used.
These results indicate that most of the time is spent executing the part of the program with the loops, so we may concentrate on improving that part of the program. In the next blog, we will use profiling to refine our knowledge of where the compute time is being spent. But first, we can improve the execution time of the code simply by specifying optimization during compilation.
Suppose the 88-second execution time is not acceptable. Probably trying some different compiler options is the simplest way to improve the running time. The main gfortran compiler option is
-O3 also are available.
To compile the program with optimization, use the command
gfortran -O3 loops.f90
Running the program produced by this compilation produces
Setup time: 3.57242203 seconds Original loop time: 30.5449944 seconds 699112512. 702719552.
This is quite a bit better, but there is still room for improvement.
This optimization also may be accomplished by setting the appropriate compiler option in Code::Blocks.
Interval arithmetic capability is available with the Fortran Tools, thanks to a module provided by R. Baker Kearfott. This module is “built in” when using the Fortran Tools. It contains the definition of the derived type interval and the procedures to manipulate values of this type.
Quoting from an article by Kearfott:
“Interval arithmetic is useful in automatically verified computations, that is, in computations in which the algorithm itself rigorously proves that the answer must lie within certain bounds. In addition to rigor, interval arithmetic also provides a simple and sometimes sharp method of bounding ranges of functions for global optimization and other tasks.”
Using interval arithmetic, each ʺvalueʺ is really an interval of values. For example, if it is known that the value of a is between 1.3 and 1.5, it is represented as the interval [1.3, 1.5] between 1.3 and 1.5. If b is the interval [2.6. 2.9] then the sum a + b is in the interval [3.9, 4.4] and this is the sum of a and b in interval arithmetic. This is illustrated by the following simple program that uses interval arithmetic.
program add_intervals use interval_arithmetic implicit none type(interval) :: a, b, s character(len=*), parameter :: & interval_fmt = & "(' [', f0.2, ', ', f0.2, ']')" a = interval(1.3, 1.5) b = interval(2.6, 2.9) s = a + b write (unit=*, fmt=interval_fmt) s end program add_intervals
Running this program produces the output:
The features of the interval arithmetic module are described in more detail in the file Interval_Arithmetic.txt in the doc directory of the Fortran Tools distribution.
All Things Fortran
The Fortran Company is devoted to Fortran programming. This site will bring you the latest news, technical tips, programming hints, and product reviews in Fortran and scientific computing. We look forward to building a community of Fortran programmers!
— The Fortran Company Staff