Compiling .f90 files on Linux version of PGI compiler

hi All, I need your help.

I have this big program that I am working on (fortran 90 and cuda fortran) that I need to compile on Linux. It consists of 18 files. I am able to compile them on windows and VS 2010, but not Linux pgfortran compiler.
When I build, I get huge output that I don’t understand, plus there is no a.out file (executable).

here is the compiling switches:
pgfortran -Mpreprocess -D_DEBUG -O3 -Mcuda=4.1,cc20 -Mextend -Mfree
-Minform=severe common.f90 flow.f90 force.f90 geometry.f90 grid.f90 Humidity.f90 init.f90 inverse.f90 kernels.f90 misc.f90 mult.f90 OptionalParams.f90 output.f90 Quick5.f90 reynolds.f90 string.f90

here is what the output look like:
force.o: In function shearkang_': /home/tmardan/quick5/./force.f90:756: undefined reference to finteg1_’
/home/tmardan/quick5/./force.f90:776: undefined reference to finteg1_' /home/tmardan/quick5/./force.f90:805: undefined reference to finteg1_’
/home/tmardan/quick5/./force.f90:806: undefined reference to finteg1_' /home/tmardan/quick5/./force.f90:807: undefined reference to finteg1_’
force.o:/home/tmardan/quick5/./force.f90:808: more undefined references to fint eg1_' follow force.o: In function getrcf_‘:
/home/tmardan/quick5/./force.f90:1024: undefined reference to finteg_' /home/tmardan/quick5/./force.f90:1085: undefined reference to fit1_’
/home/tmardan/quick5/./force.f90:1085: undefined reference to qromb_' /home/tmardan/quick5/./force.f90:1085: undefined reference to fitb1_’
/home/tmardan/quick5/./force.f90:1085: undefined reference to qromb_' /home/tmardan/quick5/./force.f90:1085: undefined reference to fit32_’
/home/tmardan/quick5/./force.f90:1085: undefined reference to qromb_' geometry.o: In function pointrecess_‘:
/home/tmardan/quick5/./geometry.f90:213: undefined reference to udgheight_' grid.o: In function adaptnonnested_’:
/home/tmardan/quick5/./grid.f90:508: undefined reference to interp1_' /home/tmardan/quick5/./grid.f90:508: undefined reference to interp1_’
/home/tmardan/quick5/./grid.f90:508: undefined reference to interp_' grid.o: In function getcontrol_‘:
/home/tmardan/quick5/./grid.f90:1010: undefined reference to sort_' /home/tmardan/quick5/./grid.f90:1011: undefined reference to sort_’
init.o: In function readrun_': /home/tmardan/quick5/./init.f90:297: undefined reference to sort2_’
/home/tmardan/quick5/./init.f90:299: undefined reference to abs_val_sort_' /home/tmardan/quick5/./init.f90:307: undefined reference to sort_’
/home/tmardan/quick5/./init.f90:318: undefined reference to sort_' init.o: In function loadinitialpressure_‘:
/home/tmardan/quick5/./init.f90:667: undefined reference to matinit_' /home/tmardan/quick5/./init.f90:667: undefined reference to matinit_’
/home/tmardan/quick5/./init.f90:667: undefined reference to matinit_' /home/tmardan/quick5/./init.f90:667: undefined reference to matinit_’
/home/tmardan/quick5/./init.f90:667: undefined reference to matinit_' init.o: In function readrail_‘:
/home/tmardan/quick5/./init.f90:724: undefined reference to readudg_' init.o: In function normalize_’:
/home/tmardan/quick5/./init.f90:1031: undefined reference to matrix33_inverse_' /home/tmardan/quick5/./init.f90:1031: undefined reference to matrix_multi_’
inverse.o: In function calc_deriv_': /home/tmardan/quick5/./inverse.f90:287: undefined reference to equate_’
/home/tmardan/quick5/./inverse.f90:316: undefined reference to equate_' /home/tmardan/quick5/./inverse.f90:342: undefined reference to equate_’
/home/tmardan/quick5/./inverse.f90:367: undefined reference to equate_' inverse.o: In function getinc_‘:
/home/tmardan/quick5/./inverse.f90:473: undefined reference to equate_' /home/tmardan/quick5/./inverse.f90:473: undefined reference to matrix33_inverse

misc.o: In function stiffness_': /home/tmardan/quick5/./misc.f90:899: undefined reference to matinit

Quick5.o: In function quick5': /home/tmardan/quick5/./Quick5.f90:124: undefined reference to endtime_’
Quick5.o: In function dorailgeomrun_': /home/tmardan/quick5/./Quick5.f90:305: undefined reference to endtime_’
Quick5.o: In function dogapextrapolationrun_': /home/tmardan/quick5/./Quick5.f90:360: undefined reference to endtime_’
reynolds.o: In function reyneq_': /home/tmardan/quick5/./reynolds.f90:182: undefined reference to tridag_’
/home/tmardan/quick5/./reynolds.f90:211: undefined reference to tridag_' reynolds.o: In function reyneq1_‘:
/home/tmardan/quick5/./reynolds.f90:490: undefined reference to tridag_' /home/tmardan/quick5/./reynolds.f90:519: undefined reference to tridag_’
reynolds.o: In function reyneq2_': /home/tmardan/quick5/./reynolds.f90:799: undefined reference to tridag_’
reynolds.o:/home/tmardan/quick5/./reynolds.f90:828: more undefined references to
`tridag_’ follow

there are no errors, warnings or anything.

Please advice!

Dolf

Hi Dolf,

These are all undefined references, meaning the linker can’t find these symbols in any of the files provided. You’re either missing some source files, missing a library, or have the symbol names decorated incorrectly.

  • Mat

That actually solved it…

Thanks Mat!

Dolf

I was able to make the output a.out. When I try ./a.out I am able to run the code, but I get the following:


CML VERSION 5.0 GPU Quick Solver


Simulation started at: 17:16:02 – 11/13/2013

PGFIO-F-225/list-directed read/unit=1/lexical error-- unknown token type.
File name = rail.dat formatted, sequential access record = 504
In source file init.f90, at line number 729

what is PGFIO-F-225 ?? never seen this before in windows!
Please advice.

Dolf

Hi Dolf,

On Windows, a new line is composed of a carriage return and a new line (\r\n) while on Linux it’s just a new line (\n). This can cause problems when reading in files generated on Windows but being read on Linux.

If “rail.dat” is a text file, you can use a utility such as dos2unix or tounix to convert the file to use the Linux format.

Alternately, you can set the environment flag “FORTRANOPT=crif”

From the PGI Compiler User’s Guide PGI Documentation Archive for Versions Prior to 17.7

FORTRANOPT
FORTRANOPT allows the user to adjust the behavior of the PGI Fortran compilers.
• If FORTRANOPT exists and contains the value vaxio, the record length in the open statement is in units
of 4-byte words, and the $ edit descriptor only has an effect for lines beginning with a space or a plus sign
(+).
• If FORTRANOPT exists and contains the value format_relaxed, an I/O item corresponding to a
numerical edit descriptor (such as F, E, I, and so on) is not required to be a type implied by the descriptor.
• In a non-Windows environment, if FORTRANOPT exists and contains the value crif, a sequential
formatted or list-directed record is allowed to be terminated with the character sequence \r\n (carriage
return, newline). This approach is useful when reading records from a file produced on a Window’s system.
The following example causes the PGI Fortran compilers to use VAX I/O conventions:
% setenv FORTRANOPT vaxio

Hope this helps,
Mat

Hi Mat,

rail.dat and run.dat are both ANSI files. They are both input files. What kind of format I need to change them to so linux can read them? I am using dos2unix software for windows.

Cheers,
Dolf

It totally worked man!

I appreciate the help.
(FYI: FORTRANOPT=crif compiler switch did not work)

Cheers,
Dolf

FORTRANOPT=crif compiler switch

Great. Good to know it worked. Note that FORTRANOPT is an environment variable not a compiler flag.

  • Mat