Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #90234 > unrolled thread
| Started by | pauld11718 <pauld11718@gmail.com> |
|---|---|
| First post | 2015-05-09 07:51 -0700 |
| Last post | 2015-05-09 17:53 +0100 |
| Articles | 6 — 3 participants |
Back to article view | Back to comp.lang.python
numpy and cython pauld11718 <pauld11718@gmail.com> - 2015-05-09 07:51 -0700
Re: numpy and cython Chris Angelico <rosuav@gmail.com> - 2015-05-10 01:04 +1000
Re: numpy and cython pauld11718 <pauld11718@gmail.com> - 2015-05-09 08:56 -0700
Re: numpy and cython pauld11718 <pauld11718@gmail.com> - 2015-05-09 09:09 -0700
Re: numpy and cython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-09 17:54 +0100
Re: numpy and cython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-09 17:53 +0100
| From | pauld11718 <pauld11718@gmail.com> |
|---|---|
| Date | 2015-05-09 07:51 -0700 |
| Subject | numpy and cython |
| Message-ID | <9a85a810-8052-40be-a95d-084f0cb4e2d0@googlegroups.com> |
Unable to compile :
import numpy as np
cimport numpy as np
import math as m
DTYPE = np.float
ctypedef np.float_t DTYPE_t
def visc1(float t, float dcal):
cdef float h, tr, trinv, rhor
cdef float eta0, sumi, i, sumj, im1, jm1, eta
cdef np.ndarray vb = np.array([1.00000, 0.940695, 0.578377, -0.202044], dtype = DTYPE)
cdef np.ndarray[DTYPE_t, ndim=2] va = np.array([[.4864192, .3509007, -.2847572, .07013759,.0164122, -.01163815,.0],
[-.2448372,1.315436, -1.037026, .4660127, -.02884911,-.008239587,.0],
[-.8702035, 1.297752, -1.287846, .2292075, .0, .0, .0],
[.8716056, 1.353448, .0, -.4857462, .1607171,.0, -.003886659],
[-1.051126, .0, .0, .0, .0, .0, .0],
[.3458395, .0, -.02148229, .0, -.009603846, .004559914,.0]], dtype=DTYPE, ndim = 2)
h=55.2651e-06;
tr = t/643.89;
trinv=643.89/t;
rhor=dcal/0.358;
eta0 = h*(m.pow(tr,0.5))/(vb[0] + vb[1]/tr + vb[2]/(tr*tr) + vb[3]/(tr**3));
sumi=0.0
for i in range(6):
sumj=va[i,0]
for j in range(2,7):
jm1=j-1;
sumj=sumj+va[i,j]*((rhor-1.0)**jm1);
im1 = i-1
sumi = sumi+sumj*((trinv-1.0)**im1);
eta = eta0*m.exp(rhor*sumi)
return eta
Error :
Compiling visco.pyx because it changed.
Cythonizing visco.pyx
running build_ext
building 'visco' extension
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/deepraj/miniconda3/envs/venv1/include/python3.4m -c visco.c -o build/temp.linux-x86_64-3.4/visco.o
In file included from /usr/include/numpy/ndarraytypes.h:1761:0,
from /usr/include/numpy/ndarrayobject.h:17,
from /usr/include/numpy/arrayobject.h:4,
from visco.c:258:
/usr/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \
^
gcc -pthread -shared build/temp.linux-x86_64-3.4/visco.o -L/home/abcd/miniconda3/envs/venv1/lib -lpython3.4m -o /media/abcd/Man_UTD/pythoncode/venv1/visco.cpython-34m.so
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-05-10 01:04 +1000 |
| Message-ID | <mailman.283.1431183852.12865.python-list@python.org> |
| In reply to | #90234 |
On Sun, May 10, 2015 at 12:51 AM, pauld11718 <pauld11718@gmail.com> wrote: > Unable to compile : > /usr/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp] > #warning "Using deprecated NumPy API, disable it by " \ > ^ > gcc -pthread -shared build/temp.linux-x86_64-3.4/visco.o -L/home/abcd/miniconda3/envs/venv1/lib -lpython3.4m -o /media/abcd/Man_UTD/pythoncode/venv1/visco.cpython-34m.so Looks like a warning to me. Are you sure the compilation isn't working? Check to see if you have an output file. If you don't, there's something else wrong, not just this. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | pauld11718 <pauld11718@gmail.com> |
|---|---|
| Date | 2015-05-09 08:56 -0700 |
| Message-ID | <a3d2979c-491e-4d99-a5c3-77f62344fe0c@googlegroups.com> |
| In reply to | #90235 |
NO the compilation isn't working...
The setup.py :
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize("visco.pyx")
)
[toc] | [prev] | [next] | [standalone]
| From | pauld11718 <pauld11718@gmail.com> |
|---|---|
| Date | 2015-05-09 09:09 -0700 |
| Message-ID | <272aea55-c8a6-4b3f-ac54-4492f8ef586d@googlegroups.com> |
| In reply to | #90238 |
An interesting observation : Any simple program with just : cimport numpy as np doesnot compile.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2015-05-09 17:54 +0100 |
| Message-ID | <mailman.287.1431190808.12865.python-list@python.org> |
| In reply to | #90239 |
On 09/05/2015 17:09, pauld11718 wrote: > An interesting observation : > > Any simple program with just : > > cimport numpy as np > > doesnot compile. > Fascinating. What has this got to do with the general election results from the UK? Or is there some other context that you're not prepared to let us in on? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2015-05-09 17:53 +0100 |
| Message-ID | <mailman.285.1431190420.12865.python-list@python.org> |
| In reply to | #90238 |
On 09/05/2015 16:56, pauld11718 wrote:
> NO the compilation isn't working...
>
> The setup.py :
>
> from distutils.core import setup
> from Cython.Build import cythonize
>
> setup(
> ext_modules = cythonize("visco.pyx")
> )
>
If you cannot be bothered to supply any context so I've no idea what
you're talking about, then I cannot be bothered to try and help.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web