Re: WRAPIT compilers on OSX

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 30 2011 - 16:54:33 MDT

Can you run WRAPIT with the -d option and send me all the output so I can see what WRAPIT is doing?

--Mary

On Jun 30, 2011, at 12:52 PM, Jared Lee wrote:

> Hi Mary,
>
> I just added -pgf90libs like you suggested, but it had no impact. No errors are reported while running WRAPIT, but this is what I get when I run the NCL script:
>
> ncl 0>warning:An error occurred loading the external file ./read_little_R.so, file not loaded
> dlopen(./read_little_R.so, 2): Symbol not found: _pgf90_compiled
> Referenced from: /Volumes/Users/jaredlee/programs/VERIF_WRF/read_little_R.so
> Expected in: flat namespace
> in /Volumes/Users/jaredlee/programs/VERIF_WRF/read_little_R.so
> ^Mwarning:error at line 1 in file read_little_R.ncl
>
> Jared
>
>
> On Jun 30, 2011, at 12:36 PM, Mary Haley wrote:
>
>> You might need to add -pgf77libs or -pgf90libs.
>>
>> For example, the code that has:
>>
>> case Darwin: # MacOSX
>> . . .
>> if ($f90c == gfortran) then # gfortran compiler
>> set cmd = "$cmd -lgfortran"
>> endif
>> if ($f90c == g95) then # g95 compiler
>> set cmd = "$cmd -lf95"
>> endif
>>
>> can be enhanced with something like:
>>
>> case Darwin: # MacOSX
>> . . .
>> if ($f90c == gfortran) then # gfortran compiler
>> set cmd = "$cmd -lgfortran"
>> endif
>> if ($f90c == g95) then # g95 compiler
>> set cmd = "$cmd -lf95"
>> endif
>> if ($f90c == pgf90) then # pgf90 compiler
>> set cmd = "$cmd -pgf90libs"
>> endif
>>
>> --Mary
>>
>> On Jun 30, 2011, at 10:36 AM, Jared Lee wrote:
>>
>>> Hi Mary,
>>>
>>> I replied to Dennis about the same thing yesterday, but apparently I forgot to 'reply all' and cc ncl-talk. So here's what I've already done:
>>>
>>> I modified WRAPIT to include Darwin as an option if -pg is chosen for a compiler. Then my pgf90 compiler complained that it didn't recognize the -fPIC or -fno-second-underscore flags (which might be problematic??), so here's my current relevant portion of the switches section of WRAPIT:
>>>
>>> ==========
>>> case Darwin: # MacOSX (g77/gfortran/g95)
>>> if ($f90c == g77) then # g77
>>> if ($debug == 1) then
>>> set fopts = "$fopts -fPIC -v -c -ffortran-bounds-check -fno-second-underscore"
>>> else
>>> set fopts = "$fopts -fPIC -c -O -fno-second-underscore"
>>> endif
>>> ## else if loop added by JAL on 29 Jun 2011:
>>> else if ($f90c == pgf90) then
>>> if ($debug == 1) then
>>> set fopts = "$fopts -v -c -ffortran-bounds-check"
>>> else
>>> set fopts = "$fopts -c -O"
>>> endif
>>> else # gfortran or g95
>>> if ($debug == 1) then
>>> set fopts = "$fopts -m{$nbits} -fPIC -v -c -fno-second-underscore"
>>> else
>>> set fopts = "$fopts -m{$nbits} -fPIC -c -O -fno-second-underscore"
>>> endif
>>> endif
>>> breaksw
>>> ==========
>>>
>>> Then WRAPIT compiled the shared object file, but I got this error when I ran the code, followed by a cascade of errors whenever I tried to call a function/subroutine in that shared object file:
>>>
>>> ==========
>>> Copyright (C) 1995-2010 - All Rights Reserved
>>> University Corporation for Atmospheric Research
>>> NCAR Command Language Version 5.2.1
>>> The use of this software is governed by a License Agreement.
>>> See http://www.ncl.ucar.edu/ for more details.
>>> warning:An error occurred loading the external file ./read_little_R.so, file not loaded
>>> dlopen(./read_little_R.so, 2): Symbol not found: _pgf90_compiled
>>> Referenced from: /Volumes/Users/jaredlee/programs/VERIF_WRF/read_little_R.so
>>> Expected in: flat namespace
>>> in /Volumes/Users/jaredlee/programs/VERIF_WRF/read_little_R.so
>>> ^Mwarning:error at line 1 in file ../VERIF_WRF/read_little_R.ncl
>>> ==========
>>>
>>> So apparently this isn't a completely trivial fix, unfortunately (at least for pgf90)...
>>>
>>> Jared
>>>
>>>
>>> On Jun 30, 2011, at 7:55 AM, Mary Haley wrote:
>>>
>>>> Hi Jared,
>>>>
>>>> This was taken offline briefly. It turns out that WRAPIT only recognizes the g77/gfortran compilers for MacOSX right now.
>>>>
>>>> I think the quick fix is to edit $NCARG_ROOT/bin/WRAPIT and change the second line in this block of code:
>>>>
>>>> else if ($arg:q == "-pg") then
>>>> if ($OS == Linux) then
>>>>
>>>> to:
>>>>
>>>> else if ($arg:q == "-pg") then
>>>> if ($OS == Linux || $OS == Darwin) then
>>>>
>>>> Do a similar thing for these lines:
>>>>
>>>> else if ($arg:q == "-in") then
>>>> if ($OS == Linux) then
>>>>
>>>> Let me know if this works, and I'll incorporate the changes on our end.
>>>>
>>>> Thanks,
>>>>
>>>> --Mary
>>>>
>>>> On Jun 29, 2011, at 11:45 AM, Dennis Shea wrote:
>>>>
>>>>>
>>>>>
>>>>> %> WRAPIT -h
>>>>>
>>>>> [snip]
>>>>> ------------------------ Linux Compilers ---------------------------
>>>>> The default linux fortran compiler is the GNU gfortran compiler. If
>>>>> your system has one of the supported linux fortran compilers you must
>>>>> specify which one you want to use by the appropriate command line
>>>>> option, otherwise the gfortran compiler will be used.
>>>>> The supported linux fortran compilers are the Portland Group
>>>>> (pgf90), the Lahey/Fujitsu (lf95), and the g95 compiler (g95),
>>>>> and the Intel compiler (ifc/ifort).
>>>>> OPTION: -pg to specify the Portland Group compiler.
>>>>> OPTION: -lf to specify the Lahey/Fujitsu compiler.
>>>>> OPTION: -in to specify the Intel compiler.
>>>>> OPTION: -g95 to specify the g95 compiler.
>>>>> OPTION: -gf to specify the gfortran compiler.
>>>>> OPTION: -g77 to specify the old g77 compiler.
>>>>>
>>>>> [snip]
>>>>>
>>>>>
>>>>>
>>>>> On 6/29/11 11:30 AM, Jared Lee wrote:
>>>>>> Hi, is there a reason why WRAPIT is incompatible with the pgf90 and ifort compilers on Mac OSX? Why are gfortran, g95, and g77 the only compilers allowed? (I'm using NCL 5.2.1.)
>>>>>>
>>>>>> I ask because my work machine was just changed this week from a Linux system to a Mac (OS 10.6.8), and I'm running these codes on my desktop system. In one of my Fortran 90 codes on which I use WRAPIT, gfortran consistently chokes on the 'backspace' command, by giving me an "unattached unit" error. I never had that problem before on other architectures when WRAPIT allowed me to use other compilers. Fortunately for me, I see a way that I can rework my Fortran code to avoid needing to use 'backspace' (and it should make my code marginally more efficient anyway), because I suspect this is a bug in gfortran (I did an 'inquire' right before the 'backspace' and everything checked out okay... I'm completely stumped why I'm getting the "unattached unit" error).
>>>>>>
>>>>>> I also ran into problems with gfortran because some of my lines exceeded 132 characters in length. That was a simple enough fix to make, but still inconvenient because of not being allowed by WRAPIT to use a compiler other than gfortran.
>>>>>>
>>>>>> Anyway, can WRAPIT be modified to allow non-GNU compilers to be used on Mac OSX?
>>>>>>
>>>>>> Jared
>>>>>> _______________________________________________
>>>>>> ncl-talk mailing list
>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 30 16:54:43 2011

This archive was generated by hypermail 2.1.8 : Tue Jul 12 2011 - 15:03:53 MDT