Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install requirements? #4

Closed
gatortim opened this issue Dec 5, 2014 · 5 comments
Closed

Install requirements? #4

gatortim opened this issue Dec 5, 2014 · 5 comments

Comments

@gatortim
Copy link

gatortim commented Dec 5, 2014

Hi,
It looks like this only compiles for Objective C. Am I doing something wrong with a gcc only machine, or is C++ not supported?

Thanks
-Tim

@andersbll
Copy link
Owner

Sounds very strange. I don't see how this can compile as Objective C. What errors do you get when executing the Makefile with a C++ compiler?

@gatortim
Copy link
Author

gatortim commented Jan 3, 2015

Sorry, pretty poor issue description there.

Here is what I'm getting during python setup.py install:

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
g++ -pthread -shared build/temp.linux-x86_64-2.7/./cudarray/wrap/cudart.o -L/usr/local/cuda-6.5/lib64 -L/home/tim/anaconda/lib -L/home/tim/anaconda/lib -lcudart -lcudarray -lpython2.7 -o build/lib.linux-x86_64-2.7/cudarray/wrap/cudart.so -fPIC
cythoning ./cudarray/wrap/array_data.pyx to ./cudarray/wrap/array_data.cpp

Error compiling Cython file:

...
from libcpp cimport bool
cimport numpy as np

cdef extern from 'cudarray/common.hpp' namespace 'cudarray':
ctypedef int bool_t;

^

cudarray/wrap/array_data.pxd:5:23: Syntax error in ctypedef statement

Error compiling Cython file:

...
@Property
def itemsize(self):
return self.dtype.itemsize

cdef bool_t *bool_ptr(ArrayData a):

^

cudarray/wrap/array_data.pyx:50:5: 'bool_t' is not a type identifier

Error compiling Cython file:

...

cdef int *int_ptr(ArrayData a):
return <int *> a.dev_ptr

cdef bool is_int(ArrayData a):

^

cudarray/wrap/array_data.pyx:62:5: 'bool' is not a type identifier

Error compiling Cython file:

...

cdef bool is_int(ArrayData a):
return a.dtype == np.dtype('int32')

cdef bool is_float(ArrayData a):

^

cudarray/wrap/array_data.pyx:66:5: 'bool' is not a type identifier

Error compiling Cython file:

...
self.dtype = dtype
self.nbytes = size*dtype.itemsize
self.owner = owner
self.offset = offset
if owner is None:
cudaCheck(cudaMalloc(&self.dev_ptr, self.nbytes))

^

cudarray/wrap/array_data.pyx:16:33: Cannot take address of Python variable

Error compiling Cython file:

...
if owner is None:
cudaCheck(cudaMalloc(&self.dev_ptr, self.nbytes))
else:
self.dev_ptr = owner.dev_ptr + offset*dtype.itemsize
if np_data is not None:
cudaCheck(cudaMemcpyAsync(self.dev_ptr, np.PyArray_DATA(np_data),

^

cudarray/wrap/array_data.pyx:20:42: Cannot convert Python object to 'void *'

Error compiling Cython file:

...
if np_data is not None:
cudaCheck(cudaMemcpyAsync(self.dev_ptr, np.PyArray_DATA(np_data),
self.nbytes, cudaMemcpyHostToDevice))

def to_numpy(self, np_array):
    cudaCheck(cudaMemcpy(np.PyArray_DATA(np_array), self.dev_ptr,
                                                       ^

cudarray/wrap/array_data.pyx:24:60: Cannot convert Python object to 'void const *'

Error compiling Cython file:

...
self.nbytes, cudaMemcpyDeviceToHost))
return np_array

def __dealloc__(self):
    if self.owner is None:
        cudaFree(self.dev_ptr)
                    ^

cudarray/wrap/array_data.pyx:30:25: Cannot convert Python object to 'void *'

Error compiling Cython file:

...
def itemsize(self):
return self.dtype.itemsize

cdef bool_t *bool_ptr(ArrayData a):
return <bool_t *> a.dev_ptr

^

cudarray/wrap/array_data.pyx:51:12: 'bool_t' is not a type identifier

Error compiling Cython file:

...
cdef bool_t *bool_ptr(ArrayData a):
return <bool_t *> a.dev_ptr

cdef float *float_ptr(ArrayData a):
return <float *> a.dev_ptr

^

cudarray/wrap/array_data.pyx:55:11: Python objects cannot be cast to pointers of primitive types

Error compiling Cython file:

...
cdef float *float_ptr(ArrayData a):
return <float *> a.dev_ptr

cdef int *int_ptr(ArrayData a):
return <int *> a.dev_ptr

I'm using anaconda and it looks like I've got cython 0.20.1

Did I miss a requirement here? Make and Make Install both complete without any apparent issue.

Thanks
-Tim

@andersbll
Copy link
Owner

You need the latest version of Cython (0.21). I have recently updated the requirements in setup.py to reflect this. Be sure to checkout the latest version of CUDArray.

Best,
Anders

@gatortim
Copy link
Author

gatortim commented Jan 3, 2015

Hi Anders,
Works like a charm now. Thanks!
-Tim

@gatortim gatortim closed this as completed Jan 3, 2015
@andersbll
Copy link
Owner

Good to hear! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants