I am using lockfree queue from boost:
#include <boost/lockfree/queue.hpp> #include <boost/atomic.hpp> boost::lockfree::queue<int> queue(10000);
Works fine with GCC compiler, but not with Intel. I get the following error:
In file included from /usr/include/boost/lockfree/queue.hpp(24),
from /home/martin/projects/EGO/BLAS-join3/cmake/main.cpp(5):
/opt/gcc6.1.0/usr/local/bin/../include/c++/6.1.0/atomic(178): error: static assertion failed with "std::atomic requires a trivially copyable type"
static_assert(__is_trivially_copyable(_Tp),
^
detected during instantiation of class "std::atomic<_Tp> [with _Tp=boost::lockfree::detail::tagged_index]" at line 584 of "/usr/include/boost/lockfree/detail/freelist.hpp"
/opt/gcc6.1.0/usr/local/bin/../include/c++/6.1.0/atomic(178): error: static assertion failed with "std::atomic requires a trivially copyable type"
static_assert(__is_trivially_copyable(_Tp),
^
detected during:
instantiation of class "std::atomic<_Tp> [with _Tp=boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::freelist_stack<boost::lockfree::queue<int, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node, std::allocator<boost::lockfree::queue<int, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node>>::freelist_node>]" at line 244 of "/usr/include/boost/lockfree/detail/freelist.hpp"
instantiation of class "boost::lockfree::detail::freelist_stack<T, Alloc> [with T=boost::lockfree::queue<int, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node, Alloc=std::allocator<boost::lockfree::queue<int, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node>]" at line 121 of "/usr/include/boost/lockfree/queue.hpp"
instantiation of class "boost::lockfree::queue<T, A0, A1, A2> [with T=int, A0=boost::parameter::void_, A1=boost::parameter::void_, A2=boost::parameter::void_]" at line 38 of "/home/martin/projects/EGO/BLAS-join3/cmake/main.cpp"
/opt/gcc6.1.0/usr/local/bin/../include/c++/6.1.0/atomic(178): error: static assertion failed with "std::atomic requires a trivially copyable type"
static_assert(__is_trivially_copyable(_Tp),
^
detected during:
instantiation of class "std::atomic<_Tp> [with _Tp=boost::lockfree::detail::tagged_ptr<boost::lockfree::queue<int, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node>]" at line 463 of "/usr/include/boost/lockfree/queue.hpp"
instantiation of class "boost::lockfree::queue<T, A0, A1, A2> [with T=int, A0=boost::parameter::void_, A1=boost::parameter::void_, A2=boost::parameter::void_]" at line 38 of "/home/martin/projects/EGO/BLAS-join3/cmake/main.cpp"
compilation aborted for /home/martin/projects/EGO/BLAS-join3/cmake/main.cpp (code 2)
make[2]: *** [CMakeFiles/blasJoin.dir/main.cpp.o] Fehler 2
make[1]: *** [CMakeFiles/blasJoin.dir/all] Fehler 2
make: *** [all] Fehler 2I am using the following flags in CMAKE:
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=knl -mtune=knl -fpic -ffast-math -DNDEBUG -O3 -DNDDEBUG -fopenmp -lmkl_core -lmkl_intel_lp64 -lmkl_intel_thread -liomp5 -lboost_system")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xmic-avx512 -qopenmp -DNDEBUG -O3 -lmkl_intel_thread -liomp5 -lpthread -lmkl_core -lmkl_intel_lp64 -lboost_system")
endif()OS: centos-release-7-4.1708.el7.centos.x86_64
Intel Compiler 18.0.2 20180210
GCC version: 6.1.0
Boost version: 1.66