13,207 questions
-1
votes
0
answers
55
views
NaN output of a multi-loop fortran+OpenMP code
In the following code, ekk, vkk, and tau are read from external files and stored as arrays. The code works fine serially but in parallel gives NaN for all the tot_delta. I would appreciate any hints ...
-3
votes
0
answers
98
views
How do I read a CSV file in a Fortran program? [closed]
When I try to read a CSV (comma-separated values) file in a Fortran program I get an end-of-file execution error.
I have tried including the commas as literals in the format declaration and the ...
-1
votes
1
answer
103
views
Converting Integer array to character integer gives end-of-file fortran 90
I have a module which takes any number of months as integers. I want to convert the integers into characters.
In a different program I'm using both integers and characters, so I need the conversion.
...
2
votes
1
answer
91
views
Fortran subroutine not returning the expected value
In my Fortran program below I am trying to construct an array of abbreviated month names from month numbers. I enter a month number and immediately call a subroutine to convert the number to an ...
Advice
1
vote
4
replies
112
views
In Fortran, what is a short working example of parallel programming with communicating threads?
(UPDATE: I found one answer, see code at end)
Fortran has native built-in parallel features. I'm trying to use them in a program that does a search for a solution.
program do_co
implicit none
real(...
1
vote
1
answer
192
views
In Fortran, is there a guaranteed way to get a transposed array pointer?
UPDATE: See the answer I added, for a "somewhat acceptable" solution
For a 2-dimensional array, the expression transpose(x) is not acceptable in "variable context" so you can't ...
0
votes
1
answer
124
views
Unknown issue with polymorphic subroutine using MPI_Type_indexed for file IO
I have a subroutine that uses MPI_Type_indexed as a type to set a file view to output data out of a CFD program.
The subroutine has one input, local_data_array,
it identifies the type of ...
Best practices
2
votes
3
replies
94
views
Behaviour of failed `allocate` if `stat` is not given
I often write code like this
allocate(a(n), stat=stat)
if (stat /= 0) then
write(*,*) "Allocation failed, stat =", stat
stop 1
end if
I understand that I should check stat, if I ...
Advice
2
votes
3
replies
80
views
Does a masked region have to be in an explicit parallel region?
This is an odd OpenMP question triggered by a possible compiler bug (?) we are chasing down. For a long time, we've had code that had:
!$omp masked
...
!$omp end masked
that didn't have an explicit ...
Best practices
1
vote
6
replies
194
views
What is THE way of dealing with integer kinds in Fortan?
I am puzzled by all the possibilities. After some research it appeared to me that in the end the best thing is to declare integers without an explicit kind, since the default kind is essentially ...
Advice
0
votes
0
replies
25
views
Is lastprivate on nested loop indices valid without a COLLAPSE clause?
For the flang implementation of OpenMP, we are discussing the following program. At issue is whether e.g. ii, iii, and iiii should be consider private or lastprivate, and if the former, whether the ...
Advice
0
votes
2
replies
78
views
OpenMP 5.2 declare simd with linear(p: ref) inconsistency between specification and example?
I'm seeking opinions on what appears to be an inconsistency between the OpenMP 5.2 specification and an official example regarding the declare simd directive with the linear(p: ref) clause.
1. The ...
Tooling
3
votes
4
replies
190
views
Converting types from Fortran to C
I am working on a library designed to work with fortran allocated memory in C.
I want to add support for the derived types. For that I need an equivalent type hardcoded in C, that is what a library ...
4
votes
0
answers
152
views
Vectorisation of FMA with correct rounding using IEEE_FMA
I want to parallelize modular reduction using floating-point arithmetic over a matrix with coefficients over a quotient ring Z/pZ.
The modular reduction using floating-point arithmetic algorithm has ...
1
vote
1
answer
184
views
How do I open a simple Win32 window in Fortran?
I have been searching the Internet for sample code on how to open a basic window using just Fortran without any 3rd party libraries. I want to do it from scratch. But there are no tutorials or posts ...