From bad3d5aec3996be0e6a936dc4bc793b42b6fee86 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 25 Apr 2018 14:20:06 +0300 Subject: [PATCH 01/13] Evaluate mp_bind_front, mp_bind_back inside mp_bind --- include/boost/mp11/bind.hpp | 50 ++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/include/boost/mp11/bind.hpp b/include/boost/mp11/bind.hpp index ac257d4..fa52d2d 100644 --- a/include/boost/mp11/bind.hpp +++ b/include/boost/mp11/bind.hpp @@ -1,7 +1,7 @@ #ifndef BOOST_MP11_BIND_HPP_INCLUDED #define BOOST_MP11_BIND_HPP_INCLUDED -// Copyright 2017 Peter Dimov. +// Copyright 2017, 2018 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // @@ -17,6 +17,25 @@ namespace boost namespace mp11 { +// mp_bind_front +template class F, class... T> struct mp_bind_front +{ + // the indirection through mp_defer works around the language inability + // to expand U... into a fixed parameter list of an alias template + + template using fn = typename mp_defer::type; +}; + +template using mp_bind_front_q = mp_bind_front; + +// mp_bind_back +template class F, class... T> struct mp_bind_back +{ + template using fn = typename mp_defer::type; +}; + +template using mp_bind_back_q = mp_bind_back; + // mp_arg template struct mp_arg { @@ -54,6 +73,16 @@ template class F, class... U, class... T> struct eval_bound_a using type = typename mp_bind::template fn; }; +template class F, class... U, class... T> struct eval_bound_arg, T...> +{ + using type = typename mp_bind_front::template fn; +}; + +template class F, class... U, class... T> struct eval_bound_arg, T...> +{ + using type = typename mp_bind_back::template fn; +}; + } // namespace detail template class F, class... T> struct mp_bind @@ -63,25 +92,6 @@ template class F, class... T> struct mp_bind template using mp_bind_q = mp_bind; -// mp_bind_front -template class F, class... T> struct mp_bind_front -{ - // the indirection through mp_defer works around the language inability - // to expand U... into a fixed parameter list of an alias template - - template using fn = typename mp_defer::type; -}; - -template using mp_bind_front_q = mp_bind_front; - -// mp_bind_back -template class F, class... T> struct mp_bind_back -{ - template using fn = typename mp_defer::type; -}; - -template using mp_bind_back_q = mp_bind_back; - } // namespace mp11 } // namespace boost From 861e8827d0742f5a6904c7ad39d39624ed950546 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 25 Apr 2018 14:23:16 +0300 Subject: [PATCH 02/13] Add clang -x cuda to Travis --- .travis.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2afb22e..6702384 100644 --- a/.travis.yml +++ b/.travis.yml @@ -185,6 +185,17 @@ matrix: packages: - libc++-dev + - os: linux + compiler: clang++-5.0 + env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=11,14,1z CXXFLAGS="-x cuda -nocudainc -nocudalib" + addons: + apt: + packages: + - clang-5.0 + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-trusty-5.0 + - os: osx compiler: clang++ env: TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1z @@ -206,7 +217,7 @@ install: script: - |- echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam - - ./b2 -j3 libs/mp11/test toolset=$TOOLSET cxxstd=$CXXSTD + - ./b2 -j3 libs/mp11/test toolset=$TOOLSET cxxstd=$CXXSTD cxxflags=$CXXFLAGS notifications: email: From aa33b6426c234f1ec1916b478b4594731dd56137 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 25 Apr 2018 15:51:39 +0300 Subject: [PATCH 03/13] Update g++ 7.2 workaround to 7.3 --- include/boost/mp11/function.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/mp11/function.hpp b/include/boost/mp11/function.hpp index 596f063..defb6d2 100644 --- a/include/boost/mp11/function.hpp +++ b/include/boost/mp11/function.hpp @@ -79,7 +79,7 @@ template using mp_and = typename detail::mp_and_impl>: #endif // mp_all -#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) || BOOST_WORKAROUND( BOOST_GCC, < 70300 ) +#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) || BOOST_WORKAROUND( BOOST_GCC, < 70400 ) template using mp_all = mp_bool< mp_count_if< mp_list, mp_not >::value == 0 >; From 42f4f0b8f03074aee5fed5c2b8b2c6c20e4bf8cd Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 25 Apr 2018 16:14:12 +0300 Subject: [PATCH 04/13] Fix CXXFLAGS handling --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6702384..8c79527 100644 --- a/.travis.yml +++ b/.travis.yml @@ -217,7 +217,7 @@ install: script: - |- echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam - - ./b2 -j3 libs/mp11/test toolset=$TOOLSET cxxstd=$CXXSTD cxxflags=$CXXFLAGS + - ./b2 -j3 libs/mp11/test toolset=$TOOLSET cxxstd=$CXXSTD ${CXXFLAGS:+cxxflags="$CXXFLAGS"} notifications: email: From 88485f900a15ce5aff38013b8a2616d21f0a8771 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 25 Apr 2018 19:15:18 +0300 Subject: [PATCH 05/13] Bump another g++ 7.2 workaround to 7.3 --- include/boost/mp11/function.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/mp11/function.hpp b/include/boost/mp11/function.hpp index defb6d2..2de5ce8 100644 --- a/include/boost/mp11/function.hpp +++ b/include/boost/mp11/function.hpp @@ -124,7 +124,7 @@ template struct mp_or_impl } // namespace detail // mp_any -#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_WORKAROUND( BOOST_GCC, < 70300 ) +#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_WORKAROUND( BOOST_GCC, < 70400 ) template using mp_any = mp_bool<(static_cast(T::value) || ...)>; From c24fe1750c1629ac81f2b1bfdbd3f67a9ccd4c45 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 5 Apr 2018 18:55:25 +0200 Subject: [PATCH 06/13] Clang -x cuda: >>> mixmatch --- include/boost/mp11/algorithm.hpp | 8 ++++---- include/boost/mp11/detail/mp_append.hpp | 2 +- include/boost/mp11/integer_sequence.hpp | 2 +- include/boost/mp11/map.hpp | 2 +- include/boost/mp11/set.hpp | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/boost/mp11/algorithm.hpp b/include/boost/mp11/algorithm.hpp index 23758f7..72b19cc 100644 --- a/include/boost/mp11/algorithm.hpp +++ b/include/boost/mp11/algorithm.hpp @@ -297,8 +297,8 @@ template class L, class... T, std::size_t I> struct mp_at_c_i template struct mp_at_c_impl { - using _map = mp_transform>, L>; - using type = mp_second>>; + using _map = mp_transform >, L>; + using type = mp_second > >; }; #endif @@ -843,7 +843,7 @@ template class L, class T1, class... T, class V, template class L, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10, class... T, class V, template class F> struct mp_reverse_fold_impl, V, F> { using rest = typename mp_reverse_fold_impl, V, F>::type; - using type = F>>>>>>>>>; + using type = F > > > > > > > > >; }; } // namespace detail @@ -889,7 +889,7 @@ template struct mp_replace_at_impl template using _p = std::is_same>; template using _f = W; - using type = mp_transform_if<_p, _f, L, mp_iota>>; + using type = mp_transform_if<_p, _f, L, mp_iota > >; }; } // namespace detail diff --git a/include/boost/mp11/detail/mp_append.hpp b/include/boost/mp11/detail/mp_append.hpp index e58c8a7..6f39bab 100644 --- a/include/boost/mp11/detail/mp_append.hpp +++ b/include/boost/mp11/detail/mp_append.hpp @@ -133,7 +133,7 @@ template< using type = typename mp_append_impl::type; }; -template struct mp_append_impl: mp_if_c<(sizeof...(L) > 111), mp_quote, mp_if_c<(sizeof...(L) > 11), mp_quote, mp_quote>>::template fn +template struct mp_append_impl: mp_if_c<(sizeof...(L) > 111), mp_quote, mp_if_c<(sizeof...(L) > 11), mp_quote, mp_quote > >::template fn { }; diff --git a/include/boost/mp11/integer_sequence.hpp b/include/boost/mp11/integer_sequence.hpp index 08e3120..ad72bd0 100644 --- a/include/boost/mp11/integer_sequence.hpp +++ b/include/boost/mp11/integer_sequence.hpp @@ -73,7 +73,7 @@ public: using type = S4; }; -template struct make_integer_sequence_impl: iseq_if_c>, iseq_if_c>, make_integer_sequence_impl_>> +template struct make_integer_sequence_impl: iseq_if_c>, iseq_if_c>, make_integer_sequence_impl_ > > { }; diff --git a/include/boost/mp11/map.hpp b/include/boost/mp11/map.hpp index 0f7a19c..b9581ac 100644 --- a/include/boost/mp11/map.hpp +++ b/include/boost/mp11/map.hpp @@ -58,7 +58,7 @@ template class F> struct mp_map_update_impl template using _f = std::is_same, mp_first>; // _f3> -> L> - template using _f3 = mp_assign, mp_rename>>; + template using _f3 = mp_assign, mp_rename > >; using type = mp_if< mp_map_contains>, mp_transform_if<_f, _f3, M>, mp_push_back >; }; diff --git a/include/boost/mp11/set.hpp b/include/boost/mp11/set.hpp index cd77d64..fe9c1b2 100644 --- a/include/boost/mp11/set.hpp +++ b/include/boost/mp11/set.hpp @@ -25,7 +25,7 @@ template struct mp_set_contains_impl; template class L, class... T, class V> struct mp_set_contains_impl, V> { - using type = mp_to_bool, mp_inherit...>>>; + using type = mp_to_bool, mp_inherit...> > >; }; } // namespace detail @@ -90,7 +90,7 @@ template struct mp_is_set_impl template class L, class... T> struct mp_is_set_impl> { - using type = mp_to_bool, mp_set_push_back, T...>>>; + using type = mp_to_bool, mp_set_push_back, T...> > >; }; } // namespace detail From cc8a99e2d81dce4d37585ea01e547507eb7f59b7 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 26 Apr 2018 13:23:06 +0300 Subject: [PATCH 07/13] Try to test clang -x cuda without b2 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8c79527..56be84c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -186,8 +186,6 @@ matrix: - libc++-dev - os: linux - compiler: clang++-5.0 - env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=11,14,1z CXXFLAGS="-x cuda -nocudainc -nocudalib" addons: apt: packages: @@ -195,6 +193,8 @@ matrix: sources: - ubuntu-toolchain-r-test - llvm-toolchain-trusty-5.0 + script: + - clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib -std=c++11 libs/mp11/test/mp11.cpp - os: osx compiler: clang++ From be199cd94329701fc81c745c19329cc35c00fdae Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 26 Apr 2018 14:17:19 +0300 Subject: [PATCH 08/13] Add --cuda-gpu-arch, restore compiler: and env: --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 56be84c..eb4b833 100644 --- a/.travis.yml +++ b/.travis.yml @@ -186,6 +186,8 @@ matrix: - libc++-dev - os: linux + compiler: clang++-5.0 + env: CLANG_X_CUDA=1 addons: apt: packages: @@ -194,7 +196,7 @@ matrix: - ubuntu-toolchain-r-test - llvm-toolchain-trusty-5.0 script: - - clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib -std=c++11 libs/mp11/test/mp11.cpp + - clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib --cuda-gpu-arch=sm_30 -std=c++11 libs/mp11/test/mp11.cpp - os: osx compiler: clang++ From dec6df008cfd495c6d979ccc9e0f3e58514aca97 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 26 Apr 2018 15:20:30 +0300 Subject: [PATCH 09/13] Add -D__device__=__attribute__((device)) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eb4b833..5bc42d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -196,7 +196,7 @@ matrix: - ubuntu-toolchain-r-test - llvm-toolchain-trusty-5.0 script: - - clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib --cuda-gpu-arch=sm_30 -std=c++11 libs/mp11/test/mp11.cpp + - clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib --cuda-gpu-arch=sm_30 -D__device__="__attribute__((device))" -std=c++11 libs/mp11/test/mp11.cpp - os: osx compiler: clang++ From eca4336ed70fa21bd1eeeef2db7ac9896f13adc6 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 26 Apr 2018 15:51:45 +0300 Subject: [PATCH 10/13] Install nvidia-cuda-toolkit --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 5bc42d4..c5d6349 100644 --- a/.travis.yml +++ b/.travis.yml @@ -192,6 +192,7 @@ matrix: apt: packages: - clang-5.0 + - nvidia-cuda-toolkit sources: - ubuntu-toolchain-r-test - llvm-toolchain-trusty-5.0 From 7be33d3f42472c1dda8fab93cdcc6e1ee33b1121 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 26 Apr 2018 16:24:20 +0300 Subject: [PATCH 11/13] Install dependencies nvidia-profiler, nvidia-cuda-dev as well --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index c5d6349..66edaae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -192,6 +192,8 @@ matrix: apt: packages: - clang-5.0 + - nvidia-profiler + - nvidia-cuda-dev - nvidia-cuda-toolkit sources: - ubuntu-toolchain-r-test From e41c8a8e2005b4904f53922ba8c346e87652e232 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 26 Apr 2018 17:34:16 +0300 Subject: [PATCH 12/13] Remove -nocudainc -nocudalib --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 66edaae..5f86621 100644 --- a/.travis.yml +++ b/.travis.yml @@ -199,7 +199,7 @@ matrix: - ubuntu-toolchain-r-test - llvm-toolchain-trusty-5.0 script: - - clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib --cuda-gpu-arch=sm_30 -D__device__="__attribute__((device))" -std=c++11 libs/mp11/test/mp11.cpp + - clang++-5.0 -I . -c -x cuda --cuda-gpu-arch=sm_30 -std=c++11 libs/mp11/test/mp11.cpp - os: osx compiler: clang++ From 6f679aba513d5ab6a125303bdf9b649e9ffa5947 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 26 Apr 2018 20:05:19 +0300 Subject: [PATCH 13/13] Revert removal of -nocudainc and -nocudalib; add c++14 and c++1z --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5f86621..d42c367 100644 --- a/.travis.yml +++ b/.travis.yml @@ -199,7 +199,9 @@ matrix: - ubuntu-toolchain-r-test - llvm-toolchain-trusty-5.0 script: - - clang++-5.0 -I . -c -x cuda --cuda-gpu-arch=sm_30 -std=c++11 libs/mp11/test/mp11.cpp + - clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib --cuda-gpu-arch=sm_30 -D__device__="__attribute__((device))" -std=c++11 libs/mp11/test/mp11.cpp + - clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib --cuda-gpu-arch=sm_30 -D__device__="__attribute__((device))" -std=c++14 libs/mp11/test/mp11.cpp + - clang++-5.0 -I . -c -x cuda -nocudainc -nocudalib --cuda-gpu-arch=sm_30 -D__device__="__attribute__((device))" -std=c++1z libs/mp11/test/mp11.cpp - os: osx compiler: clang++