btgraham / SparseConvNet-archived

Spatially-sparse convolutional networks. Allows processing of sparse 2, 3 and 4 dimensional data.Build CNNs on the square/cubic/hypercubic or triangular/tetrahedral/hyper-tetrahedral lattices.
https://github.com/btgraham/SparseConvNet/wiki
406 stars 122 forks source link

Compiling on MAC OS X #2

Closed SpiderMonkey1975 closed 9 years ago

SpiderMonkey1975 commented 9 years ago

Trying to compile the source code on my Mac (OS X 10.10) with the latest CUDA 7.0 and Xcode drivers. I cannot get pass the compilation of BatchProducer.cu. The NVCC compiler complains when trying to full the thread vector (workers) in the BatchProducer constructor function. You have each thread binded to the creation of a batchProducerThread object. Unfortunately, I keep getting error that the thread is being binded to a deleted function. If change the thread target to a vector of threads defined explicitly outside the constructor, the everything works fine.

How you seen this before?

btgraham commented 9 years ago

Hello. What is the error message exactly, please? And what if you replace workers.emplace_back(std::thread(std::bind(&BatchProducer::batchProducerThread,this,nThread)));
with workers.emplace_back(std::thread(&BatchProducer::batchProducerThread,this,nThread)); ?? Regards Ben Graham (b.graham@warwick.ac.uk)

SpiderMonkey1975 commented 9 years ago

Here is the error I get using the original code:

bash-3.2$ make cifar10 nvcc -c -o BatchProducer.o BatchProducer.cu -std=c++11 -O3 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits(3476): error: function "std::1::nat::~nat()" (1027): here cannot be referenced -- it is a deleted function detected during: instantiation of class "std::1::invokable_imp<_Fp, _Args...> [with Fp=BatchProducer &, _Args=<>]" (3484): here instantiation of class "std::1::invokable<_Fp, _Args...> [with _Fp=BatchProducer *&, _Args=<>]" (3503): here instantiation of class "std::1::invoke_of<_Fp, _Args...> [with _Fp=BatchProducer *&, _Args=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional(2023): here instantiation of "std::1::bind_return<_Fp, _BoundArgs, _Args, std::__1::_is_valid_bind_return<_Fp, _BoundArgs, _Args>::value>::type std::1::apply_functor(_Fp &, _BoundArgs &, std::1::tuple_indices<_Indx...>, _Args &&) [with Fp=void (BatchProducer::)(int), _BoundArgs=std::1::tuple<BatchProducer *, int>, _Indx=<0UL, 1UL>, _Args=std::1::tuple<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional(2087): here instantiation of "std::1::bind_returnstd::1::decay<_Fp::type, std::1::tuplestd::1::decay<_BoundArgs::type...>, std::1::tuple<_Args &&...>, std::1::_is_valid_bind_returnstd::1::decay<_Fp::type, std::1::tuplestd::1::decay<_BoundArgs::type...>, std::__1::tuple<_Args &&...>>::value>::type std::1::bind<_Fp, _BoundArgs...>::operator()(_Args &&...) [with Fp=void (BatchProducer::)(int), _BoundArgs=<BatchProducer *, int &>, _Args=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__functional_base(413): here instantiation of "auto std::1::invoke(_Fp &&, _Args &&...)->decltype(()) [with Fp=std::1::bind<void (BatchProducer::)(int), BatchProducer _, int &>, _Args=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread(332): here instantiation of "void std::1::thread_execute(std::1::tuple<_Fp, _Args...> &, std::1::__tuple_indices<_Indices...>) [with _Fp=std::1::bind<void (BatchProducer::)(int), BatchProducer , int &>, _Args=<>, _Indices=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread(342): here instantiation of "void *std::1::thread_proxy<_Fp>(void *) [with _Fp=std::1::tuple<std::1::bind<void (BatchProducer::)(int), BatchProducer , int &>>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread(354): here instantiation of "std::1::thread::thread(_Fp &&, _Args &&...) [with _Fp=std::1::_bind<void (BatchProducer::)(int), BatchProducer *, int &>, _Args=<>, =void]" BatchProducer.cu(121): here

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits(3476): error: function "std::1::nat::~nat()" (1027): here cannot be referenced -- it is a deleted function detected during: instantiation of class "std::1::invokable_imp<_Fp, _Args...> [with _Fp=int &, _Args=<>]" (3484): here instantiation of class "std::1::invokable<_Fp, _Args...> [with _Fp=int &, _Args=<>]" (3503): here instantiation of class "std::1::invoke_of<_Fp, _Args...> [with _Fp=int &, _Args=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional(2023): here instantiation of "std::1::bind_return<_Fp, _BoundArgs, _Args, std::1::_is_valid_bind_return<_Fp, _BoundArgs, _Args>::value>::type std::1::apply_functor(_Fp &, _BoundArgs &, std::1::tuple_indices<_Indx...>, _Args &&) [with Fp=void (BatchProducer::)(int), _BoundArgs=std::1::tuple<BatchProducer *, int>, _Indx=<0UL, 1UL>, _Args=std::1::tuple<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional(2087): here instantiation of "std::1::bind_returnstd::1::decay<_Fp::type, std::1::tuplestd::1::decay<_BoundArgs::type...>, std::1::tuple<_Args &&...>, std::1::_is_valid_bind_returnstd::1::decay<_Fp::type, std::1::tuplestd::1::decay<_BoundArgs::type...>, std::1::tuple<_Args &&...>>::value>::type std::1::bind<_Fp, _BoundArgs...>::operator()(_Args &&...) [with Fp=void (BatchProducer::)(int), _BoundArgs=<BatchProducer *, int &>, _Args=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional_base(413): here instantiation of "auto std::1::invoke(_Fp &&, _Args &&...)->decltype(()) [with _Fp=std::1::bind<void (BatchProducer::)(int), BatchProducer , int &>, _Args=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread(332): here instantiation of "void std::1::thread_execute(std::1::tuple<_Fp, _Args...> &, std::1::tuple_indices<_Indices...>) [with _Fp=std::1::bind<void (BatchProducer::)(int), BatchProducer , int &>, _Args=<>, _Indices=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread(342): here instantiation of "void _std::1::thread_proxy<_Fp>(void *) [with _Fp=std::1::tuple<std::1::bind<void (BatchProducer::)(int), BatchProducer , int &>>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread(354): here instantiation of "std::1::thread::thread(_Fp &&, _Args &&...) [with _Fp=std::1::_bind<void (BatchProducer::)(int), BatchProducer *, int &>, _Args=<>, =void]" BatchProducer.cu(121): here

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits(3476): error: function "std::1::nat::~nat()" (1027): here cannot be referenced -- it is a deleted function detected during: instantiation of class "std::1::invokable_imp<_Fp, _Args...> [with _Fp=int &, _Args=<>]" (3484): here instantiation of class "std::1::invokable<_Fp, _Args...> [with _Fp=int &, _Args=<>]" (3503): here instantiation of class "std::1::invoke_of<_Fp, _Args...> [with _Fp=int &, _Args=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional(2023): here instantiation of "std::1::bind_return<_Fp, _BoundArgs, _Args, std::1::_is_valid_bind_return<_Fp, _BoundArgs, _Args>::value>::type std::1::apply_functor(_Fp &, _BoundArgs &, std::1::tuple_indices<_Indx...>, _Args &&) [with Fp=void (BatchProducer::)(int), _BoundArgs=std::1::tuple<BatchProducer *, int>, _Indx=<0UL, 1UL>, _Args=std::1::tuple<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional(2087): here instantiation of "std::1::bind_returnstd::1::decay<_Fp::type, std::1::tuplestd::1::decay<_BoundArgs::type...>, std::1::tuple<_Args &&...>, std::1::_is_valid_bind_returnstd::1::decay<_Fp::type, std::1::tuplestd::1::decay<_BoundArgs::type...>, std::1::tuple<_Args &&...>>::value>::type std::1::bind<_Fp, _BoundArgs...>::operator()(_Args &&...) [with Fp=void (BatchProducer::)(int), _BoundArgs=<BatchProducer *, int &>, _Args=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional_base(413): here instantiation of "auto std::1::invoke(_Fp &&, _Args &&...)->decltype(()) [with _Fp=std::1::bind<void (BatchProducer::)(int), BatchProducer , int &>, _Args=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread(332): here instantiation of "void std::1::thread_execute(std::1::tuple<_Fp, _Args...> &, std::1::tuple_indices<_Indices...>) [with _Fp=std::1::bind<void (BatchProducer::)(int), BatchProducer , int &>, _Args=<>, _Indices=<>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread(342): here instantiation of "void _std::1::thread_proxy<_Fp>(void *) [with _Fp=std::1::tuple<std::1::bind<void (BatchProducer::)(int), BatchProducer , int &>>]" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/thread(354): here instantiation of "std::1::thread::thread(_Fp &&, _Args &&...) [with _Fp=std::1::_bind<void (BatchProducer::)(int), BatchProducer *, int &>, _Args=<>, =void]" BatchProducer.cu(121): here

2 errors detected in the compilation of "/var/folders/41/f35mc0q121g3rfzcsqbdvz400000gn/T//tmpxft_0000b00f_00000000-7_BatchProducer.cpp1.ii". make: *\ [BatchProducer.o] Error 2

SpiderMonkey1975 commented 9 years ago

Dang! Compile worked when I removed the bind call like you suggested. I was sure that I tried that on Saturday. Serves me right coding without coffee. Sincere apologies for the mix-up!

btgraham commented 9 years ago

I have updated the repo, thanks. The "bind" was left-over from when I was using Boost threads rather than C++11 threads. Ben