cython Questions

3

Solved

I want to pass some extra options to the Cython compiler by using extra_compile_args. My setup.py: from distutils.core import setup from Cython.Build import cythonize setup( name = 'Test app',...
Filigree asked 4/11, 2015 at 11:25

2

Solved

I am trying to use explicit relative imports in cython. From the release notes it seems like relative imports should work after cython 0.23, and I'm using 0.23.4 with python 3.5. But I get this str...
Aparri asked 5/11, 2015 at 22:22

4

Solved

I would like to lower the time Scipy's odeint takes for solving a differential equation. To practice, I used the example covered in Python in scientific computations as template. Because odeint ...

3

I'm working on a project to call C++ from Python. We use Cython for this purpose. When compile by using the command "python3.6 setup.py build_ext --inplace", the compiler "x86_64-linux-gnu-gcc" is ...
Monograph asked 23/7, 2019 at 22:11

3

Solved

I'm building a platform independent cython project where I want to pass compiler args based on the compiler being used. I can guess the compiler based on platform or assume it's the same compiler u...
Tantalum asked 22/6, 2015 at 17:7

2

Solved

Suppose I have the following simple example of C++ inheritance in file.h: class Base {}; class Derived : public Base {}; Then, the following code compiles; that is, I can assign std::shared_ptr&lt...
Snobbery asked 20/5, 2021 at 18:39

1

Solved

I'm using Cython in CPython 3.6 and I'd like to mark some pointers as "not aliased", to improve performance and be explicit semantically. In C this is done with the restrict (__restrict, ...
Hackberry asked 18/5, 2021 at 23:58

4

Solved

pyximport is super handy but I can't figure out how to get it to engage the C++ language options for Cython. From the command line you'd run cython --cplus foo.pyx. How do you achieve the equivalen...
Shelashelagh asked 1/10, 2011 at 11:39

4

Solved

I am trying to wrap an enum class in a c++ header file for use in a cython project. For example, how can this enum class Color {red, green = 20, blue}; be wrapped with Cython.
Callow asked 23/6, 2015 at 11:45

3

Solved

Quoting the Cython documentation: Cython recognises the usual Python for-in-range integer loop pattern: for i in range(n): ... If i is declared as a cdef integer type, it will optimise this into...
Bibelot asked 27/1, 2014 at 13:30

2

Solved

I have a .pyx file in which I define some functions, e.g. cdef double foo(double a) nogil: return 3. * a How could I unit test the behavior of such functions outside the pyx file? Since they ar...
Eruptive asked 15/2, 2017 at 20:48

2

I would like to port an existing c++ library with cython to Python, with the C++ library employing templates. In this case, it is the adevs library. The question is how can I store Python objects ...
Ingalls asked 14/11, 2014 at 19:12

0

I'm trying to find examples of a PyTorch nn.Module class written in Cython for speed but haven't found anything. Suppose I have the below class written in Python, what would the best Cython transla...
Cheng asked 10/3, 2021 at 22:8

2

I get the following error with Python 3.8 and I don't get that error with Python 3.6. How can I make it work with Python 3.8? In order to reproduce the error, please follow along here: https://gith...
Deliberative asked 13/1, 2021 at 4:35

0

I'd like to know how people debug their Cython code, do they just use terminal debugging as suggested in the Doc? This answer suggests it is possible with DDD, not to knock DDD, but I don't want to...
Spoilfive asked 16/2, 2021 at 6:34

2

Solved

I'm writing a program in python that simulates the reaction of particles, with the aim of teaching the user about particle reactions. As python was too slow at doing the necessary processing, I tur...
Condottiere asked 24/9, 2017 at 15:59

3

I specifically dont have performace issue with Pands Merge, as other posts suggest, but I've a class in which there are lot of methods, which does a lot of merge on datasets. The class has around...
Howells asked 29/11, 2016 at 7:52

1

Solved

I have some Cython code that I'd like to run as quickly as possible. Do I need to release the GIL in order to do this? Let's suppose my code is similar to this: import numpy as np # trivial defini...
Whiffletree asked 21/1, 2021 at 20:3

4

Solved

So I'd like to call some python code from c via cython. I've managed to call cython code from c. And I can also call python code from cython. But when I add it all together, some things are missing...
Marin asked 23/3, 2014 at 10:51

4

I am trying to deploy a python application on aws lambda. It has several large python dependencies, the largest being scipy and numpy. The result is that my application is significantly larger than...
Whittington asked 13/11, 2018 at 5:18

2

Solved

My cython / pyximport code works very well on a read/write filesystem. But (for testing purposes), I need to try it on a read only filesystem. How to change the cython / pyximport temporary direc...
Surfboat asked 6/5, 2015 at 14:36

9

Solved

I have just compiled part of my C library as an extension using Cython, as a "proof of concept". I managed to hack the code (const correctnes problems etc aside), to finally get an extension built....
Burks asked 6/11, 2011 at 2:21

6

I have been trying to install Cython for Python 2.7 on my Window 7 system. In particular, I prefer everything in 64 bits. (In case you wonder, I need Cython because Cython is one of the components ...
Misdate asked 16/5, 2014 at 2:8

2

Given an input string, I would like to find the set of all other strings that are within Levenshtein distance 2. For example, if the input string is "aaa" and the alphabet is ['a', 'b'] t...
Nidanidaros asked 16/12, 2020 at 20:13

2

Solved

I'm having trouble when handling pointers with cython. The cython implementation of the class holds a pointer to a C++ instance of class Person. Here's my .pyx file: person.pyx cdef class PyPers...
P asked 2/3, 2017 at 11:44

© 2022 - 2024 — McMap. All rights reserved.