diff --git a/tests/cast.cpp b/tests/cast.cpp index 00daa4622..5eca5ff85 100644 --- a/tests/cast.cpp +++ b/tests/cast.cpp @@ -22,7 +22,7 @@ BOOST_AUTO_TEST_CASE(convert_functions) vex::vector x(ctx, N); - cl_float2 y = {{4.2, 8.4}}; + cl_float2 y = {{4.2f, 8.4f}}; x = vex::convert_int2(y); diff --git a/tests/reduce_by_key.cpp b/tests/reduce_by_key.cpp index a779427b3..7fc3015c6 100644 --- a/tests/reduce_by_key.cpp +++ b/tests/reduce_by_key.cpp @@ -1,5 +1,6 @@ #define BOOST_TEST_MODULE ReduceByKey #include +#include #include #include #include @@ -57,6 +58,7 @@ struct comp { } }; +#ifndef _MSC_VER // Damn you Visual Studio! BOOST_AUTO_TEST_CASE(rbk_tuple) { const int n = 1000 * 1000; @@ -102,8 +104,8 @@ BOOST_AUTO_TEST_CASE(rbk_tuple) ); int num_keys = vex::reduce_by_key( - std::tie(ikey1, ikey2), ivals, - std::tie(okey1, okey2), ovals, + boost::fusion::vector_tie(ikey1, ikey2), ivals, + boost::fusion::vector_tie(okey1, okey2), ovals, equal, plus ); @@ -134,5 +136,6 @@ BOOST_AUTO_TEST_CASE(rbk_tuple) BOOST_CHECK_CLOSE(dev_sum, host_sum, 1e-8); }); } +#endif BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/scan.cpp b/tests/scan.cpp index 18ff5b19f..80f3b19c2 100644 --- a/tests/scan.cpp +++ b/tests/scan.cpp @@ -1,5 +1,6 @@ #define BOOST_TEST_MODULE Scan #include +#include #include #include #include diff --git a/tests/sort.cpp b/tests/sort.cpp index 23473c6f7..8aba8ab17 100644 --- a/tests/sort.cpp +++ b/tests/sort.cpp @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(sort_keys_vals) BOOST_CHECK( std::is_sorted(k.begin(), k.end()) ); - struct { + struct even_first_t { typedef bool result_type; VEX_FUNCTION(device, bool(int, int), @@ -48,6 +48,8 @@ BOOST_AUTO_TEST_CASE(sort_keys_vals) if (bit1 == bit2) return a < b; return bit1 < bit2; } + + even_first_t() {} } even_first; vex::sort_by_key(keys, vals, even_first); @@ -56,6 +58,7 @@ BOOST_AUTO_TEST_CASE(sort_keys_vals) BOOST_CHECK(std::is_sorted(k.begin(), k.end(), even_first)); } +#ifndef _MSC_VER BOOST_AUTO_TEST_CASE(sort_keys_tuple) { const size_t n = 1000 * 1000; @@ -66,7 +69,7 @@ BOOST_AUTO_TEST_CASE(sort_keys_tuple) vex::vector keys1(ctx, k1); vex::vector keys2(ctx, k2); - struct { + struct less_t { typedef bool result_type; VEX_FUNCTION(device, bool(int, float, int, float), @@ -76,9 +79,11 @@ BOOST_AUTO_TEST_CASE(sort_keys_tuple) result_type operator()(int a1, float a2, int b1, float b2) const { return (a1 == b1) ? (a2 < b2) : (a1 < b1); } + + less_t() {} } less; - vex::sort(std::tie(keys1, keys2), less ); + vex::sort(boost::fusion::vector_tie(keys1, keys2), less ); vex::copy(keys1, k1); vex::copy(keys2, k2); @@ -104,7 +109,7 @@ BOOST_AUTO_TEST_CASE(sort_keys_vals_tuple) vex::vector vals1(ctx, v1); vex::vector vals2(ctx, v2); - struct { + struct less_t { typedef bool result_type; VEX_FUNCTION(device, bool(int, float, int, float), @@ -114,9 +119,11 @@ BOOST_AUTO_TEST_CASE(sort_keys_vals_tuple) result_type operator()(int a1, float a2, int b1, float b2) const { return (a1 == b1) ? (a2 < b2) : (a1 < b1); } + + less_t() {} } less; - vex::sort_by_key(std::tie(keys1, keys2), std::tie(vals1, vals2), less ); + vex::sort_by_key(boost::fusion::vector_tie(keys1, keys2), boost::fusion::vector_tie(vals1, vals2), less ); vex::copy(keys1, k1); vex::copy(keys2, k2); @@ -128,6 +135,6 @@ BOOST_AUTO_TEST_CASE(sort_keys_vals_tuple) return std::make_tuple(k1[i], k2[i]) < std::make_tuple(k1[j], k2[j]); } ) ); } - +#endif BOOST_AUTO_TEST_SUITE_END() diff --git a/vexcl/detail/fusion.hpp b/vexcl/detail/fusion.hpp index 53d76adaf..4fdcd2a61 100644 --- a/vexcl/detail/fusion.hpp +++ b/vexcl/detail/fusion.hpp @@ -21,7 +21,10 @@ #include #include #include -#include +#include +#ifndef BOOST_NO_VARIADIC_TEMPLATES +# include +#endif namespace vex { diff --git a/vexcl/reductor.hpp b/vexcl/reductor.hpp index c76e922ee..4a490f798 100644 --- a/vexcl/reductor.hpp +++ b/vexcl/reductor.hpp @@ -80,10 +80,17 @@ struct SUM { struct MAX { template static T initial() { +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable: 4146) +#endif if (std::is_unsigned::value) return static_cast(0); else return -std::numeric_limits::max(); +#ifdef _MSC_VER +# pragma warning(pop) +#endif } template diff --git a/vexcl/scan.hpp b/vexcl/scan.hpp index d8424c658..8d6362ca5 100644 --- a/vexcl/scan.hpp +++ b/vexcl/scan.hpp @@ -424,6 +424,8 @@ void scan( template struct plus : std::plus { VEX_FUNCTION(device, T(T, T), "return prm1 + prm2;"); + + plus() {} }; /// Inclusive scan. diff --git a/vexcl/sort.hpp b/vexcl/sort.hpp index 1a8d3a3f2..290ec2433 100644 --- a/vexcl/sort.hpp +++ b/vexcl/sort.hpp @@ -2212,6 +2212,8 @@ void sort_by_key_sink(K &&keys, V &&vals, Comp comp) { template struct less : std::less { VEX_FUNCTION(device, bool(T, T), "return prm1 < prm2;"); + + less() {} }; /// Function object class for less-than-or-equal inequality comparison. @@ -2223,6 +2225,8 @@ struct less : std::less { template struct less_equal : std::less_equal { VEX_FUNCTION(device, bool(T, T), "return prm1 <= prm2;"); + + less_equal() {} }; /// Function object class for greater-than inequality comparison. @@ -2234,6 +2238,8 @@ struct less_equal : std::less_equal { template struct greater : std::greater { VEX_FUNCTION(device, bool(T, T), "return prm1 > prm2;"); + + greater() {} }; /// Function object class for greater-than-or-equal inequality comparison. @@ -2245,6 +2251,8 @@ struct greater : std::greater { template struct greater_equal : std::greater_equal { VEX_FUNCTION(device, bool(T, T), "return prm1 >= prm2;"); + + greater_equal() {} }; /// Sorts the vector into ascending order. diff --git a/vexcl/spmat.hpp b/vexcl/spmat.hpp index 76889efca..8240bef75 100644 --- a/vexcl/spmat.hpp +++ b/vexcl/spmat.hpp @@ -99,7 +99,7 @@ class SpMat { mtx[d].reset( new SpMatCSR(queue[d], row + part[d], row + part[d+1], col, val, - col_part[d], col_part[d+1], ghost_cols[d]) + static_cast(col_part[d]), static_cast(col_part[d+1]), ghost_cols[d]) ); else mtx[d].reset( diff --git a/vexcl/stencil.hpp b/vexcl/stencil.hpp index 11c211a6b..4c294b563 100644 --- a/vexcl/stencil.hpp +++ b/vexcl/stencil.hpp @@ -435,7 +435,7 @@ void stencil::apply(const vex::vector &x, vex::vector &y, { Base::exchange_halos(x); - T beta = append ? 1 : 0; + T beta = static_cast(append ? 1 : 0); for(unsigned d = 0; d < queue.size(); d++) { if (size_t psize = x.part_size(d)) {