On Sun, May 27, 2012 at 1:25 PM, Apostolis Glenis <[email protected]> wrote: > After google searching i found no -lboost_python-gcc43-mt so I suspect that > if I change that in the linking command it would work without any problems. > Did I do anything wrong with the installation of pycuda or codePy? (I think > that codePy was installed when i installed copperhead). > So I have two questions: > how can I change -lboost_python-gcc43-mt to -lboost_python. > how can I make that the default behaviour.
I had the same problem. The reason is that CodePy creates a default string for boost-python (the one you pasted above) if it does not find a config file. I fixed this by copying the site-config.py from the pycuda directory (created by configure.py) to ~/.aksetup-defaults.py which then gets picked up by CodePy to link against the correct boost_python. Also make sure to set USE_SHIPPED_BOOST = False. HTH, Thomas > Apostolis > > 2012/5/27 Apostolis Glenis <[email protected]> >> >> I tried to run the example and I got this error: >> >> ---------------------- Host code ---------------------- >> #include <boost/python.hpp> >> #include <cuda.h> >> void my_sort(CUdeviceptr input_ptr, int length); >> #include <boost/python/extract.hpp> >> using namespace boost::python; >> >> namespace private_namespace_db9cd38ee0995488b35c8405321b8f95 >> { >> object host_entry(object gpu_array) >> { >> tuple shape = extract<tuple>(gpu_array.attr("shape")); >> int length = extract<int>(shape[0]); >> CUdeviceptr ptr = extract<CUdeviceptr>(gpu_array.attr("gpudata")); >> my_sort(ptr, length); >> return gpu_array; >> } >> } >> >> using namespace private_namespace_db9cd38ee0995488b35c8405321b8f95; >> >> BOOST_PYTHON_MODULE(module) >> { >> boost::python::def("host_entry", &host_entry); >> } >> --------------------- Device code --------------------- >> #include <thrust/sort.h> >> #include <thrust/device_vector.h> >> #include <cuda.h> >> >> void my_sort(CUdeviceptr input_ptr, int length) >> { >> thrust::device_ptr<float> thrust_ptr((float*)input_ptr); >> thrust::sort(thrust_ptr, thrust_ptr+length); >> } >> ------------------------------------------------------- >> /usr/bin/ld: skipping incompatible /usr/local/cuda/lib/libcudart.so when >> searching for -lcudart >> /usr/bin/ld: cannot find -lboost_python-gcc43-mt >> collect2: ld returned 1 exit status >> FAILED compiler invocation: g++ -pthread -fno-strict-aliasing -g -O2 -g >> -fwrapv -O2 -Wall -fPIC -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions >> -Wl,-Bsymbolic-functions -Xlinker -export-dynamic -Wl,-O1 >> -Wl,-Bsymbolic-functions -DNDEBUG -I/usr/include/python2.7 >> -I/usr/local/cuda/include >> /tmp/codepy-compiler-cache-v5-uid1000/207349795ab4e8438bf4fe266c0a7f2c/module.o >> /tmp/codepy-compiler-cache-v5-uid1000/cd6dbc7737faf0ddefa740abfda66139/gpu.o >> -L/usr/lib -L/usr/local/cuda/lib -L/usr/local/cuda/lib64 -lcuda -lcudart >> -lboost_python-gcc43-mt -lpthread -ldl -lutil -o >> /tmp/codepy-compiler-cache-v5-uid1000/207349795ab4e8438bf4fe266c0a7f2c/codepy.temp.207349795ab4e8438bf4fe266c0a7f2c.module.so >> Link error, examine >> ['/tmp/codepy-compiler-cache-v5-uid1000/207349795ab4e8438bf4fe266c0a7f2c/module.o', >> '/tmp/codepy-compiler-cache-v5-uid1000/cd6dbc7737faf0ddefa740abfda66139/gpu.o'], >> then press [Enter] >> Traceback (most recent call last): >> File "thrust_demo.py", line 85, in <module> >> module = nvcc_mod.compile(gcc_toolchain, nvcc_toolchain, debug=False) >> File >> "/usr/local/lib/python2.7/dist-packages/codepy-2012.1.2-py2.7.egg/codepy/cuda.py", >> line 104, in compile >> host_mod_name, **kwargs) >> File >> "/usr/local/lib/python2.7/dist-packages/codepy-2012.1.2-py2.7.egg/codepy/jit.py", >> line 427, in link_extension >> toolchain.link_extension(destination, objects, debug=debug) >> File >> "/usr/local/lib/python2.7/dist-packages/codepy-2012.1.2-py2.7.egg/codepy/toolchain.py", >> line 210, in link_extension >> raise CompileError, "module compilation failed" >> codepy.CompileError: module compilation failed >> >> It seems that there are two errors: >> 1.It tries to link with the 32bit version of cudart, not the 64bit >> 2.It cannot find libboost-python-mt although i have installed the package >> libboost and the development files from synaptic. >> >> My OS is ubuntu 11.10 . >> >> What should I do next? >> >> Thank you in advance , >> >> Apostolis >> >> 2012/5/26 Andreas Kloeckner <[email protected]> >>> >>> On Sat, 26 May 2012 14:59:28 -0400, Thomas Wiecki >>> <[email protected]> wrote: >>> > I tried using the shipped version (bpl_subset) but couldn't get it to >>> > work somehow (how is one supposed to get the lib files?). >>> > >>> > I now set USE_SHIPPED_BOOST = False and that seems to do the trick >>> > with the ubuntu 11.10 boost packages 1.46.1 >>> >>> Right. Should've remembered to say that. There's no way to make codepy >>> work with shipped boost. The reason for this is twofold: a) as you >>> remark, you don't get a libboost-python*, which codepy requires, and >>> even if you got that from elsewhere, b) Boost.Python keeps a global >>> registry of from/to-python converters. Once there are two copies of that >>> registry loaded into a single Python interpreter, things start getting >>> weird. Very weird. :) >>> >>> Andreas >>> >>> >>> _______________________________________________ >>> PyCUDA mailing list >>> [email protected] >>> http://lists.tiker.net/listinfo/pycuda >>> >> > > > _______________________________________________ > PyCUDA mailing list > [email protected] > http://lists.tiker.net/listinfo/pycuda > _______________________________________________ PyCUDA mailing list [email protected] http://lists.tiker.net/listinfo/pycuda
