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

Commit

Permalink
WIP, dropping more suppressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
alliepiper committed Dec 15, 2020
1 parent a6cd872 commit ef350b0
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 67 deletions.
12 changes: 6 additions & 6 deletions cmake/ThrustBuildCompilerTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function(thrust_build_compiler_targets)
if (THRUST_TBB_FOUND)
# There's a ton of these in the TBB backend, even though the code is correct.
# TODO: silence these warnings in code instead
append_option_if_available("-Wno-unused-parameter" cxx_compile_options)
# append_option_if_available("-Wno-unused-parameter" cxx_compile_options)
endif()

if ("MSVC" STREQUAL "${CMAKE_CXX_COMPILER_ID}")
Expand Down Expand Up @@ -61,15 +61,15 @@ function(thrust_build_compiler_targets)

# Disabled loss-of-data conversion warnings.
# TODO Re-enable.
append_option_if_available("/wd4244" cxx_compile_options)
append_option_if_available("/wd4267" cxx_compile_options)
# append_option_if_available("/wd4244" cxx_compile_options)
# append_option_if_available("/wd4267" cxx_compile_options)

# Suppress numeric conversion-to-bool warnings.
# TODO Re-enable.
append_option_if_available("/wd4800" cxx_compile_options)
# append_option_if_available("/wd4800" cxx_compile_options)

# Disable warning about applying unary operator- to unsigned type.
append_option_if_available("/wd4146" cxx_compile_options)
# append_option_if_available("/wd4146" cxx_compile_options)

# MSVC STL assumes that `allocator_traits`'s allocator will use raw pointers,
# and the `__DECLSPEC_ALLOCATOR` macro causes issues with thrust's universal
Expand Down Expand Up @@ -122,7 +122,7 @@ function(thrust_build_compiler_targets)
# xlC and Clang warn about unused parameters in uninstantiated templates.
# This causes xlC to choke on the OMP backend, which is mostly #ifdef'd out
# (and thus has unused parameters) when you aren't using it.
append_option_if_available("-Wno-unused-parameters" cxx_compile_options)
# append_option_if_available("-Wno-unused-parameters" cxx_compile_options)
endif()

if ("Feta" STREQUAL "${CMAKE_CUDA_COMPILER_ID}")
Expand Down
102 changes: 51 additions & 51 deletions testing/binary_search_descending.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ void TestScalarLowerBoundDescendingSimple(void)
vec[3] = 2;
vec[4] = 0;

ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::lower_bound(vec.begin(), vec.end(), 0, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::lower_bound(vec.begin(), vec.end(), 1, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::lower_bound(vec.begin(), vec.end(), 2, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::lower_bound(vec.begin(), vec.end(), 3, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::lower_bound(vec.begin(), vec.end(), 4, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::lower_bound(vec.begin(), vec.end(), 5, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::lower_bound(vec.begin(), vec.end(), 6, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 1, thrust::lower_bound(vec.begin(), vec.end(), 7, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::lower_bound(vec.begin(), vec.end(), 8, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::lower_bound(vec.begin(), vec.end(), 9, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::lower_bound(vec.begin(), vec.end(), T{0}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::lower_bound(vec.begin(), vec.end(), T{1}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::lower_bound(vec.begin(), vec.end(), T{2}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::lower_bound(vec.begin(), vec.end(), T{3}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::lower_bound(vec.begin(), vec.end(), T{4}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::lower_bound(vec.begin(), vec.end(), T{5}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::lower_bound(vec.begin(), vec.end(), T{6}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 1, thrust::lower_bound(vec.begin(), vec.end(), T{7}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::lower_bound(vec.begin(), vec.end(), T{8}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::lower_bound(vec.begin(), vec.end(), T{9}, thrust::greater<T>()));
}
DECLARE_VECTOR_UNITTEST(TestScalarLowerBoundDescendingSimple);

Expand All @@ -49,16 +49,16 @@ void TestScalarUpperBoundDescendingSimple(void)
vec[3] = 2;
vec[4] = 0;

ASSERT_EQUAL_QUIET(vec.begin() + 5, thrust::upper_bound(vec.begin(), vec.end(), 0, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::upper_bound(vec.begin(), vec.end(), 1, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::upper_bound(vec.begin(), vec.end(), 2, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::upper_bound(vec.begin(), vec.end(), 3, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::upper_bound(vec.begin(), vec.end(), 4, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::upper_bound(vec.begin(), vec.end(), 5, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::upper_bound(vec.begin(), vec.end(), 6, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::upper_bound(vec.begin(), vec.end(), 7, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 1, thrust::upper_bound(vec.begin(), vec.end(), 8, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::upper_bound(vec.begin(), vec.end(), 9, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 5, thrust::upper_bound(vec.begin(), vec.end(), T{0}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::upper_bound(vec.begin(), vec.end(), T{1}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::upper_bound(vec.begin(), vec.end(), T{2}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::upper_bound(vec.begin(), vec.end(), T{3}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::upper_bound(vec.begin(), vec.end(), T{4}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::upper_bound(vec.begin(), vec.end(), T{5}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::upper_bound(vec.begin(), vec.end(), T{6}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::upper_bound(vec.begin(), vec.end(), T{7}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 1, thrust::upper_bound(vec.begin(), vec.end(), T{8}, thrust::greater<T>()));
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::upper_bound(vec.begin(), vec.end(), T{9}, thrust::greater<T>()));
}
DECLARE_VECTOR_UNITTEST(TestScalarUpperBoundDescendingSimple);

Expand All @@ -76,16 +76,16 @@ void TestScalarBinarySearchDescendingSimple(void)
vec[3] = 2;
vec[4] = 0;

ASSERT_EQUAL(true, thrust::binary_search(vec.begin(), vec.end(), 0, thrust::greater<T>()));
ASSERT_EQUAL(false, thrust::binary_search(vec.begin(), vec.end(), 1, thrust::greater<T>()));
ASSERT_EQUAL(true, thrust::binary_search(vec.begin(), vec.end(), 2, thrust::greater<T>()));
ASSERT_EQUAL(false, thrust::binary_search(vec.begin(), vec.end(), 3, thrust::greater<T>()));
ASSERT_EQUAL(false, thrust::binary_search(vec.begin(), vec.end(), 4, thrust::greater<T>()));
ASSERT_EQUAL(true, thrust::binary_search(vec.begin(), vec.end(), 5, thrust::greater<T>()));
ASSERT_EQUAL(false, thrust::binary_search(vec.begin(), vec.end(), 6, thrust::greater<T>()));
ASSERT_EQUAL(true, thrust::binary_search(vec.begin(), vec.end(), 7, thrust::greater<T>()));
ASSERT_EQUAL(true, thrust::binary_search(vec.begin(), vec.end(), 8, thrust::greater<T>()));
ASSERT_EQUAL(false, thrust::binary_search(vec.begin(), vec.end(), 9, thrust::greater<T>()));
ASSERT_EQUAL(true, thrust::binary_search(vec.begin(), vec.end(), T{0}, thrust::greater<T>()));
ASSERT_EQUAL(false, thrust::binary_search(vec.begin(), vec.end(), T{1}, thrust::greater<T>()));
ASSERT_EQUAL(true, thrust::binary_search(vec.begin(), vec.end(), T{2}, thrust::greater<T>()));
ASSERT_EQUAL(false, thrust::binary_search(vec.begin(), vec.end(), T{3}, thrust::greater<T>()));
ASSERT_EQUAL(false, thrust::binary_search(vec.begin(), vec.end(), T{4}, thrust::greater<T>()));
ASSERT_EQUAL(true, thrust::binary_search(vec.begin(), vec.end(), T{5}, thrust::greater<T>()));
ASSERT_EQUAL(false, thrust::binary_search(vec.begin(), vec.end(), T{6}, thrust::greater<T>()));
ASSERT_EQUAL(true, thrust::binary_search(vec.begin(), vec.end(), T{7}, thrust::greater<T>()));
ASSERT_EQUAL(true, thrust::binary_search(vec.begin(), vec.end(), T{8}, thrust::greater<T>()));
ASSERT_EQUAL(false, thrust::binary_search(vec.begin(), vec.end(), T{9}, thrust::greater<T>()));
}
DECLARE_VECTOR_UNITTEST(TestScalarBinarySearchDescendingSimple);

Expand All @@ -103,27 +103,27 @@ void TestScalarEqualRangeDescendingSimple(void)
vec[3] = 2;
vec[4] = 0;

ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::equal_range(vec.begin(), vec.end(), 0, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::equal_range(vec.begin(), vec.end(), 1, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), 2, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), 3, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), 4, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::equal_range(vec.begin(), vec.end(), 5, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::equal_range(vec.begin(), vec.end(), 6, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 1, thrust::equal_range(vec.begin(), vec.end(), 7, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::equal_range(vec.begin(), vec.end(), 8, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::equal_range(vec.begin(), vec.end(), 9, thrust::greater<T>()).first);

ASSERT_EQUAL_QUIET(vec.begin() + 5, thrust::equal_range(vec.begin(), vec.end(), 0, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::equal_range(vec.begin(), vec.end(), 1, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::equal_range(vec.begin(), vec.end(), 2, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), 3, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), 4, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), 5, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::equal_range(vec.begin(), vec.end(), 6, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::equal_range(vec.begin(), vec.end(), 7, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 1, thrust::equal_range(vec.begin(), vec.end(), 8, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::equal_range(vec.begin(), vec.end(), 9, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::equal_range(vec.begin(), vec.end(), T{0}, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::equal_range(vec.begin(), vec.end(), T{1}, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), T{2}, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), T{3}, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), T{4}, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::equal_range(vec.begin(), vec.end(), T{5}, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::equal_range(vec.begin(), vec.end(), T{6}, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 1, thrust::equal_range(vec.begin(), vec.end(), T{7}, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::equal_range(vec.begin(), vec.end(), T{8}, thrust::greater<T>()).first);
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::equal_range(vec.begin(), vec.end(), T{9}, thrust::greater<T>()).first);

ASSERT_EQUAL_QUIET(vec.begin() + 5, thrust::equal_range(vec.begin(), vec.end(), T{0}, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::equal_range(vec.begin(), vec.end(), T{1}, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 4, thrust::equal_range(vec.begin(), vec.end(), T{2}, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), T{3}, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), T{4}, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 3, thrust::equal_range(vec.begin(), vec.end(), T{5}, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::equal_range(vec.begin(), vec.end(), T{6}, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 2, thrust::equal_range(vec.begin(), vec.end(), T{7}, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 1, thrust::equal_range(vec.begin(), vec.end(), T{8}, thrust::greater<T>()).second);
ASSERT_EQUAL_QUIET(vec.begin() + 0, thrust::equal_range(vec.begin(), vec.end(), T{9}, thrust::greater<T>()).second);
}
DECLARE_VECTOR_UNITTEST(TestScalarEqualRangeDescendingSimple);

5 changes: 3 additions & 2 deletions testing/constant_iterator.cu
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ void TestConstantIteratorCopy(void)
{
using namespace thrust;

typedef constant_iterator<int> ConstIter;
using ValueType = typename Vector::value_type;
using ConstIter = constant_iterator<ValueType>;

Vector result(4);

ConstIter first = make_constant_iterator<int>(7);
ConstIter first = make_constant_iterator<ValueType>(7);
ConstIter last = first + result.size();
thrust::copy(first, last, result.begin());

Expand Down
2 changes: 1 addition & 1 deletion testing/mr_new.cu
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void TestAlignment(MemoryResource memres, std::size_t size, std::size_t alignmen
ASSERT_EQUAL(reinterpret_cast<std::size_t>(ptr) % alignment, 0u);

char * char_ptr = reinterpret_cast<char *>(ptr);
thrust::fill(char_ptr, char_ptr + size, 0);
thrust::fill(char_ptr, char_ptr + size, char{});

memres.do_deallocate(ptr, size, alignment);
}
Expand Down
2 changes: 1 addition & 1 deletion testing/pair_reduce.cu
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ template <typename T>
thrust::device_vector<T> d_p2 = h_p2;
thrust::device_vector<P> d_pairs = h_pairs;

P init = thrust::make_pair(13,13);
P init = thrust::make_pair(T{13}, T{13});

// reduce on the host
P h_result = thrust::reduce(h_pairs.begin(), h_pairs.end(), init, add_pairs());
Expand Down
2 changes: 1 addition & 1 deletion testing/unittest/assertions.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ void assert_equal(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterat

if(mismatches <= MAX_OUTPUT_LINES)
{
if (sizeof(InputType) == 1)
THRUST_IF_CONSTEXPR(sizeof(InputType) == 1)
f << " [" << i << "] " << *first1 + InputType() << " " << *first2 + InputType() << "\n"; // unprintable chars are a problem
else
f << " [" << i << "] " << *first1 << " " << *first2 << "\n";
Expand Down
21 changes: 18 additions & 3 deletions thrust/system/detail/generic/sequence.inl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

#include <thrust/detail/config.h>
#include <thrust/functional.h>
#include <thrust/system/detail/generic/sequence.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/tabulate.h>
Expand Down Expand Up @@ -52,6 +51,19 @@ __host__ __device__
thrust::sequence(exec, first, last, init, T(1));
} // end sequence()

namespace detail
{
template <typename T>
struct compute_sequence_value
{
T init;
T step;
T operator()(std::size_t i) const
{
return init + step * static_cast<T>(i);
}
};
}

template<typename DerivedPolicy, typename ForwardIterator, typename T>
__host__ __device__
Expand All @@ -61,9 +73,12 @@ __host__ __device__
T init,
T step)
{
using thrust::placeholders::_1;

thrust::tabulate(exec, first, last, init + step * _1);
thrust::tabulate(exec,
first,
last,
detail::compute_sequence_value<T>{std::move(init),
std::move(step)});
} // end sequence()


Expand Down
5 changes: 3 additions & 2 deletions thrust/system/detail/generic/shuffle.inl
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ class feistel_bijection {
// but sufficient for generating permutations.
__host__ __device__ uint32_t round_function(uint64_t value,
const uint64_t key_) const {
uint64_t hash0 = thrust::random::taus88(value)();
uint64_t hash0 = thrust::random::taus88(static_cast<uint32_t>(value))();
uint64_t hash1 = thrust::random::ranlux48(value)();
return hash_combine(hash_combine(hash0, key_), hash1) & left_side_mask;
return static_cast<uint32_t>(
hash_combine(hash_combine(hash0, key_), hash1) & left_side_mask);
}

__host__ __device__ round_state do_round(const round_state state,
Expand Down

0 comments on commit ef350b0

Please sign in to comment.