Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

STATIC_ASSERTION_FAILURE when compiling *.cpp files #526

Closed
schiller-manuel opened this issue Jul 11, 2014 · 10 comments
Closed

STATIC_ASSERTION_FAILURE when compiling *.cpp files #526

schiller-manuel opened this issue Jul 11, 2014 · 10 comments

Comments

@schiller-manuel
Copy link

When using the latest thrust version from git in my project, I get a lot of the following errors:

thrust/detail/static_assert.h:71:13: error: invalid application of ‘sizeof’ to incomplete type ‘thrust::detail::STATIC_ASSERTION_FAILURE’
       sizeof(::thrust::detail::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\

I tried to reproduce it in a small example, turns out I cannot use a device_vector with initial size > 0 in a cpp-file.

test.cpp

#include <thrust/device_vector.h>
#include <iostream>

int main()
{
  thrust::device_vector<int> vec(1);
  std::cout << vec.size() << std::endl;
}

When I compile using

nvcc test.cpp

I get this output: https://gist.github.com/dachziegel/90ebaf38c8249f1f094c

When the file is named test.cu, compiling works without a problem.

CUDA Version: 6.0
gcc-version: 4.8.1

@jaredhoberock
Copy link
Contributor

This is the expected behavior, right? I get the same error with each release of Thrust going back to 1.5.

When you create a device_vector with more than 0 elements, you are implicitly asking the compiler to compile a CUDA kernel. The problem is that when you invoke nvcc with a .cpp source file, you are compiling in C++ mode (not CUDA C++).

@schiller-manuel
Copy link
Author

The compiler problem does not occur e.g. with this commit: b1b7d28

@jaredhoberock
Copy link
Contributor

That may be, but it's unintentional. Every released version of Thrust treats this as an error. Constructing device_vector is not intended to work unless you are compiling with CUDA support. I'm closing this, as everything indicates this is working as intended.

@schiller-manuel
Copy link
Author

Is there any way to avoid having to use a *.cu file? I use thrust::device_vector in combination with boost::mpl which nvcc complains about, so I compiled it (successfully) using gcc alone in a *.cpp file.

@jaredhoberock
Copy link
Contributor

Yes, use nvcc --x cu on the command line to interpret a .cpp file as a CUDA file.

Alternatively, you could separate the code which constructs the device_vector into a separate .cu file and write a factory function to return the device_vector.

@schiller-manuel
Copy link
Author

I still have issues with this.

This compiles

// compiles.cpp
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
int main()
{
  thrust::host_vector<int> hVec(100);
  thrust::device_vector<int> dVec = hVec;
  return 0;
}

but this does not:

// compiles_not.cpp
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
#include <thrust/complex.h>

int main()
{
  typedef thrust::complex<float> Complex;  

  thrust::host_vector<Complex> hVec(100);
  thrust::device_vector<Complex> dVec = hVec;

  return 0;
}

Which behavior is the intended one?
Why would I need a CUDA kernel if I just copy a vector from host to device?

@jaredhoberock
Copy link
Contributor

The second example is intended to be an error. I'm not sure about the first one -- it may be a bug, because we don't test to ensure such code works. It looks like we explicitly removed testing for this case a few years ago.

The first one compiles because int can be copied between CPU & GPU without needing to execute any program-defined code (i.e., copy constructors). The same is not true for thrust::complex, and the second one fails.

If we could do it over again, we probably wouldn't allow device_vector in vanilla C++ code at all due to these problems. I would avoid attempting to construct device_vector in .cpp files.

@aspirerabbit
Copy link

/home/amax/HeartNext/src/VectorWrapper.cpp: In function ‘int parse_tissue(lua_State*)’:
/home/amax/HeartNext/src/VectorWrapper.cpp:149:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(dimx * dimy * dimz != rawData.size())
^
/home/amax/HeartNext/src/VectorWrapper.cpp:160:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int rawIndex = 0; rawIndex != rawData.size(); ++rawIndex){
^
In file included from /usr/local/cuda/include/thrust/detail/reference.h:173:0,
from /usr/local/cuda/include/thrust/memory.h:25,
from /usr/local/cuda/include/thrust/detail/allocator/temporary_allocator.h:23,
from /usr/local/cuda/include/thrust/detail/temporary_array.h:40,
from /usr/local/cuda/include/thrust/system/cuda/detail/internal/copy_cross_system.h:41,
from /usr/local/cuda/include/thrust/system/cuda/detail/copy.h:99,
from /usr/local/cuda/include/thrust/system/detail/adl/copy.h:42,
from /usr/local/cuda/include/thrust/detail/copy.inl:22,
from /usr/local/cuda/include/thrust/detail/copy.h:90,
from /usr/local/cuda/include/thrust/detail/allocator/copy_construct_range.inl:21,
from /usr/local/cuda/include/thrust/detail/allocator/copy_construct_range.h:46,
from /usr/local/cuda/include/thrust/detail/contiguous_storage.inl:22,
from /usr/local/cuda/include/thrust/detail/contiguous_storage.h:161,
from /usr/local/cuda/include/thrust/detail/vector_base.h:29,
from /usr/local/cuda/include/thrust/host_vector.h:26,
from /home/amax/HeartNext/include/base.h:3,
from /home/amax/HeartNext/include/VectorWrapper.h:5,
from /home/amax/HeartNext/src/VectorWrapper.cpp:1:
/usr/local/cuda/include/thrust/detail/reference.inl: In instantiation of ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::strip_const_get_value(const System&) const [with System = thrust::cuda_cub::tag; Element = double; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = double]’:
/usr/local/cuda/include/thrust/detail/reference.inl:105:31: required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::convert_to_value_type(System*) const [with System = thrust::cuda_cub::tag; Element = double; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = double]’
/usr/local/cuda/include/thrust/detail/reference.inl:122:31: required from ‘thrust::reference<Element, Pointer, Derived>::operator thrust::reference<Element, Pointer, Derived>::value_type() const [with Element = double; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = double]’
/home/amax/HeartNext/include/VectorWrapper.h:87:52: required from ‘VectorWrapper::value_type VectorWrapper::at(lua_Integer) [with Container = thrust::device_vector; VectorWrapper::value_type = double; lua_Integer = long int]’
/home/amax/HeartNext/include/VectorWrapper.h:117:26: required from ‘static void VectorWrapper::export_class(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/include/Lua.hh:204:24: required from ‘void util::Lua::export_class() [with T = VectorWrapper<thrust::device_vector >; P = util::Lua::LuaObject]’
/home/amax/HeartNext/include/VectorWrapper.h:104:3: required from ‘static void VectorWrapper::export_me(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/src/VectorWrapper.cpp:324:19: required from here
/usr/local/cuda/include/thrust/detail/reference.inl:137:73: error: void value not ignored as it ought to be
return get_value(thrust::detail::derived_cast(non_const_system), m_ptr);
^
/usr/local/cuda/include/thrust/detail/reference.inl: In instantiation of ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::strip_const_get_value(const System&) const [with System = thrust::cuda_cub::tag; Element = int; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = int]’:
/usr/local/cuda/include/thrust/detail/reference.inl:105:31: required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::convert_to_value_type(System*) const [with System = thrust::cuda_cub::tag; Element = int; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = int]’
/usr/local/cuda/include/thrust/detail/reference.inl:122:31: required from ‘thrust::reference<Element, Pointer, Derived>::operator thrust::reference<Element, Pointer, Derived>::value_type() const [with Element = int; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = int]’
/home/amax/HeartNext/include/VectorWrapper.h:87:52: required from ‘VectorWrapper::value_type VectorWrapper::at(lua_Integer) [with Container = thrust::device_vector; VectorWrapper::value_type = int; lua_Integer = long int]’
/home/amax/HeartNext/include/VectorWrapper.h:117:26: required from ‘static void VectorWrapper::export_class(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/include/Lua.hh:204:24: required from ‘void util::Lua::export_class() [with T = VectorWrapper<thrust::device_vector >; P = util::Lua::LuaObject]’
/home/amax/HeartNext/include/VectorWrapper.h:104:3: required from ‘static void VectorWrapper::export_me(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/src/VectorWrapper.cpp:326:16: required from here
/usr/local/cuda/include/thrust/detail/reference.inl:137:73: error: void value not ignored as it ought to be
In file included from /usr/local/cuda/include/thrust/system/detail/generic/for_each.h:27:0,
from /usr/local/cuda/include/thrust/detail/for_each.inl:26,
from /usr/local/cuda/include/thrust/for_each.h:279,
from /usr/local/cuda/include/thrust/system/detail/generic/transform.inl:19,
from /usr/local/cuda/include/thrust/system/detail/generic/transform.h:105,
from /usr/local/cuda/include/thrust/detail/transform.inl:25,
from /usr/local/cuda/include/thrust/transform.h:724,
from /usr/local/cuda/include/thrust/system/detail/generic/copy.inl:23,
from /usr/local/cuda/include/thrust/system/detail/generic/copy.h:58,
from /usr/local/cuda/include/thrust/detail/copy.inl:21,
from /usr/local/cuda/include/thrust/detail/copy.h:90,
from /usr/local/cuda/include/thrust/detail/allocator/copy_construct_range.inl:21,
from /usr/local/cuda/include/thrust/detail/allocator/copy_construct_range.h:46,
from /usr/local/cuda/include/thrust/detail/contiguous_storage.inl:22,
from /usr/local/cuda/include/thrust/detail/contiguous_storage.h:161,
from /usr/local/cuda/include/thrust/detail/vector_base.h:29,
from /usr/local/cuda/include/thrust/host_vector.h:26,
from /home/amax/HeartNext/include/base.h:3,
from /home/amax/HeartNext/include/VectorWrapper.h:5,
from /home/amax/HeartNext/src/VectorWrapper.cpp:1:
/usr/local/cuda/include/thrust/system/detail/generic/for_each.h: In instantiation of ‘void thrust::system::detail::generic::get_value(thrust::execution_policy&, Pointer) [with DerivedPolicy = thrust::cuda_cub::tag; Pointer = thrust::device_ptr]’:
/usr/local/cuda/include/thrust/detail/reference.inl:137:19: required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::strip_const_get_value(const System&) const [with System = thrust::cuda_cub::tag; Element = double; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = double]’
/usr/local/cuda/include/thrust/detail/reference.inl:105:31: required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::convert_to_value_type(System*) const [with System = thrust::cuda_cub::tag; Element = double; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = double]’
/usr/local/cuda/include/thrust/detail/reference.inl:122:31: required from ‘thrust::reference<Element, Pointer, Derived>::operator thrust::reference<Element, Pointer, Derived>::value_type() const [with Element = double; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = double]’
/home/amax/HeartNext/include/VectorWrapper.h:87:52: required from ‘VectorWrapper::value_type VectorWrapper::at(lua_Integer) [with Container = thrust::device_vector; VectorWrapper::value_type = double; lua_Integer = long int]’
/home/amax/HeartNext/include/VectorWrapper.h:117:26: required from ‘static void VectorWrapper::export_class(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/include/Lua.hh:204:24: required from ‘void util::Lua::export_class() [with T = VectorWrapper<thrust::device_vector >; P = util::Lua::LuaObject]’
/home/amax/HeartNext/include/VectorWrapper.h:104:3: required from ‘static void VectorWrapper::export_me(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/src/VectorWrapper.cpp:324:19: required from here
/usr/local/cuda/include/thrust/detail/static_assert.h:71:13: error: invalid application of ‘sizeof’ to incomplete type ‘thrust::detail::STATIC_ASSERTION_FAILURE’
sizeof(::thrust::detail::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>
^
/usr/local/cuda/include/thrust/system/detail/generic/for_each.h:49:3: note: in expansion of macro ‘THRUST_STATIC_ASSERT’
THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<InputIterator, false>::value) );
^
/usr/local/cuda/include/thrust/system/detail/generic/for_each.h: In instantiation of ‘void thrust::system::detail::generic::get_value(thrust::execution_policy&, Pointer) [with DerivedPolicy = thrust::cuda_cub::tag; Pointer = thrust::device_ptr]’:
/usr/local/cuda/include/thrust/detail/reference.inl:137:19: required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::strip_const_get_value(const System&) const [with System = thrust::cuda_cub::tag; Element = int; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = int]’
/usr/local/cuda/include/thrust/detail/reference.inl:105:31: required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::convert_to_value_type(System*) const [with System = thrust::cuda_cub::tag; Element = int; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = int]’
/usr/local/cuda/include/thrust/detail/reference.inl:122:31: required from ‘thrust::reference<Element, Pointer, Derived>::operator thrust::reference<Element, Pointer, Derived>::value_type() const [with Element = int; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = int]’
/home/amax/HeartNext/include/VectorWrapper.h:87:52: required from ‘VectorWrapper::value_type VectorWrapper::at(lua_Integer) [with Container = thrust::device_vector; VectorWrapper::value_type = int; lua_Integer = long int]’
/home/amax/HeartNext/include/VectorWrapper.h:117:26: required from ‘static void VectorWrapper::export_class(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/include/Lua.hh:204:24: required from ‘void util::Lua::export_class() [with T = VectorWrapper<thrust::device_vector >; P = util::Lua::LuaObject]’
/home/amax/HeartNext/include/VectorWrapper.h:104:3: required from ‘static void VectorWrapper::export_me(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/src/VectorWrapper.cpp:326:16: required from here
/usr/local/cuda/include/thrust/detail/static_assert.h:71:13: error: invalid application of ‘sizeof’ to incomplete type ‘thrust::detail::STATIC_ASSERTION_FAILURE’
sizeof(::thrust::detail::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>
^
/usr/local/cuda/include/thrust/system/detail/generic/for_each.h:49:3: note: in expansion of macro ‘THRUST_STATIC_ASSERT’
THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<InputIterator, false>::value) );
^
/usr/local/cuda/include/thrust/system/detail/generic/for_each.h: In instantiation of ‘void thrust::system::detail::generic::assign_value(thrust::execution_policy&, Pointer1, Pointer2) [with DerivedPolicy = thrust::cuda_cub::cross_system<thrust::cuda_cub::tag, thrust::system::cpp::detail::tag>; Pointer1 = thrust::device_ptr; Pointer2 = const double*]’:
/usr/local/cuda/include/thrust/detail/reference.inl:183:15: required from ‘void thrust::reference<Element, Pointer, Derived>::strip_const_assign_value(const System&, OtherPointer) [with System = thrust::cuda_cub::cross_system<thrust::cuda_cub::tag, thrust::system::cpp::detail::tag>; OtherPointer = const double*; Element = double; Pointer = thrust::device_ptr; Derived = thrust::device_reference]’
/usr/local/cuda/include/thrust/detail/reference.inl:149:27: required from ‘void thrust::reference<Element, Pointer, Derived>::assign_from(System1*, System2*, OtherPointer) [with System1 = thrust::cuda_cub::tag; System2 = thrust::system::cpp::detail::tag; OtherPointer = const double*; Element = double; Pointer = thrust::device_ptr; Derived = thrust::device_reference]’
/usr/local/cuda/include/thrust/detail/reference.inl:169:14: required from ‘void thrust::reference<Element, Pointer, Derived>::assign_from(OtherPointer) [with OtherPointer = const double*; Element = double; Pointer = thrust::device_ptr; Derived = thrust::device_reference]’
/usr/local/cuda/include/thrust/detail/reference.inl:69:14: required from ‘thrust::reference<Element, Pointer, Derived>::derived_type& thrust::reference<Element, Pointer, Derived>::operator=(const value_type&) [with Element = double; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::derived_type = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = double]’
/usr/local/cuda/include/thrust/detail/device_reference.inl:44:28: required from ‘thrust::device_reference& thrust::device_reference::operator=(const value_type&) [with T = double; thrust::device_reference::value_type = double]’
/home/amax/HeartNext/include/VectorWrapper.h:76:15: required from ‘void VectorWrapper::assign(int, typename Container::value_type) [with Container = thrust::device_vector; typename Container::value_type = double]’
/home/amax/HeartNext/include/VectorWrapper.h:118:27: required from ‘static void VectorWrapper::export_class(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/include/Lua.hh:204:24: required from ‘void util::Lua::export_class() [with T = VectorWrapper<thrust::device_vector >; P = util::Lua::LuaObject]’
/home/amax/HeartNext/include/VectorWrapper.h:104:3: required from ‘static void VectorWrapper::export_me(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/src/VectorWrapper.cpp:324:19: required from here
/usr/local/cuda/include/thrust/detail/static_assert.h:71:13: error: invalid application of ‘sizeof’ to incomplete type ‘thrust::detail::STATIC_ASSERTION_FAILURE’
sizeof(::thrust::detail::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>
^
/usr/local/cuda/include/thrust/system/detail/generic/for_each.h:49:3: note: in expansion of macro ‘THRUST_STATIC_ASSERT’
THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<InputIterator, false>::value) );
^
/usr/local/cuda/include/thrust/system/detail/generic/for_each.h: In instantiation of ‘void thrust::system::detail::generic::assign_value(thrust::execution_policy&, Pointer1, Pointer2) [with DerivedPolicy = thrust::cuda_cub::cross_system<thrust::cuda_cub::tag, thrust::system::cpp::detail::tag>; Pointer1 = thrust::device_ptr; Pointer2 = const int*]’:
/usr/local/cuda/include/thrust/detail/reference.inl:183:15: required from ‘void thrust::reference<Element, Pointer, Derived>::strip_const_assign_value(const System&, OtherPointer) [with System = thrust::cuda_cub::cross_system<thrust::cuda_cub::tag, thrust::system::cpp::detail::tag>; OtherPointer = const int*; Element = int; Pointer = thrust::device_ptr; Derived = thrust::device_reference]’
/usr/local/cuda/include/thrust/detail/reference.inl:149:27: required from ‘void thrust::reference<Element, Pointer, Derived>::assign_from(System1*, System2*, OtherPointer) [with System1 = thrust::cuda_cub::tag; System2 = thrust::system::cpp::detail::tag; OtherPointer = const int*; Element = int; Pointer = thrust::device_ptr; Derived = thrust::device_reference]’
/usr/local/cuda/include/thrust/detail/reference.inl:169:14: required from ‘void thrust::reference<Element, Pointer, Derived>::assign_from(OtherPointer) [with OtherPointer = const int*; Element = int; Pointer = thrust::device_ptr; Derived = thrust::device_reference]’
/usr/local/cuda/include/thrust/detail/reference.inl:69:14: required from ‘thrust::reference<Element, Pointer, Derived>::derived_type& thrust::reference<Element, Pointer, Derived>::operator=(const value_type&) [with Element = int; Pointer = thrust::device_ptr; Derived = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::derived_type = thrust::device_reference; thrust::reference<Element, Pointer, Derived>::value_type = int]’
/usr/local/cuda/include/thrust/detail/device_reference.inl:44:28: required from ‘thrust::device_reference& thrust::device_reference::operator=(const value_type&) [with T = int; thrust::device_reference::value_type = int]’
/home/amax/HeartNext/include/VectorWrapper.h:76:15: required from ‘void VectorWrapper::assign(int, typename Container::value_type) [with Container = thrust::device_vector; typename Container::value_type = int]’
/home/amax/HeartNext/include/VectorWrapper.h:118:27: required from ‘static void VectorWrapper::export_class(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/include/Lua.hh:204:24: required from ‘void util::Lua::export_class() [with T = VectorWrapper<thrust::device_vector >; P = util::Lua::LuaObject]’
/home/amax/HeartNext/include/VectorWrapper.h:104:3: required from ‘static void VectorWrapper::export_me(util::Lua&) [with Container = thrust::device_vector]’
/home/amax/HeartNext/src/VectorWrapper.cpp:326:16: required from here
/usr/local/cuda/include/thrust/detail/static_assert.h:71:13: error: invalid application of ‘sizeof’ to incomplete type ‘thrust::detail::STATIC_ASSERTION_FAILURE’
sizeof(::thrust::detail::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>
^
/usr/local/cuda/include/thrust/system/detail/generic/for_each.h:49:3: note: in expansion of macro ‘THRUST_STATIC_ASSERT’
THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<InputIterator, false>::value) );
^
CMakeFiles/vector.dir/build.make:93: recipe for target 'CMakeFiles/vector.dir/src/VectorWrapper.cpp.o' failed
make[2]: *** [CMakeFiles/vector.dir/src/VectorWrapper.cpp.o] Error 1
CMakeFiles/Makefile2:107: recipe for target 'CMakeFiles/vector.dir/all' failed
make[1]: *** [CMakeFiles/vector.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

@aspirerabbit
Copy link

CUDA 10.0
HOW TO DEAL WITH THESE ERRORS?

@EmilPi
Copy link

EmilPi commented Feb 20, 2020

Trying to compile https://github.com/che-shr-cat/currennt/ with CUDA 10.0:

git clone https://github.com/che-shr-cat/currennt/
mkdir build && cd build && cmake -DCUDA_cublas_device_LIBRARY=/usr/local/cuda/targets/x86_64-linux/lib/libcublas.so .. && make

yields

...
[ 61%] Building NVCC (Device) object CMakeFiles/currennt.dir/currennt_lib/src/optimizers/currennt_generated_Optimizer.cu.o
Scanning dependencies of target currennt
[ 65%] Building CXX object CMakeFiles/currennt.dir/currennt_lib/src/Configuration.cpp.o
[ 69%] Building CXX object CMakeFiles/currennt.dir/currennt_lib/src/NeuralNetwork.cpp.o
In file included from /usr/local/cuda-10.0/include/thrust/detail/reference.h:173:0,
                 from /usr/local/cuda-10.0/include/thrust/memory.h:25,
                 from /usr/local/cuda-10.0/include/thrust/detail/allocator/temporary_allocator.h:23,
                 from /usr/local/cuda-10.0/include/thrust/detail/temporary_array.h:40,
                 from /usr/local/cuda-10.0/include/thrust/system/cuda/detail/internal/copy_cross_system.h:41,
                 from /usr/local/cuda-10.0/include/thrust/system/cuda/detail/copy.h:99,
                 from /usr/local/cuda-10.0/include/thrust/system/detail/adl/copy.h:42,
                 from /usr/local/cuda-10.0/include/thrust/detail/copy.inl:22,
                 from /usr/local/cuda-10.0/include/thrust/detail/copy.h:90,
                 from /usr/local/cuda-10.0/include/thrust/detail/allocator/copy_construct_range.inl:21,
                 from /usr/local/cuda-10.0/include/thrust/detail/allocator/copy_construct_range.h:46,
                 from /usr/local/cuda-10.0/include/thrust/detail/contiguous_storage.inl:22,
                 from /usr/local/cuda-10.0/include/thrust/detail/contiguous_storage.h:161,
                 from /usr/local/cuda-10.0/include/thrust/detail/vector_base.h:29,
                 from /usr/local/cuda-10.0/include/thrust/host_vector.h:26,
                 from /home/misc/archive/currennt/currennt_lib/src/layers/../Types.hpp:26,
                 from /home/misc/archive/currennt/currennt_lib/src/layers/Layer.hpp:26,
                 from /home/misc/archive/currennt/currennt_lib/src/layers/InputLayer.hpp:26,
                 from /home/misc/archive/currennt/currennt_lib/src/NeuralNetwork.hpp:26,
                 from /home/misc/archive/currennt/currennt_lib/src/NeuralNetwork.cpp:23:
/usr/local/cuda-10.0/include/thrust/detail/reference.inl: In instantiation of ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::strip_const_get_value(const System&) const [with System = thrust::cuda_cub::tag; Element = const char; Pointer = thrust::device_ptr<const char>; Derived = thrust::device_reference<const char>; thrust::reference<Element, Pointer, Derived>::value_type = char]’:
/usr/local/cuda-10.0/include/thrust/detail/reference.inl:105:31:   required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::convert_to_value_type(System*) const [with System = thrust::cuda_cub::tag; Element = const char; Pointer = thrust::device_ptr<const char>; Derived = thrust::device_reference<const char>; thrust::reference<Element, Pointer, Derived>::value_type = char]’
/usr/local/cuda-10.0/include/thrust/detail/reference.inl:122:31:   required from ‘thrust::reference<Element, Pointer, Derived>::operator thrust::reference<Element, Pointer, Derived>::value_type() const [with Element = const char; Pointer = thrust::device_ptr<const char>; Derived = thrust::device_reference<const char>; thrust::reference<Element, Pointer, Derived>::value_type = char]’
/home/misc/archive/currennt/currennt_lib/src/NeuralNetwork.cpp:244:9:   required from ‘std::vector<std::vector<std::vector<float> > > NeuralNetwork<TDevice>::getOutputs() [with TDevice = Gpu]’
/home/misc/archive/currennt/currennt_lib/src/NeuralNetwork.cpp:267:16:   required from here
/usr/local/cuda-10.0/include/thrust/detail/reference.inl:137:73: error: void value not ignored as it ought to be
   return get_value(thrust::detail::derived_cast(non_const_system), m_ptr);
                                                                         ^
In file included from /usr/local/cuda-10.0/include/thrust/system/detail/generic/for_each.h:27:0,
                 from /usr/local/cuda-10.0/include/thrust/detail/for_each.inl:26,
                 from /usr/local/cuda-10.0/include/thrust/for_each.h:279,
                 from /usr/local/cuda-10.0/include/thrust/system/detail/generic/transform.inl:19,
                 from /usr/local/cuda-10.0/include/thrust/system/detail/generic/transform.h:105,
                 from /usr/local/cuda-10.0/include/thrust/detail/transform.inl:25,
                 from /usr/local/cuda-10.0/include/thrust/transform.h:724,
                 from /usr/local/cuda-10.0/include/thrust/system/detail/generic/copy.inl:23,
                 from /usr/local/cuda-10.0/include/thrust/system/detail/generic/copy.h:58,
                 from /usr/local/cuda-10.0/include/thrust/detail/copy.inl:21,
                 from /usr/local/cuda-10.0/include/thrust/detail/copy.h:90,
                 from /usr/local/cuda-10.0/include/thrust/detail/allocator/copy_construct_range.inl:21,
                 from /usr/local/cuda-10.0/include/thrust/detail/allocator/copy_construct_range.h:46,
                 from /usr/local/cuda-10.0/include/thrust/detail/contiguous_storage.inl:22,
                 from /usr/local/cuda-10.0/include/thrust/detail/contiguous_storage.h:161,
                 from /usr/local/cuda-10.0/include/thrust/detail/vector_base.h:29,
                 from /usr/local/cuda-10.0/include/thrust/host_vector.h:26,
                 from /home/misc/archive/currennt/currennt_lib/src/layers/../Types.hpp:26,
                 from /home/misc/archive/currennt/currennt_lib/src/layers/Layer.hpp:26,
                 from /home/misc/archive/currennt/currennt_lib/src/layers/InputLayer.hpp:26,
                 from /home/misc/archive/currennt/currennt_lib/src/NeuralNetwork.hpp:26,
                 from /home/misc/archive/currennt/currennt_lib/src/NeuralNetwork.cpp:23:
/usr/local/cuda-10.0/include/thrust/system/detail/generic/for_each.h: In instantiation of ‘void thrust::system::detail::generic::get_value(thrust::execution_policy<Derived>&, Pointer) [with DerivedPolicy = thrust::cuda_cub::tag; Pointer = thrust::device_ptr<const char>]’:
/usr/local/cuda-10.0/include/thrust/detail/reference.inl:137:19:   required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::strip_const_get_value(const System&) const [with System = thrust::cuda_cub::tag; Element = const char; Pointer = thrust::device_ptr<const char>; Derived = thrust::device_reference<const char>; thrust::reference<Element, Pointer, Derived>::value_type = char]’
/usr/local/cuda-10.0/include/thrust/detail/reference.inl:105:31:   required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::convert_to_value_type(System*) const [with System = thrust::cuda_cub::tag; Element = const char; Pointer = thrust::device_ptr<const char>; Derived = thrust::device_reference<const char>; thrust::reference<Element, Pointer, Derived>::value_type = char]’
/usr/local/cuda-10.0/include/thrust/detail/reference.inl:122:31:   required from ‘thrust::reference<Element, Pointer, Derived>::operator thrust::reference<Element, Pointer, Derived>::value_type() const [with Element = const char; Pointer = thrust::device_ptr<const char>; Derived = thrust::device_reference<const char>; thrust::reference<Element, Pointer, Derived>::value_type = char]’
/home/misc/archive/currennt/currennt_lib/src/NeuralNetwork.cpp:244:9:   required from ‘std::vector<std::vector<std::vector<float> > > NeuralNetwork<TDevice>::getOutputs() [with TDevice = Gpu]’
/home/misc/archive/currennt/currennt_lib/src/NeuralNetwork.cpp:267:16:   required from here
/usr/local/cuda-10.0/include/thrust/detail/static_assert.h:71:13: error: invalid application of ‘sizeof’ to incomplete type ‘thrust::detail::STATIC_ASSERTION_FAILURE<false>’
       sizeof(::thrust::detail::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\
             ^
/usr/local/cuda-10.0/include/thrust/system/detail/generic/for_each.h:49:3: note: in expansion of macro ‘THRUST_STATIC_ASSERT’
   THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<InputIterator, false>::value) );
   ^~~~~~~~~~~~~~~~~~~~
CMakeFiles/currennt.dir/build.make:198: recipe for target 'CMakeFiles/currennt.dir/currennt_lib/src/NeuralNetwork.cpp.o' failed
make[2]: *** [CMakeFiles/currennt.dir/currennt_lib/src/NeuralNetwork.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/currennt.dir/all' failed
make[1]: *** [CMakeFiles/currennt.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

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

No branches or pull requests

4 participants