Re: WRAPIT/pgf90 problem

From: Qingtao Song <qsong_at_nyahnyahspammersnyahnyah>
Date: Thu, 29 Mar 2007 14:20:51 -0700 (PDT)

Dear Mary,

Thanks a lot for your help. Please see my responses below.

On Thu, 29 Mar 2007, Mary Haley wrote:

> On Thu, 29 Mar 2007, Qingtao Song wrote:
>
>>
>> Hi,
>>
>> I met a problem with either WRAPIT or pgf90 on my Linux RHEL4 x86_64. Both
>> the NCL and NCARG are in their latest version. The pgf90 version is 6.11.
>>
>> The Fortran subroutine is to write a binary file that is called from NCL. I
>> have listed below a few steps that illustrate how I encountered the
>> problem:
>>
>> -----step 1------------
>> [qsong_at_wallaroo ncl_for]$ WRAPIT -pg write_dd_qsong.f
>>
>> WRAPIT Version: 090806
>> /home/server/local/apps/pgicdk-rhel4/linux86-64/current/bin/pgf90
>> COMPILING write_dd_qsong.f
>> LINKING
>> /usr/bin/ld: WRAPIT.o: relocation R_X86_64_32 against `a local symbol' can
>> not be used when making a shared object; recompile with -fPIC
>> WRAPIT.o: could not read symbols: Bad value
>> END WRAPIT
>>
>> ---step 2--------------
>> Then it is OK after -fPIC is added
>>
>> [qsong_at_wallaroo ncl_for]$ WRAPIT -pg -fPIC write_dd_qsong.f
>>
>> WRAPIT Version: 090806
>> /home/server/local/apps/pgicdk-rhel4/linux86-64/current/bin/pgf90
>> COMPILING write_dd_qsong.f
>> LINKING
>> END WRAPIT
>>
>> ---step 3-------------
>> ncl create_SST_bumps_5x5.ncl
>> Copyright (C) 1995-2006 - All Rights Reserved
>> University Corporation for Atmospheric Research
>> NCAR Command Language Version 4.2.0.a034
>> The use of this software is governed by a License Agreement.
>> fatal:Syntax Error in block, block not executed
>> PGFIO-F-201/OPEN/unit=15/illegal value for specifier.
>> File name = qsong.dat
>> In source file write_dd_qsong.f, at line number 46
>>
>> this is line 46: open(unit=15,file='qsong.dat', form='unformatted')
>> ----end of step 3-----------
>>
>> The FORTRAN subroutine itself works well. The problem looks like an I/O
>> error, but it is likely that WRAPIT did not do the right job. If wrapped
>> with g77, my ncl script did output a binary file but the binary file could
>> not be unrecognized by WRF (maybe due to endianess problem or the WPS
>> compiled with pgf90).
>>
>> Thanks for your help,
>>
>> Qingtao
>>
>
> Dear Qingtao,
>
> Just FYI: in the next release of NCL, WRAPIT will have -fPIC set by
> default for gcc compilers. Right now, with the version you have, you
> saw that you need to explicitly include -fPIC.

For my test, WRAPIT with gcc didn't complain for cases being with -fPIC
or without it.

>
> As for your problems with the PGI compilers, I'm not sure what's going
> on. I googled this error message and came up with what looked like
> an email discussion where somebody else had the same question (and there was
> a response), but unfortunately the links were bad.
>
> There may be an incompatibility between using a gcc-compiled version
> of NCL that is trying to load a shared object created by a PGI
> compiler.

This is what I am mostly worried about. The Fortran code I wrote is to
output a binary file.

>
> So, for now, let's focus on trying to get it working using gcc.
>
> Can you explain what you mean by WRF is not recognizing the
> binary file? Also, what do you mean by "WPS compiled with pgf90"?
> There *could* be a problem if you are taking this binary to a system
> that has a different endianness from the machine you built it on.
> The x86_64 system is a little endian machine. What system are you
> moving this binary to?

OK. My gcc-wrapped subroutine can successfully output a binary file,
with certain WRF format convention, onto the disk. The purpose of
writing the binary file is to feed it into WRF model system (especially,
WPS). But the WPS reading utility plotfmt.exe reported 'could not
recognize the data format'. All the WRF/WPS executables were compiled by
pgf90 with -byteswapio option. So I suspect the two posssible problems:

1. my gcc-wrapped Fortran subroutine output a little endian binary file.
WPS, plotfmt.exe, can not recognize the first integer of the binary
file, which represents the data format. This is likely where the problem
is. I wonder if g77 can compile files with the big-endian option?

2. There is a bit chance that plotfmt.exe, compiled by pgf90, is
incompatible with the the g77 output.

Thank you,

Qingtao

>
> --Mary
>
>
>
>> ---
>> Qingtao Song
>> College of Oceanic and Atmospheric Sciences
>> Oregon State University - Phone: 541.737.6396
>> 104 COAS Admin Bldg - Fax: 541.737.2064
>> Corvallis, OR 97331 - Email: qsong_at_coas.oregonstate.edu
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>

---
Qingtao Song
  College of Oceanic and Atmospheric Sciences
   Oregon State University   - Phone: 541.737.6396
    104 COAS Admin Bldg      -   Fax: 541.737.2064
     Corvallis, OR 97331     - Email: qsong_at_coas.oregonstate.edu
Received on Thu Mar 29 2007 - 15:20:51 MDT

This archive was generated by hypermail 2.2.0 : Sun Apr 01 2007 - 11:52:47 MDT