How are we doing? Please help us improve Stack Overflow. Take our short survey

Questions tagged [fortran]

Fortran is a general-purpose, procedural, imperative programming language that is especially suited for numeric computation and scientific computing. Since 2003, standard Fortran also supports object-oriented programming. Fortran 2008 introduced coarrays for SPMD parallel programming. This tag should be applied to all questions about the Fortran language; other specific tags can be added for compilers, language revisions and particular aspects of use.

Filter by
Sorted by
Tagged with
-1 votes
0 answers
24 views

Extension for Modern-Fortran in Visual Studio Code

I am trying to use Visual Studio (VS) Code to debug and run Fortran. I have already installed the extensions for 'Modern Fortran', 'Fortran Breakpoint Support' and 'fortran'. I also added the ...
Kieran's user avatar
  • 121
0 votes
1 answer
27 views

OpenMP/fortran shared variables in a function become "undefined"

The fortran code below is a minimal working example of a much larger code I am trying to run. The code runs fine in serial, but crashes if run in parallel. My understanding is that the function cannot ...
phdstudent's user avatar
  • 1,060
0 votes
0 answers
31 views

Very slow when using Matlab mex fortran

Recently, I try to use Maltab mex to improve the computation speed. My compile is > mex COMPFLAGS="-Qopenmp $COMPFLAGS"... > LINKFLAGS="/Qopenmp $LINKFLAGS".....
kun zhao's user avatar
0 votes
1 answer
47 views

Does the code following the end of a loop label execute in the loop

In this loop: DO 180 J=1,9 K=9*(I-1)+J 180 ZX(K)=0.D0 How many times will (ZX(K)=0.D0 execute? Once or 9?
Glen Herman's user avatar
0 votes
1 answer
71 views

Fortran C interface for program containing non-c-interoperable derived type

I have a large Fortran code base for which I am trying to write a Python interface. I decided I would go the Cython route. However, I have derived types that are not C-interoperable. As an example, ...
tmph's user avatar
  • 179
0 votes
1 answer
40 views

In Fortran IV, how are arrays assigned by a single value? And how are some goto operations handled? (65's code Ackermann example)

I have a semantic problem with a very old Fortran IV (ff66) program. This leads to 2 questions. *** Context *** The program should calculate the Ackermann function in O(1) memory. It cames from here: ...
Frédéric Gava's user avatar
0 votes
0 answers
49 views

Why does accessing an index of 0 length array not throw an out of bounds access violation error?

Using intel fortran oneapi version 2023.0.0.25839. I've turned on all run-time checks using /check:all. If the following throws a "forrtl: severe (408): fort: (2): subscript #1 of the array A has ...
TrippLamb's user avatar
  • 1,432
1 vote
1 answer
62 views

make : ifort : command not found

I am trying to compile a Fortran code on a Linux Ubuntu machine and I'm getting the following error (in bold): calcul@gpuserver:~/dp3D/src$ ./makedp3D Do you want to use standard directory /home/...
Júlia Bonaldo's user avatar
1 vote
0 answers
108 views

Issue with the initialization of a large, dynamically allocated array

I have two versions of the same Fortran code: Version 1 (static allocation): program main implicit none integer,parameter :: n=1000000 integer,parameter :: m=10000 real(8) a(n,m) a=0.d0 ...
Roland Tóbiás's user avatar
0 votes
0 answers
25 views

While running some test code in Fortran, I received an error "f951: Fatal Error: Cannot open file 'hello.f90' compilation terminated

I am new to Fortran and I am trying to execute some test code, printing hello world using the following program - program hello implicit none print *, 'Hello, World!' end program hello I ...
new-to-coding's user avatar
0 votes
1 answer
46 views

"undefined reference to `dgesvx_'" although LAPACK is installed and located

I'm trying to run a fortran script that includes the function dgesvx(). I ran the script as gfortran -lblas -llapack -o cft numtype.o cfapprox.o cftest.o and the output is gfortran -lblas -llapack -o ...
Mr. Cohen's user avatar
1 vote
1 answer
46 views

Errors when using Matlab mex

I am using Matlab 2023a to call Fortran source file using mex. I use the following compiler for Fortran language compilation: Intel oneAPI 2023 for Fortran with Microsoft Visual Studio 2022. The ...
kun zhao's user avatar
-1 votes
1 answer
29 views

How do I install and use Fortran on a MacOS Ventura 13.1? [closed]

I haven't used Fortran before and I am unsure how to install it and use it. Any tutorials or videos will be very appreciated. Thanks!
new-to-coding's user avatar
0 votes
0 answers
56 views

zheev outputs incorrect and random results when called from within dynamic library

I have DFT(density functional theory) code written in Fortran. Inside this program I use zheev function from lapack to diagonalize overlap matrix (S). I compile the code in two different targets (a) ...
Prokop Hapala's user avatar
-2 votes
0 answers
32 views

The impossibility to run a executable after a make: how can I run the program?

I downloaded the source files of a certain program then I compiled it, without errors. Then, I tried to run the program, without success. A bit of context, this code is a bunch of fortran routines to ...
M.N.Raia's user avatar
0 votes
0 answers
68 views

How to read Fortran code from a Fortran punch card

I found some "Fortran Papers" (please forgive me I don't know what to call them) which are produced in USSR in 1980s. What I mean by "Fortran Paper" is a paper with numbers and ...
Ahmed Gamberli's user avatar
0 votes
0 answers
74 views

What are the requirements to do a OpenMP reduction in Fortran?

I am doing molecular dynamics simulation, and trying to parallelize my serial code with the help of openmp constructs in fortran. At, first I am just trying to parallelize the force subroutine, which ...
Sayantan Mondal's user avatar
0 votes
0 answers
32 views

Compilation of Fortan code with f2py creates empty Python module

I have a large Fortran 90 code that I would like to compile with f2py so I can run it from within a Python code. I do get the compilation to run without any errors, like this: f2py -c -lgomp -lcfitsio....
Tomas's user avatar
  • 503
0 votes
0 answers
39 views

Installation failing for R package using Fortran

Trying to install DICE4 (https://github.com/predsci/DICE4) in console from Rstudio but unable to do so. operating system: windows10 tried install DICE4 (https://github.com/predsci/DICE4) in console ...
zoe's user avatar
  • 1
-1 votes
0 answers
66 views

Flopy; forrtl: severe (157): program exception - access violation; how can I see what it is trying to access?

When running a stationary FloPy model I encountered the following exception (see image for detailed output): forrtl: severe (157): program exception - access violation Error message It seems to me ...
rdwe's user avatar
  • 1
0 votes
0 answers
15 views

Using a variable in format string of Fortran and display the values side-by-side [duplicate]

I understood through this post on how to use a variable in format string. write(*,'(1x,f10.5)')(j(i),i=1,nvar) seems to work but the values in 'j' are displayed row-wise. I want them to be displayed ...
user86927's user avatar
0 votes
0 answers
38 views

Set Timeout for Socket in Fortran and WS2_32

I have a client in Fortran (ifort) which connects to a sockets, sends some data and receives some data. Because sometimes the connected server could halt or terminate I don't want to wait indefinitely ...
why.n0t's user avatar
  • 432
0 votes
1 answer
54 views

Why is this value `save`d between calls in this Fortran function?

I'm maintaining a legacy Fortran codebase that (to my eye) relies on undefined behavior. There's a module defined like this module the_module private :: baz contains integer function foo(bar) ...
Adam's user avatar
  • 839
1 vote
0 answers
49 views

How to make fortran subroutine results reproducible on R?

I have written a Fortran subroutine: And I want to implement it on R, so I will do the compile and everything, but I have a question because my fortran subroutine which contains the random number ...
Lili's user avatar
  • 31
-1 votes
2 answers
92 views

How to be more code efficient on fortran? I solved an exercise and I'm not satisfied with my own answer

I'm studing fortran on my own for a job, I'm very new at it. I tried the following exercise and got a correct answer. However I believe there must be many more processing efficient ways to solve the ...
Felipe Fallet's user avatar
2 votes
0 answers
27 views

Fortran derived type variable containing pointer fields with the shared attribute inside an OpenMP parallel region

I have the following problem: I would like to have access to data that is stored in a derived type with pointer fields. I would like the variable of the derived type to have the "shared" ...
user22593146's user avatar
2 votes
2 answers
70 views

How do I access variables on Fortran from MATLAB using MEX (without copying them)?

I would to ask how I can access a variable on Fortran from MATLAB without making a copy. Preferrably, I would like to access the variable a variable on Fortran (it may be 'read-only') that was ...
Vinicius Oliveira Fontes's user avatar
0 votes
1 answer
55 views

Openmp in fortran "Segmentation fault" [duplicate]

My system is on Debian 12 with an Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz. I am trying to parallelize some fortran code with openmp which uses the FFTW library and consists of several modules compiled ...
Marios Giannakou's user avatar
0 votes
1 answer
77 views

nested parallelism by using only MPI

program main implicit none include "mpif.h" integer nproc,rank,ierr,a(4),ll,i,j call MPI_INIT(ierr) call MPI_COMM_SIZE(MPI_COMM_WORLD,nproc,ierr) call MPI_COMM_RANK(...
quantax's user avatar
  • 11
0 votes
0 answers
38 views

Fortran code to solve a 2D heat bar problem

Before I use MPI_Type_vector, I simply use transpose to transpose the T_l. The code can mpirun successfully. However, after I use your provided code of MPI_Type_vector, the code cannot mpirun ...
Daniel Xu's user avatar
3 votes
2 answers
61 views

How does work the OpenMP "nonmonotonic:dynamic" schedule?

The two main OpenMP loop scheduling options are static and dynamic. The latter can be more efficient if the workloads are not balanced between the iterations, but less efficient in the case of ...
PierU's user avatar
  • 1,508
0 votes
0 answers
17 views

How to return two values or array from function in Fortran [duplicate]

I have a code on Fortran that solves equations eq1 and eq1 numerically using secant and bisection methods. FUNCTION eq1(x) RESULT(y) DOUBLE PRECISION :: x, y y = x**4d0 + 18d0*x - 10d0 ...
Кирилл Медведев's user avatar
2 votes
0 answers
67 views

Is this a bug in the Intel Fortran compiler?

I have reproduced some strange behaviour I got when compiling some code with the Intel Fortran compiler ifort by making a minimal example. The strange behaviour also shows up with the newer Intel ...
Rasmus's user avatar
  • 139
0 votes
1 answer
88 views

Fortran 95, How to read blank (letter space) character from the end of the line?

I try to modify my program to read lines that contain blank charaters (written with space) at the end of the line. I'm using Intel compiler (Fortran 95). In the program i'm using the command line: ...
Mikko T's user avatar
-1 votes
0 answers
28 views

GDB is running but not showing the variable during debugging although I have done the certificate for code signing for Mac Mini Intel

I want to debug a fortran code in a mac mini intel 2018 using VScode. To test it, I use fortran code from here No problem during compiling and it is running smoothly. compile and run are OK But when I ...
majinbuux's user avatar
0 votes
0 answers
70 views

Fortran bit separation between fraction and exponent

In Fortran, if I set rk=selected_real_kind(20) how many bits are reserved for the fraction and how many for the exponent?
Matteo Crosilla's user avatar
0 votes
1 answer
68 views

how to passing arrays of strings from fortran dll to python with ctype

I want to read a file with a fortran dll using ctype. the structure of my file is: AX BX … . 4.0 5.0 6.9 1.2 8.0 7.0 … … … for read the file , i have PATH to pass to dll fortran and get a ...
didie's user avatar
  • 1
0 votes
1 answer
57 views

choose different threads for diffrent tasks in a fortran code by using openmp

program main USE OMP_LIB IMPLICIT NONE INTEGER :: i,j,mm,m1,a,k,a1,b,bvv logical :: nn call omp_set_nested(.true.) call omp_set_max_active_levels(2) CALL omp_set_num_threads(2) !$omp parallel do ...
quantax's user avatar
  • 11
-2 votes
0 answers
58 views

How to specify the range of y-axix and draww the plot only in that range

I want to add the range of m3=(0,0.8) in the code program generate_scatter_data implicit none integer, parameter :: n_points = 1000 real(8) :: theta, phi, alpha, beta, m21, m3 ...
Sangeeta Dey's user avatar
-1 votes
0 answers
76 views

How to fix "invalid character in a name" in the Fortran?

On writing the following code program generate_scatter_data implicit none integer, parameter :: n_points = 1000 real(8) :: theta, phi, alpha, beta, m21, m1 integer :: i real(8), dimension(...
Sangeeta Dey's user avatar
0 votes
1 answer
40 views

fortran segmentation fault when OMP_NUM_THREADS bigger than 1 [duplicate]

so im executing a.out (compiled fortran code) with the following runaout.sh file #!/bin/bash #SBATCH --time=00:15:00 #SBATCH --job-name=mhsw9 #SBATCH --nodes=1 #SBATCH --nodelist=komputasi09 whoami ...
LLL's user avatar
  • 223
0 votes
0 answers
43 views

Undefined references to GOACC_ symbols when linking CFD solver using OpenACC

I am trying to speed up an in house Computational Fluid Dynamics solver called FEST-3D by using OPENACC. I am working on a Ubuntu 22.04 Virtual Machine(on VirtualBox) with windows as host. FEST-3D has ...
Flerovium 114's user avatar
-1 votes
0 answers
70 views

How to compile CUDA code with Thrust header files

I am trying to compile sample example codes given in CUDA toolkit folder to test NVIDIA/CUDA Toolkit installation, These are the packages I have loaded in HPC, [user1@login1 thrust]$ module list ...
147875's user avatar
  • 191
0 votes
0 answers
44 views

Open netcdf with gfortran in Mac environment, Undefined symbols for architecture arm64 occurs

I'm a Mac user I'm trying to create a netcdf using gfortran, but I get the following error My Mac is using an M1 chip Below is the Fortran code I made PROGRAM net2 use netcdf ...
이수현's user avatar
0 votes
1 answer
77 views

cublas direct fortran c-binding using cublas.lib

I'm attempting to set up an interface to use cublas.lib in fortran without any separate c-code. I have seen a few examples of this and tried to duplicate those but I having trouble. Both of these ...
js1's user avatar
  • 1
0 votes
1 answer
39 views

Fortran read from console--continue even if carriage return with no input

Here is a code snippet. flist = 0.0 write (*, 778) 778 format ('Enter temperature to save frequencies to frq.dat or n to bypass ', $) read(*, *, iostat =rerr) fstring if (...
ultrasound's user avatar
0 votes
0 answers
117 views

profiling or debugging fortran on an M1 Mac

I am trying to debug and profile (ideally line-by-line time spent) Fortran code on an M1 Mac. Most commands I tried don't seem to work for Fortran and/or M1. gdb seems outdated and won't run lldb ...
John Smith's user avatar
  • 1,079
0 votes
0 answers
53 views

How to compile fortran with HDF5 1.14.1 in Visual Studio 2019?

I am struggling to setup my fortran project properly. My project configuration is set to Release x64. When I put 'use hdf5' in my fortran module, I get: error #7002: Error in opening the compiled ...
hunch_bot's user avatar
1 vote
0 answers
49 views

gfortran error ‘variable_1’ causes a section type conflict with ‘variable_2’

I'm trying to solve the possible problem of stack size being too small for an openmp fortran program with the compiler option -mcmodel=medium and error occurs while compiling: Error: ‘profs’ causes a ...
DJNZ's user avatar
  • 121
3 votes
1 answer
148 views

What is the correct behaviour for nested task constructs?

I encountered an issue with nested task constructs (page 137) while testing MagIC. The application built with Intel, GNU and Arm compilers, shows inconsistent behaviours. While Intel and GNU compilers ...
JulieGaspar's user avatar

1
2 3 4 5
258