On Thu, Mar 25, 2010 at 1:28 AM, Dag Sverre Seljebotn
<[email protected]> wrote:
> Ondrej Certik wrote:
>> On Wed, Mar 24, 2010 at 11:52 PM, Dag Sverre Seljebotn
>> <[email protected]> wrote:
>>
>>> Ondrej Certik wrote:
>>>
>>>> Hi Kurt!
>>>>
>>>> On Wed, Mar 24, 2010 at 1:40 PM, Kurt Smith <[email protected]> wrote:
>>>>
>>>>> On Wed, Mar 24, 2010 at 2:08 PM, Ondrej Certik <[email protected]> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> do you think that fwrap would be usable over the summer? I will be
>>>>>> working with some fortran codes (f95), so I am curious whether I
>>>>>> should stay with f2py, or invest some time into fwrap and use Cython,
>>>>>> that I use anyway for C/C++.
>>>>>>
>>>>>>
>>>>> I'm working on the build system as we speak :-)
>>>>>
>>>>>
>>>>>> Is there some webpage for it? Bug tracker?
>>>>>>
>>>>>>
>>>>> I've been putting my time in on coding lately, so fwrap's public face
>>>>> is sorely lacking.  I need to remedy this soon.  Thanks for the
>>>>> motivation -- you and others have made it clear that soon is 'now.'
>>>>>
>>>>>
>>>>>> I found this blog:
>>>>>>
>>>>>> http://fortrancython.wordpress.com/
>>>>>>
>>>>>>
>>>>> To be updated soon, too (I know, long on promises -- I'm very short on
>>>>> time lately).  But the project is active.
>>>>>
>>>>>
>>>>>> and I found this:
>>>>>>
>>>>>> http://hg.cython.org/fwrap-dev/
>>>>>>
>>>>>> Is this the official source code?
>>>>>>
>>>>>> How do I compile it and use it? How do I run tests? I tried:
>>>>>>
>>>>>> $ python fwrap.py
>>>>>> Traceback (most recent call last):
>>>>>>  File "fwrap.py", line 4, in <module>
>>>>>>    main()
>>>>>>  File "/home/ondrej/repos/fwrap-dev/fwrap_src/main.py", line 12, in main
>>>>>>    wrap(options, args)
>>>>>>  File "/home/ondrej/repos/fwrap-dev/fwrap_src/main.py", line 18, in wrap
>>>>>>    funcs_templ = [(fc_wrap.generate_fortran, "%s_c.f90"),
>>>>>> AttributeError: 'module' object has no attribute 'generate_fortran'
>>>>>>
>>>>>> $ python runtests.py
>>>>>> Traceback (most recent call last):
>>>>>>  File "runtests.py", line 799, in <module>
>>>>>>    from fwrap_src.Main import wrap
>>>>>>
>>>>>>
>>>>>> And I didn't find any setup.py, or README (I found NOTES.txt, but no
>>>>>> build instructions). Sorry for the basic questions, I just want to
>>>>>> give it a shot.
>>>>>>
>>>>>>
>>>>>> Kurt and Dag seem to be working/interested in this, so if we can get
>>>>>> something usable (90%) to get started and then once I can use it for
>>>>>> my stuff (I just need simple wrappers for now), it'd be really cool.
>>>>>>
>>>>> I'm *really* aiming for something like 90% by the end of April, as
>>>>> unlikely as the above makes it seem.  I'll put a post on the blog
>>>>> (fortrancython.wordpress.com/) about what 90% means.  It will include
>>>>> all the basic support stuff that you mention above (where hosted
>>>>> (likely bitbucket), a mailing-list, and the features supported).
>>>>>
>>>>> So by summer (end of May) fwrap should have a couple of releases out,
>>>>> and be usable.  It will certainly work for simple wrappers (no
>>>>> callback support).  Although that depends on just what you mean by
>>>>> 'simple.'
>>>>>
>>>> That should be enough. I use cmake, so I'd appreciate if fwrap could
>>>> just spit the C (or fortran or both) files, that I compile and link
>>>> myself. Just like Cython does. (I read some issues with integrating
>>>>
>>> Note that fwrap generates both C, Fortran and Cython code to make
>>> everything work together in a standard-compliant way...
>>>
>>> Also, unless things have changed, a configuration script must be run as
>>> part of the build process to detect which C types correspond to which
>>> Fortran types. f2py just makes blatant assumptions in this area and you
>>> could probably impose such blatant assumptions yourself too if you want
>>> to avoid complicating your build.
>>>
>>
>> That's fine. I just want some simple example of wrapping a simple
>> fortran program, so that I can see this myself. I didn't manage to
>> figure this out by myself using the fwrap hg repository and I didn't
>> find any documentation. So I am waiting for Kurt's help. :)
>>
>>
>>> (If you are building Cython code via cmake in a reasonably robust manner
>>> we would love to have the necesarry scripts contributed to the our
>>> Tools/ dir. Have you just hardcoded the C compilation flags or do you
>>> try to be portable and query distutils.sysconfig?)
>>>
>>
>> The cmake file that I wrote is attached, and the usage is in the
>> comments at the top of the file. I don't query distutils.sysconfig.
>> But I tested it on linux, Mac and windows using cygwin (and espeically
>> mac has a way different way of compiling and linking stuff) and it
>> works.
>>
> Thanks. You are aware of the -fno-strict-aliasing issue, right? Unless
> the C files are compiled with that they may suddenly segfault or corrupt
> data if the compiler does a certain optimization... this is a
> restriction of Python itself, not something Cython does.
>
> python -c 'from distutils.sysconfig import get_config_var as g; print
> g("CFLAGS")'

No, I wasn't aware of that! Thanks for pointing this out to me. I'll fix it.

Ondrej
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to