Consider the following example:
#include <iostream>
#include <ATen/cpu/vec256/vec256.h>
int main(void) {
std::cout << "Hello World" << std::endl;
}
First of all, this program couldn't be compiled without linking to c10:
$ g++ -Iaten/src/ -I. -Ibuild -Ibuild/aten/src vec256_test.cpp
/usr/bin/ld: /tmp/cc0F69nh.o: in function `c10::UndefinedTensorImpl::singleton()':
vec256_test.cpp:(.text._ZN3c1019UndefinedTensorImpl9singletonEv[_ZN3c1019UndefinedTensorImpl9singletonEv]+0x5): undefined reference to `c10::UndefinedTensorImpl::_singleton'
/usr/bin/ld: /tmp/cc0F69nh.o: in function `c10::IValue::toDouble() const':
vec256_test.cpp:(.text._ZNK3c106IValue8toDoubleEv[_ZNK3c106IValue8toDoubleEv]+0x85): undefined reference to `c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: /tmp/cc0F69nh.o: in function `c10::IValue::toInt() const':
vec256_test.cpp:(.text._ZNK3c106IValue5toIntEv[_ZNK3c106IValue5toIntEv]+0x85): undefined reference to `c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: /tmp/cc0F69nh.o: in function `c10::IValue::toTensor() const &':
vec256_test.cpp:(.text._ZNKR3c106IValue8toTensorEv[_ZNKR3c106IValue8toTensorEv]+0xbf): undefined reference to `c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: /tmp/cc0F69nh.o: in function `c10::intrusive_ptr<c10::TensorImpl, c10::UndefinedTensorImpl>::retain_()':
vec256_test.cpp:(.text._ZN3c1013intrusive_ptrINS_10TensorImplENS_19UndefinedTensorImplEE7retain_Ev[_ZN3c1013intrusive_ptrINS_10TensorImplENS_19UndefinedTensorImplEE7retain_Ev]+0xb6): undefined reference to `c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status
And when linked with c10 produces a 182Kb executable, compared to 24Kb executable without #include <vec256.h>
Consider the following example:
First of all, this program couldn't be compiled without linking to c10:
And when linked with c10 produces a 182Kb executable, compared to 24Kb executable without
#include <vec256.h>