mark florisson | 11 Dec 01:02 2011
Picon

Re: malloc vs PyMem_malloc

On 10 December 2011 22:00, Stefan Behnel <stefan_ml <at> behnel.de> wrote:
> mark florisson, 10.12.2011 21:44:
>>
>> On 10 December 2011 20:39, mark florisson wrote:
>>
>>> On 10 December 2011 19:16, Robert Bradshaw wrote:
>>>>
>>>> On this note, a useful pattern is
>>>>
>>>> try:
>>>>    x = malloc(...)
>>>> finally:
>>>>    free(x)
>>>>
>>>> It could be nice to encapsulate this in a context manager.
>
>
> Absolutely.
>
>
>
>>> I think I'd prefer variable-sized arrays that would always get
>>> deallocated on exit of the function
>
>
> Why? A context manager is much clearer

That is highly subjective, I think it would be harder to read and
introduce more code blocks and nesting.

(Continue reading)

Stefan Behnel | 11 Dec 17:51 2011
Picon

Re: [Cython] [cython-users] malloc vs PyMem_malloc

mark florisson, 11.12.2011 01:02:
> On 10 December 2011 22:00, Stefan Behnel wrote:
>> mark florisson, 10.12.2011 21:44:
>>> On 10 December 2011 20:39, mark florisson wrote:
>>>> On 10 December 2011 19:16, Robert Bradshaw wrote:
>>>>> On this note, a useful pattern is
>>>>>
>>>>> try:
>>>>>     x = malloc(...)
>>>>> finally:
>>>>>     free(x)
>>>>>
>>>>> It could be nice to encapsulate this in a context manager.
>>
>> Absolutely.
>>
>>>> I think I'd prefer variable-sized arrays that would always get
>>>> deallocated on exit of the function
>>
>> Why? A context manager is much clearer
>
> That is highly subjective, I think it would be harder to read and
> introduce more code blocks and nesting.
>
>> and gives users total control over
>> the lifetime of the memory.
>
> Yes, but very often you don't need it. And if Cython would support
> declarations in blocks you'd get it for free. Supporting that
> (disregarding the difficulties of that) would also be helpful in
(Continue reading)

Wes McKinney | 12 Dec 21:09 2011
Picon

[Cython] Distributing Windows binary using OpenMP / cython.parallel

I'm interested in using the Cython OpenMP extensions in pandas for
various calculations, but I'm concerned about cross-platform issues,
especially distributing built binaries of the extensions to Windows
users. Is there a clean way to bundle the relevant OpenMP DLLs in
distutils?

thanks,
Wes
mark florisson | 12 Dec 22:37 2011
Picon

Re: [Cython] Distributing Windows binary using OpenMP / cython.parallel

On 12 December 2011 20:09, Wes McKinney <wesmckinn@...> wrote:
> I'm interested in using the Cython OpenMP extensions in pandas for
> various calculations, but I'm concerned about cross-platform issues,
> especially distributing built binaries of the extensions to Windows
> users. Is there a clean way to bundle the relevant OpenMP DLLs in
> distutils?
>
> thanks,
> Wes
> _______________________________________________
> cython-devel mailing list
> cython-devel@...
> http://mail.python.org/mailman/listinfo/cython-devel

As a non-Windows user I'm not quite sure, but I think users will need
to install the C runtime:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=15336
. Maybe you can ship vcomp.dll as well, no idea.

Maybe the distutils mailing list could be more helpful.
Sturla Molden | 13 Dec 12:47 2011
Picon

Re: [Cython] Distributing Windows binary using OpenMP / cython.parallel

Den 12.12.2011 21:09, skrev Wes McKinney:
> I'm interested in using the Cython OpenMP extensions in pandas for
> various calculations, but I'm concerned about cross-platform issues,
> especially distributing built binaries of the extensions to Windows
> users. Is there a clean way to bundle the relevant OpenMP DLLs in
> distutils?
>
> thanks,
> Wes
>

Are you using MSVC or MinGW compiler?

If you use MinGW, beware of licensing issues for the required pthreads 
library (pthreadsGC2.dll, I think it's LGPL). It is not a part of MinGW 
or GCC/GNU. So linking it statically can be a problem.

As for the MSVC compiler, IIRC the OpenMP runtime is a part of the MSVC 
runtime DLLs which the user must install anyway.

Sturla
Wes McKinney | 13 Dec 17:32 2011
Picon

Re: [Cython] Distributing Windows binary using OpenMP / cython.parallel

On Tue, Dec 13, 2011 at 6:47 AM, Sturla Molden <sturla@...> wrote:
> Den 12.12.2011 21:09, skrev Wes McKinney:
>
>> I'm interested in using the Cython OpenMP extensions in pandas for
>> various calculations, but I'm concerned about cross-platform issues,
>> especially distributing built binaries of the extensions to Windows
>> users. Is there a clean way to bundle the relevant OpenMP DLLs in
>> distutils?
>>
>> thanks,
>> Wes
>>
>
> Are you using MSVC or MinGW compiler?
>
> If you use MinGW, beware of licensing issues for the required pthreads
> library (pthreadsGC2.dll, I think it's LGPL). It is not a part of MinGW or
> GCC/GNU. So linking it statically can be a problem.
>
> As for the MSVC compiler, IIRC the OpenMP runtime is a part of the MSVC
> runtime DLLs which the user must install anyway.
>
>
> Sturla
>
> _______________________________________________
> cython-devel mailing list
> cython-devel@...
> http://mail.python.org/mailman/listinfo/cython-devel

(Continue reading)

Lars Buitinck | 17 Dec 13:16 2011
Picon
Picon

[Cython] Bug report: building an extension with --pyrex-gdb fails

Hello all,

I was trying to build a C++ extension with debugging support as
described in http://docs.cython.org/src/userguide/debugging.html, but
I got an error from the Cython compiler:

lars <at> schoothond:~/src/sortedcollections$ python setup.py build_ext
--inplace --pyrex-gdb
running build_ext
cythoning sortedcollections/set.pyx to sortedcollections/set.cpp
Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    language="c++")]
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/dist-packages/Cython/Distutils/build_ext.py",
line 125, in run
    _build_ext.build_ext.run(self)
  File "/usr/lib/python2.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/usr/local/lib/python2.7/dist-packages/Cython/Distutils/build_ext.py",
line 132, in build_extensions
    ext.sources = self.cython_sources(ext.sources, ext)
  File "/usr/local/lib/python2.7/dist-packages/Cython/Distutils/build_ext.py",
line 275, in cython_sources
    full_module_name=module_name)
(Continue reading)

Lars Buitinck | 17 Dec 13:40 2011
Picon
Picon

Re: [Cython] Bug report: building an extension with --pyrex-gdb fails

2011/12/17 Lars Buitinck <L.J.Buitinck@...>:
> I was trying to build a C++ extension with debugging support as
> described in http://docs.cython.org/src/userguide/debugging.html, but
> I got an error from the Cython compiler:

Forgot to mention: I was using the very latest Git version of Cython,
a04c0f4eccc96ad475360cf3844b5792bd077836.

--

-- 
Lars Buitinck
Scientific programmer, ILPS
University of Amsterdam
mark florisson | 17 Dec 13:55 2011
Picon

Re: [Cython] Bug report: building an extension with --pyrex-gdb fails

On 17 December 2011 12:40, Lars Buitinck <L.J.Buitinck@...> wrote:
> 2011/12/17 Lars Buitinck <L.J.Buitinck@...>:
>> I was trying to build a C++ extension with debugging support as
>> described in http://docs.cython.org/src/userguide/debugging.html, but
>> I got an error from the Cython compiler:
>
> Forgot to mention: I was using the very latest Git version of Cython,
> a04c0f4eccc96ad475360cf3844b5792bd077836.
>
> --
> Lars Buitinck
> Scientific programmer, ILPS
> University of Amsterdam
> _______________________________________________
> cython-devel mailing list
> cython-devel@...
> http://mail.python.org/mailman/listinfo/cython-devel

Thanks for your report, could you paste/attach the code of your
extension module?
Lars Buitinck | 17 Dec 13:57 2011
Picon
Picon

Re: [Cython] Bug report: building an extension with --pyrex-gdb fails

2011/12/17 mark florisson <markflorisson88@...>:
> Thanks for your report, could you paste/attach the code of your
> extension module?

The code is online at https://github.com/larsmans/sortedcollection

--

-- 
Lars Buitinck
Scientific programmer, ILPS
University of Amsterdam

Gmane