Rank mismatch error while installing IOAPI 3.2

The following are the error statements I get while installing IOAPI 3.2.

2294 | ISTAT = NF_GET_VARA_INT( FID, VID, DIMS, DELS, GRID )
| 1

10333 | ISTAT = NF_GET_VARA_INT( FID, VID, DIMS, DELS, GRID )
| 2
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)
/home/jay/AMET/IOAPI/ioapi-3.2-2020111/ioapi/modncfio.F90:2202:58:

2202 | ISTAT = NF_GET_VARA_REAL( FID, VID, DIMS, DELS, GRID )
| 1

10157 | ISTAT = NF_GET_VARA_REAL( FID, VID, DIMS, DELS, GRID )
| 2
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (rank-1 and scalar)
make: *** [Makefile:283: modncfio.mod] Error 1

Can anyone please advice and suggest a solution.
Thanks and regards.

Can anyone please advice and suggest a solution.

Get a competent compiler. This is a situation which (in Fortran-speak) NF_GET_VARA_INT and NF_GET_VARA_REAL do not have explicit interfaces. Under such circumstances it is illegal for the compiler to try to invent explicit interfaces for them and then fail to compile as a result. For all the compiler knows, there’s C or assembler code that knows how to deal with the situation correctly on the other side of the call – something that is in fact true (C code) in this case.

What compiler are you trying to use? It needs to be black-listed.

Carlie J. Coats, Jr., Ph.D.                I/O API Author/Maintainer
Senior Software Engineer                       cjcoats@email.unc.edu
UNC Institute for the Environment                     www.ie.unc.edu
100 Europa Dr., Suite 490 / Campus Box 1105         Tel 919.843.5951
Chapel Hill, NC 27599-1105                          Fax 919.966.9920

Sir,
I am using GNU Fortran (GCC) 10.1.1 20200507 (Red Hat 10.1.1-1).
Is it not advisable.

Thanks.

As a follow-up, what are your compile-flags? It is possible that something like -std=f95 would bring the compiler back into Standard-conforming behavior. If that works, we can document that and credit you for the discovery. (Their default seems to be -std=gnu, which means “whatever we want” and varies from compiler version to compiler version.)

– Carlie

Sir,
Honestly I didn’t get you. If you can please tell me what other information you need or want me to do I will give you and will be grateful to get the issue resolved.

Thanks & Regards.

Your ioapi/Makeinclude.$BIN has a line that reads

FOPTFLAGS = -O3 ${MFLAGS}

Can you change this to

FOPTFLAGS = -O3 -std=f95 ${MFLAGS}

and try again?

Sr,
Kindly pardon for the delay in the response.
Attached is the output after making the change as suggested by you.
It still gives the same error.

Kindly advice.

Thanks and regards.
Indumathi

(Attachment Error is missing)

Sir,
Kindly pardon for the delay in the response.
Attached is the output after making the change as suggested by you.
It still gives the same error.

Kindly advice.

Thanks and regards.
Indumathi

Error.txt (50.7 KB)

After rather a bit more research, would you please try

FOPTFLAGS = -O3 -std=legacy ${MFLAGS}

Thanks! – Carlie

2 Likes

Sir,
The following attachment is the message from the suggested change.

Kindly advice.

Thanks and regards.
Indumathi S Iyer

Error-12Jul.txt (19.8 KB)

Thanks – that says the suggested flag-fix worked (albeit at the cost of a bunch of spurious warnings). There will soon be a new release (and there will have to be releases of all the rest of the CMAQ and SMOKE components with matching changes to their build-systems). I’ll credit you for your help in the I/O API Changelog – do you have a preference how I should refer to you (e.g., name at institution)?

On the “m3utilio.o: No such file or directory” item: I don’t understand how that should have happened. What does

ls  /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort/m3utilio.*

say? (If nothing found, then does

cd /home/jay/AMET/IOAPI/ioapi-3.2-2020111/ioapi/
make m3utilio.o
make

fix that problem?

– Carlie

Sir,

The list of files in /home/jay/AMET/IOAPI/ioapi-3…/Linux2_x86_64gfort/ is

[jay@localhost Linux2_x86_64gfort]$ ls
libnetcdff.a modatts3.mod modatts3.o modncfio.mod modncfio.o

[jay@localhost Linux2_x86_64gfort]$ …

Also the make m3utilio.o does not fix the issue. It gives the following message.

[jay@localhost ioapi] make m3utilio.o make: 'm3utilio.o' is up to date. [jay@localhost ioapi]

And make command gives the following message apart from the warning messages.

cd /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort; ar rsv libioapi.a m3utilio.o modgctp.o modwrfio.o modmpasfio.o modatts3.o modncfio.o modpdata.o
ar: creating libioapi.a
ar: m3utilio.o: No such file or directory
make: *** [Makefile:295: mlib] Error 1
[jay@localhost ioapi]$

As for the reference, you can refer to me as Mrs. Indumathi S Iyer, (SO/D), BARC

Kindly advice.

Thanks and Regards.
Indumathi S Iyer .
India

Oops – this is a somewhat unusual error. Your /home/jay/AMET/IOAPI/ioapi-3…/Linux2_x86_64gfort/ should also contain m3utilio.o and m3utilio.mod

Is it possible that these files exist in /home/jay/AMET/IOAPI/ioapi-3…/ioapi/ ? If so, that would defeat make’s dependency checking; you should remove them (and any *.o or *.mod) from that ioapi/ directory, and see if that fixes the problem.

And again: Thanks so much for reporting the gfortran-10 compiler problem, and for your help in testling a compiler-flag work-around. I’ve credited you for your help on the I/O API Changelog (https://cjcoats.github.io/ioapi/NEWSTUFF.html) and Trouble-Shooting (https://cjcoats.github.io/ioapi/ERRORS.html) pages. – Carlie

Thank you Sir for the credit.

As for the files, I removed the *.o and *.mod files. And it worked. The m3utilio.o and m3utilio.mod were indeed located in home/jay/AMET/IOAPI/ioapi-3…/ioapi/.

Just wanted to know if any such changes to be made in the Makefile of m3tools too?

Thanks and regards.
Indumathi S Iyer

m3tools (and also SMOKE) gets its compile-flags from the ioapi/Makeinclude.$BIN, so that fixing the flags there automatically fixes them for m3tools as well. The CMAQ system will need all of its Makefiles to be fixed manually…

Sir,

The following error is given while compiling m3tools.

collect2: error: ld returned 1 exit status
make: *** [Makefile:244: airs2m3] Error 1.

What could be the cause?

Thanks and regards.
Indumathi S Iyer

Would you please cut-and-paste the entire command-line and output that generated this message. (Unfortunately, GNU ld does not necessarily have the most easily understood error messages ;-(

My suspicion would be that one of the files it expects to have (which in this case would be airs2m3.o and libioapi.a) is not in the $BIN directory (or else that airs2m3.o is in the m3tools directory).

Try doing a *rm .o in the m3tools directory).

Sir,
The command-line and output message is given below.

[jay@localhost m3tools] make cd /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort; gfortran /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort/airs2m3.o -L/home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort -lioapi -lnetcdff -lnetcdf -fopenmp -dynamic -L/usr/lib64 -lm -lpthread -lc -o airs2m3 /usr/bin/ld: /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort/libnetcdff.a(nf_var1io.o): in function `nf_put_var1_int64_': /home/jay/AMET/netcdf/netcdf-fortran-4.5.3/fortran/nf_var1io.F90:354: multiple definition of `nf_put_var1_int64_'; /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort/libioapi.a(modncfio.o):modncfio.F90:(.text+0xbb1e0): first defined here /usr/bin/ld: /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort/libnetcdff.a(nf_var1io.o): in function `nf_get_var1_int64_': /home/jay/AMET/netcdf/netcdf-fortran-4.5.3/fortran/nf_var1io.F90:784: multiple definition of `nf_get_var1_int64_'; /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort/libioapi.a(modncfio.o):modncfio.F90:(.text+0xbb200): first defined here /usr/bin/ld: /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort/libnetcdff.a(nf_varaio.o): in function `nf_put_vara_int64_': /home/jay/AMET/netcdf/netcdf-fortran-4.5.3/fortran/nf_varaio.F90:440: multiple definition of `nf_put_vara_int64_'; /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort/libioapi.a(modncfio.o):modncfio.F90:(.text+0xbb220): first defined here /usr/bin/ld: /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort/libnetcdff.a(nf_varaio.o): in function `nf_get_vara_int64_': /home/jay/AMET/netcdf/netcdf-fortran-4.5.3/fortran/nf_varaio.F90:955: multiple definition of `nf_get_vara_int64_'; /home/jay/AMET/IOAPI/ioapi-3.2-2020111/Linux2_x86_64gfort/libioapi.a(modncfio.o):modncfio.F90:(.text+0xbb240): first defined here collect2: error: ld returned 1 exit status make: *** [Makefile:244: airs2m3] Error 1 [jay@localhost m3tools]

The list of files in $BIN directory is given below.

[jay@localhost Linux2_x86_64gfort]$ ls
airs2m3.o findr2.o kfwrite.o open3.o sortic.o
bilin.o findr3.o lambert.o opnfil3.o sortir.o
bmatvec.o findr4.o lblank.o opnkf.o sortis.o
bufint3.o findsc.o len2.o opnlist3.o splitline.o
cbarnes1.o flush3.o libioapi.a opnlog3.o str2dble.o
cbarnesN.o gcd.o libnetcdff.a pcoef.o str2int.o
check3c.o gctp.o ll2utm.o pgrdsum.o str2real.o
check3.o getdate.o locat1.o pmatvec.o strlist.o
chkbuf3.o getdble.o locat2.o pn_crtfil3.o sync3c.o
chkfil3.o getdfilec.o locat3.o pn_opnfil3.o sync3.o
ckdesc3.o getdfile.o locat4.o pn_wrvars.o syncfid.o
ckfile3.o getdttime.o locatc.o poly.o synchtao.o
ckgeom.o getefilec.o locatr1.o promptdfile.o systemf.o
ckname.o getefile.o locatr2.o promptffile.o time2secc.o
cktflag3.o get_endian.o locatr3.o promptgrid.o time2sec.o
close3c.o getffile.o locatr4.o promptmfile.o trimlen.o
close3.o getmenu.o locatsc.o rdatt3c.o ungridb.o
crdict3.o getnum.o lustr.o rdatt3.o ungridi.o
crlf.o getreal.o m3abort.o rdbndary.o upcase.o
crtbuf3.o getstr.o m3errc.o rdbuf3.o utm2ll.o
crtfil3.o getyn.o m3err.o rdcustom.o wkdayc.o
crtkf.o grdchk3.o m3exitc.o rddict3.o wkday.o
currec.o gridops.o m3exit.o rdgrdded.o wratt3c.o
currstepc.o hhmmssc.o m3mesgc.o rdgrnest.o wratt3.o
currstep.o hhmmss.o m3msg2.o rdiddata.o wrbndary.o
daymonc.o index1.o m3utilio.mod rdprofil.o wrbuf3.o
daymon.o init3c.o m3utilio.o rdsmatrx.o wrcustom.o
dble2real.o init3.o m3warnc.o rdtflag.o wrdict3.o
dbllist.o initblk3.o m3warn.o rdvars.o wrgrdded.o
ddtvar3c.o initlog3.o mmddyyc.o read3c.o wrgrnest.o
ddtvar3.o inqatt3c.o mmddyy.o read3.o wriddata.o
ddtvar3v.o inqatt3.o modatts3.mod read4dc.o write3c.o
desc3c.o interp3c.o modatts3.o read4d.o write3.o
desc3.o interp3.o modgctp.mod readsmet.o write4dc.o
dmatvec.o intg2real.o modgctp.o realist.o write4d.o
dscgridc.o intlist.o modmpasfio.mod rmfile.o wrmpigrd.o
dscgrid.o iobin3.o modmpasfio.o runspec.o wrpatch.o
dt2strc.o iocplf2c.o modncfio.mod scanint.o wrprofil.o
dt2str.o iocpl.o modncfio.o sec2timec.o wrsmatrx.o
envgets.o ioparms3.o modpdata.mod sec2time.o wrtflag.o
filchk3c.o isdstime.o modpdata.o secsdiffc.o wrvars.o
filchk3.o jstep3.o modwrfio.mod secsdiff.o xtbuf3.o
find1.o julianc.o modwrfio.o setsphere.o xtract3c.o
find2.o julian.o name2fid.o shut3c.o xtract3.o
find3.o junit.o nameval.o shut3.o year4.o
find4.o kfindx.o nextimec.o skipl.o yr2day.o
findc.o kfopen.o nextime.o sleep3.o
findr1.o kfread.o open3c.o smatvec.o…

There are no *.o files present in m3tools directory.

Kindly advice.

Thanks and regards.
Indumathi S Iyer

This forum software didn’t reproduce everything (especially the important part) correctly. The important part turns out to be things like:

multiple definition of nf_put_var1_int64_`

From the I/O API Installation Manual https://cjcoats.github.io/ioapi/AVAIL.html

Additional definitions in make-variable DEFINEFLAGS (in Makefile or ARCHFLAGS (in Makeinclude.${BIN} turn on various optional capabilities:

-DIOAPI_NCF4=1

turns on netCDF-4 INTEGER*8 operations, and requires HDF-enabled netCDF-4 libraries, instead of netCDF-3 (for the rest of your Makefiles).
Required if your netCDF library is built without the recommended --disable-netcdf-4

So go back, add -DIOAPI_NCF4=1 to DEFINEFLAGS in your ioapi/Makeinclude.$BIN and then
make clean; make in your ioapi/ directory.

Thank you Sir. It worked .