Questions tagged [fortran2008]

Fortran 2008 is the latest (released) Standard of the Fortran programming language. Amongst other improvements, Fortran 2008 brings concurrent programming to Fortran. This tag should be used only for questions which relate specifically to this language revision. The more general Fortran tag is preferred in all other cases and it should be added even when this tag is appropriate.

Fortran 2008 is an extension to the 2003 Standard and was released on June 7, 2010.

Fortran (previously FORTRAN, derived from Formula Translating System) is a general-purpose, imperative programming language that is especially suited to numeric computation and scientific computing. Originally developed by IBM in the 1950s for scientific and engineering applications, Fortran came to dominate this area of programming early on and has been in continuous use for over half a century in computationally intensive areas such as numerical weather prediction, finite element analysis, computational fluid dynamics, computational physics and computational chemistry. It is one of the most popular languages in the area of high-performance computing and is the language used for programs that benchmark and rank the world's fastest supercomputers.

Amongst other improvements, Fortran 2008 brings concurrent programming to Fortran.

The new capabilities include:

  • Submodules – Additional structuring facilities for modules; supersedes ISO/IEC TR 19767:2005
  • Coarray Fortran – a parallel execution model
  • The DO CONCURRENT construct – for loop iterations with no interdependencies
  • The CONTIGUOUS attribute – to specify storage layout restrictions
  • The BLOCK construct – can contain declarations of objects with construct scope
  • Recursive allocatable components – as an alternative to recursive pointers in derived types

A summary of new features can be found in the Fortran wiki, the complete Standard document is available here.

References:

65 questions
8
votes
3 answers

Is there an alternative to GETCWD() in Fortran 2003-2008

The GNU Extension to the GNU Fortran compiler provides the subroutine GETCWD() that well, gets the current working directory. However, my code has to be portable to the ifort and nagfor compiler as well and I use F2003 features. So, is there an…
LienM
  • 135
  • 1
  • 7
6
votes
1 answer

Segmentation fault with deferred functions and non_overridable keyword

I am developing an object-oriented Fortran code for numerical optimization with polymorphism supported by abstract types. Because it is a good TDD practice, I'm trying to write all optimization tests in the abstract type class(generic_optimizer),…
Federico Perini
  • 1,414
  • 8
  • 13
6
votes
1 answer

When should I use DO CONCURRENT and when OpenMP?

I am aware of this and this, but I ask again as the first link is pretty old now, and the second link did not seem to reach a conclusive answer. Has any consensus developed? My problem is simple: I have a DO loop that has elements that may be run…
physkets
  • 183
  • 3
  • 12
5
votes
1 answer

In what situation would you use "module procedure" in a submodule when creating separate module procedures?

I understand the general benefits of submodules in Fortran 2008+, but I'm having trouble understanding the benefit of one of the syntax options. If I want to create separate module procedures (where the body of the procedure is in a submodule) I…
joshindc
  • 77
  • 6
5
votes
2 answers

Function overloading in Fortran 2008

I'm beginning with Fortran 2008 and I'm struggling with OOP greatly. It seems, that there are very few materials, which explain a very basic OOP concepts in 2008 language standard. I've found information about inheritance, but I was unable to find…
Eenoku
  • 2,741
  • 4
  • 32
  • 64
5
votes
0 answers

Using MPI_Isend with mpi_f08 subarrays for high-dimensional arrays in ifort corrupts data

I am trying to use the mpi_f08 module to do halo exchange on a series of rank 4, 5, and 6 arrays. Previously I used subarray types for this, but ended up with so many that ifort couldn't keep track of all of them and started corrupting them when…
Ed Bennett
  • 63
  • 8
5
votes
1 answer

Is there an intrinsic function for initializing arrays to zero in Fortran?

Is there a way to set an array (vector, or matrix, or even a scalar) to zero yet in Fortran? 2003/2008 seem to be taking Fortran to a very modern level, and I have to wonder if they have included an easy way to set array values to zero without…
Charlie Crown
  • 1,071
  • 2
  • 11
  • 28
5
votes
2 answers

Constant function pointer array in Fortran 2003

Dear Fortran programmers, does anybody know, whether it is possible to declare a constant (parameter) procedure pointer array in Fortran 2003 or above? As given below, I have a switcher function, which calls different functions depending on an…
Bálint Aradi
  • 3,754
  • 16
  • 22
4
votes
2 answers

Fortran 2008 - user defined I/O procedure for CLASS(*)

I'm trying to make a type, which would serve as a wrapper for an arbitrary other types, so I could make a heterogeneous array, as it's advised in Heterogeneous array of Fortran classes and Creating heterogeneous arrays in Fortran. So, I've tried to…
Eenoku
  • 2,741
  • 4
  • 32
  • 64
4
votes
3 answers

Using Iso_Fortran_Env to set a function's Kind value

How would one go about using ISO Fortran Env's intrinsic to set a function's return KIND value in a manner which is idiomatic to Fortran 2008? Normally within the main program, I can just use the ISO Fortran intrinsics as follows: program name here …
AmphotericLewisAcid
  • 1,824
  • 9
  • 26
4
votes
1 answer

Reading integers of unknown width in Fortran

I am trying to read the integers in this line: # 14 14 10 in Fortran 2008. I attempted to use this code: read(21, "(A, I,I,I)") garbage, a, b, c but this is not standard conforming. Intel Fortran issues a warning "Fortran 2008 does not allow this…
Stein
  • 3,179
  • 5
  • 27
  • 51
4
votes
1 answer

Automatic initialization of procedure pointer arrays

Is there any way to automatically initialize a constant array of procedure pointers? I have a bunch of routines, which have to be called depending on the value of an integer variable. Instead of using a select case statement, I would like to use…
Bálint Aradi
  • 3,754
  • 16
  • 22
3
votes
1 answer

Can I create a Linked list in Fortran only using ALLOCATABLE variables and not pointers?

Can I create a Fortran Linked List without pointers in this way: List: TYPE Allocation_List PRIVATE CLASS(*), ALLOCATABLE :: Item CLASS(Allocation_List), ALLOCATABLE :: Next CONTAINS PROCEDURE, PASS(self), PUBLIC,…
3
votes
0 answers

Why does a DO CONCURRENT statement gives a strange result?

Let us compile the following Fortran program: program main implicit none integer::j complex::y(2) real::x(2) x(1)=1.0 x(2)=2.0 do j=1,2 y(j)=FF(x(j)) enddo write(6,*) write(6,*) y,"by DO" …
MiuraB
  • 31
  • 2
3
votes
0 answers

Memory leak with allocatable array in fortran 2008

I read on this tutorial that allocatable variables are automatically deallocated when they go out of scope. I wrote a trial program to test this, and I'm finding that valgrind says there is a memory leak. My trial program is: program arrays use,…
physics_researcher
  • 638
  • 2
  • 9
  • 22
1
2 3 4 5