3 Replies Latest reply on Mar 1, 2013 9:07 PM by jiriwiesner

    make check of netcdf fortran 4.2 fails

    jiriwiesner

      Dear Developers,

      I have just discovered the x86 Open64 and Open64 compilers and I came like them instantly. I've been trying to compile NetCDF libraries, since I use those in my programs. The C netcdf library version 4.2.1.1 compiles well, checks pass - no problem there. The Fortran part, netcdf-fortran-4.2, compiles without error, but the checks of the Fortran 77 API fail for both NetCDF-2 and NetCDF-3 formats:

       

      *** testing nf_put_att_double ...

      *** testing nf_copy_att ...

      *** testing nf_rename_att ...

      *** testing nf_del_att ...

      *** testing nf_set_fill ...

      *** testing nf_set_default_format ...

      /bin/bash: line 5:  5679 Illegal instruction     ${dir}$tst

      FAIL: nf_test

       

      *** Copying file with fill values.

      *** SUCCESS!

      PASS: create_fills.sh

       

        *** Testing netCDF v2 api for F77.

        *** SUCCESS!

      PASS: tst_f77_v2

       

      *** Testing netCDF-2 Fortran 77 API.

      *** testing nccre ...

      *** testing ncddef ...

      *** testing ncvdef ...

      *** testing ncapt, ncaptc ...

      *** testing ncclos ...

      *** testing ncvpt1 ...

      *** testing ncvgt1 ...

      *** testing ncvpt ...

      *** testing ncopn, ncinq, ncdinq, ncvinq, ncanam, ncainq ...

      *** testing ncvgt, ncvgtc ...

      *** testing ncagt, ncagtc ...

      *** testing ncredf, ncdren, ncvren, ncaren, ncendf ...

      *** testing ncacpy ...

      *** testing ncadel ...

      *** testing fill values ...

      /bin/bash: line 5:  5741 Illegal instruction     ${dir}$tst

      FAIL: ftest

       

      *** Testing netCDF-3 Fortran 90 API.

      *** SUCCESS!

      PASS: tst_f90

      ================================================

      2 of 5 tests failed

      Please report to support-netcdf@unidata.ucar.edu

      ================================================

      make[2]: *** [check-TESTS] Error 1

      make[2]: Leaving directory `/home/comp/src/nc42_opencc45/netcdf-fortran-4.2/nf_test'

      make[1]: *** [check-am] Error 2

      make[1]: Leaving directory `/home/comp/src/nc42_opencc45/netcdf-fortran-4.2/nf_test'

      make: *** [check-recursive] Error 1

       

       

      I tried to investigate the situation with the help of gdb:

       

      wiesner@iakchos:/home/comp/src/nc42_opencc45/netcdf-fortran-4.2/nf_test$ gdb .libs/lt-nf_test

      GNU gdb (GDB) 7.0.1-debian

      Copyright (C) 2009 Free Software Foundation, Inc.

      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

      This is free software: you are free to change and redistribute it.

      There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

      and "show warranty" for details.

      This GDB was configured as "x86_64-linux-gnu".

      For bug reporting instructions, please see:

      <http://www.gnu.org/software/gdb/bugs/>...

      Reading symbols from /home/comp/src/nc42_opencc45/netcdf-fortran-4.2/nf_test/.libs/lt-nf_test...done.

      (gdb) run

      Starting program: /home/comp/src/nc42_opencc45/netcdf-fortran-4.2/nf_test/.libs/lt-nf_test

       

      *** Testing netCDF-3 Fortran 77 API.

      NetCDF version: 4.2.1.1 of Mar  1 2013 22:02:39 $

      *** testing nf_strerror ...

      *** testing nf_open ...

      *** testing nf_close ...

      *** testing nf_inq ...

      *** testing nf_inq_dimid ...

      *** testing nf_inq_dim ...

      *** testing nf_inq_dimlen ...

      *** testing nf_inq_dimname ...

      *** testing nf_inq_varid ...

      ...skipped...

      *** testing nf_put_att_int ...

      *** testing nf_put_att_real ...

      *** testing nf_put_att_double ...

      *** testing nf_copy_att ...

      *** testing nf_rename_att ...

      *** testing nf_del_att ...

      *** testing nf_set_fill ...

      *** testing nf_set_default_format ...

       

      Program received signal SIGILL, Illegal instruction.

      0x00007ffff6e02feb in findmatch () at /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/opn.c:487

      487     /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/opn.c: No such file or directory.

              in /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/opn.c

      Current language:  auto

      The current source language is "auto; currently asm".

      (gdb) bt

      #0  0x00007ffff6e02feb in findmatch () at /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/opn.c:487

      #1  0x00007ffff6e02454 in _OPEN () at /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/opn.c:254

      #2  0x000000000044b6d5 in nf_get_file_version (path=Cannot access memory at address 0x65e900

      ) at test_write.F:1425

      #3  0x000000000044b43d in test_nf_set_default_format () at test_write.F:1400

      #4  0x0000000000440988 in test (name=Cannot access memory at address 0x454e60

      ) at nf_test.F:20

      #5  0x0000000000441acd in MAIN__ () at nf_test.F:381

      (gdb) up

      #2  0x000000000044b6d5 in nf_get_file_version (path=Cannot access memory at address 0x65e900

      ) at test_write.F:1425

      1425             elseif (ver .eq. 2) then

      (gdb) print ver

      $1 = 32767

       

      "ver" is an integer, btw. I have used "-O0" to disable optimizations, but the line numbers still seem to be incorrect. It seems to me that it is a compiler issue, mainly because binaries compiled with the Open64 5.0 release pass the check. I have use the latest version of x86 Open64 - version 4.5.2, which alse fails to pass the checks of NetCDF version 3.6.3 at the very same point. The older x86 Open64 release, 4.2.5.2, works well and the checks pass.

       

      Other details:

      NetCDF configure command:

        ./configure --disable-netcdf-4 --disable-dap --prefix=/usr/local/nc42_opencc50 CC=/usr/local/open64-5.0/bin/opencc

      NetCDF fortran configure command:

        ./configure --prefix=/usr/local/nc42_opencc45 CC=/usr/local/x86_open64-4.5.2/bin/opencc FC=/usr/local/x86_open64-4.5.2/bin/openf95 F77=/usr/local/x86_open64-4.5.2/bin/openf95 CPPFLAGS=-I/usr/local/nc42_opencc45/include LDFLAGS=-L/usr/local/nc42_opencc45/lib CFLAGS="-g -O0" FFLAGS="-g -O0" FCFLAGS="-g -O0"

       

      I'd be very glad if someone shed some light on this issue.

      Thank you,

      Jiri

        • Re: make check of netcdf fortran 4.2 fails
          jiriwiesner

          I figured out that libf/fio/opn.c probably means file i/o and opn.c would be an implementation of the open statement. That fits the fact that there is an open statement just above the line reported by gdb:

           

          C This function looks in a file for the netCDF magic number.
            integer function nf_get_file_version(path, version)
            implicit none

          #include "tests.inc"

            character*(*) path
            integer version, iosnum
            character magic*4
            integer ver
            integer f
            parameter (f = 10)

           

            open(f, file=path, status='OLD', form='UNFORMATTED',
          + access='DIRECT', recl=4)

           

          C Assume this is not a netcdf file.
            nf_get_file_version = NF_ENOTNC
            version = 0

           

          C Read the magic number, the first 4 bytes of the file.
            read(f, rec=1, err = 1) magic

           

          C If the first three characters are not "CDF" we're done.
            if (index(magic, 'CDF') .eq. 1) then
               ver = ichar(magic(4:4))
               if (ver .eq. 1) then
                  version = 1
                  nf_get_file_version = NF_NOERR
               elseif (ver .eq. 2) then
                  version = 2
                  nf_get_file_version = NF_NOERR
               endif
            endif
          1 of 1 people found this helpful
            • Re: make check of netcdf fortran 4.2 fails
              jiriwiesner

              I'm sorry that I keep replying to myself, but I have succeeded in identifying the exact issue:

              integer u

              character(4) ch

              open(unit = u, file = "test", status = 'OLD', form = 'UNFORMATTED', access='DIRECT', recl=4)

              read(u, rec=1) ch

              print *, ch

              end

               

              wiesner@iakchos:~/wdraid5/prog/f_test/15.open_direct$ /usr/local/x86_open64-4.5.2/bin/openf95 opn.F90

              wiesner@iakchos:~/wdraid5/prog/f_test/15.open_direct$ ls -l

              total 20

              -rwxr-xr-x 1 wiesner lcc 10048 Mar  2 03:07 a.out

              -rw-r--r-- 1 wiesner lcc   153 Mar  2 03:06 opn.F90

              -rw-r--r-- 1 wiesner lcc   470 Mar  2 03:04 test

              wiesner@iakchos:~/wdraid5/prog/f_test/15.open_direct$ ./a.out

              Illegal instruction

              wiesner@iakchos:~/wdraid5/prog/f_test/15.open_direct$ head -n1 test

              -rw-r--r-- 1 wiesner lcc    2381 Feb 24 19:29 f95_compat.F90

               

              wiesner@iakchos:~/wdraid5/prog/f_test/15.open_direct$ gdb a.out

              Reading symbols from /wdraid5/prog/f_test/15.open_direct/a.out...done.

              (gdb) run

              Starting program: /wdraid5/prog/f_test/15.open_direct/a.out

               

              Program received signal SIGILL, Illegal instruction.

              0x00007ffff7a9dfeb in findmatch () at /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/opn.c:487

              487     /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/opn.c: No such file or directory.

                      in /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/opn.c

              Current language:  auto

              The current source language is "auto; currently asm".

              (gdb) bt

              #0  0x00007ffff7a9dfeb in findmatch () at /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/opn.c:487

              #1  0x00007ffff7a9d454 in _OPEN () at /local/home/qa/nightly_build_avx/sandbox/open64/osprey/libf/fio/opn.c:254

              #2  0x00000000004009d8 in MAIN__ () at /wdraid5/prog/f_test/15.open_direct/opn.F90:3

              (gdb) up

              #2  0x00000000004009d8 in MAIN__ () at /wdraid5/prog/f_test/15.open_direct/opn.F90:3

              3       open(unit = u, file = "test", status = 'OLD', form = 'UNFORMATTED', access='DIRECT', recl=4)

               

              I have no idea whether it is correct to open an ASCII file as an unformatted direct access file, since I've never used direct access files.

              1 of 1 people found this helpful