mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-03-14 20:27:24 +00:00
Fix warnings with clang host compiler.
This commit is contained in:
@@ -56,8 +56,8 @@ NVBENCH_BENCH(single_float64_axis)
|
||||
void copy_sweep_grid_shape(nvbench::state &state)
|
||||
{
|
||||
// Get current parameters:
|
||||
const int block_size = static_cast<int>(state.get_int64("BlockSize"));
|
||||
const int num_blocks = static_cast<int>(state.get_int64("NumBlocks"));
|
||||
const auto block_size = static_cast<unsigned int>(state.get_int64("BlockSize"));
|
||||
const auto num_blocks = static_cast<unsigned int>(state.get_int64("NumBlocks"));
|
||||
|
||||
// Number of int32s in 256 MiB:
|
||||
const std::size_t num_values = 256 * 1024 * 1024 / sizeof(nvbench::int32_t);
|
||||
@@ -77,6 +77,7 @@ void copy_sweep_grid_shape(nvbench::state &state)
|
||||
num_values,
|
||||
in_ptr = thrust::raw_pointer_cast(in.data()),
|
||||
out_ptr = thrust::raw_pointer_cast(out.data())](nvbench::launch &launch) {
|
||||
(void) num_values; // clang thinks this is unused...
|
||||
nvbench::copy_kernel<<<num_blocks, block_size, 0, launch.get_stream()>>>(
|
||||
in_ptr,
|
||||
out_ptr,
|
||||
@@ -110,6 +111,7 @@ void copy_type_sweep(nvbench::state &state, nvbench::type_list<ValueType>)
|
||||
[num_values,
|
||||
in_ptr = thrust::raw_pointer_cast(in.data()),
|
||||
out_ptr = thrust::raw_pointer_cast(out.data())](nvbench::launch &launch) {
|
||||
(void) num_values; // clang thinks this is unused...
|
||||
nvbench::copy_kernel<<<256, 256, 0, launch.get_stream()>>>(in_ptr,
|
||||
out_ptr,
|
||||
num_values);
|
||||
@@ -156,6 +158,7 @@ void copy_type_conversion_sweep(nvbench::state &state,
|
||||
[num_values,
|
||||
in_ptr = thrust::raw_pointer_cast(in.data()),
|
||||
out_ptr = thrust::raw_pointer_cast(out.data())](nvbench::launch &launch) {
|
||||
(void) num_values; // clang thinks this is unused...
|
||||
nvbench::copy_kernel<<<256, 256, 0, launch.get_stream()>>>(in_ptr,
|
||||
out_ptr,
|
||||
num_values);
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
|
||||
protected:
|
||||
// Setup the criterion in the `do_initialize()` method:
|
||||
virtual void do_initialize() override
|
||||
virtual void do_initialize() override
|
||||
{
|
||||
m_num_samples = 0;
|
||||
}
|
||||
@@ -71,6 +71,7 @@ void throughput_bench(nvbench::state &state)
|
||||
state.add_global_memory_writes<nvbench::int32_t>(num_values);
|
||||
|
||||
state.exec(nvbench::exec_tag::no_batch, [&input, &output, num_values](nvbench::launch &launch) {
|
||||
(void) num_values; // clang thinks this is unused...
|
||||
nvbench::copy_kernel<<<256, 256, 0, launch.get_stream()>>>(
|
||||
thrust::raw_pointer_cast(input.data()),
|
||||
thrust::raw_pointer_cast(output.data()),
|
||||
|
||||
@@ -54,6 +54,8 @@ void mod2_inplace(nvbench::state &state)
|
||||
state.exec(nvbench::exec_tag::timer,
|
||||
// Lambda now takes a `timer` argument:
|
||||
[&input, &data, num_values](nvbench::launch &launch, auto &timer) {
|
||||
(void) num_values; // clang thinks this is unused...
|
||||
|
||||
// Reset working data:
|
||||
thrust::copy(thrust::device.on(launch.get_stream()),
|
||||
input.cbegin(),
|
||||
|
||||
@@ -52,6 +52,7 @@ void stream_bench(nvbench::state &state)
|
||||
state.set_cuda_stream(nvbench::make_cuda_stream_view(default_stream));
|
||||
|
||||
state.exec([&input, &output, num_values](nvbench::launch &) {
|
||||
(void) num_values; // clang thinks this is unused...
|
||||
copy(thrust::raw_pointer_cast(input.data()),
|
||||
thrust::raw_pointer_cast(output.data()),
|
||||
num_values);
|
||||
|
||||
@@ -51,6 +51,7 @@ void throughput_bench(nvbench::state &state)
|
||||
state.add_global_memory_writes<nvbench::int32_t>(num_values);
|
||||
|
||||
state.exec([&input, &output, num_values](nvbench::launch &launch) {
|
||||
(void) num_values; // clang thinks this is unused...
|
||||
nvbench::copy_kernel<<<256, 256, 0, launch.get_stream()>>>(
|
||||
thrust::raw_pointer_cast(input.data()),
|
||||
thrust::raw_pointer_cast(output.data()),
|
||||
|
||||
@@ -43,8 +43,8 @@ measure_cold_base::measure_cold_base(state &exec_state)
|
||||
{
|
||||
if (m_min_samples > 0)
|
||||
{
|
||||
m_cuda_times.reserve(m_min_samples);
|
||||
m_cpu_times.reserve(m_min_samples);
|
||||
m_cuda_times.reserve(static_cast<std::size_t>(m_min_samples));
|
||||
m_cpu_times.reserve(static_cast<std::size_t>(m_min_samples));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ Axis: Other
|
||||
const std::string test = fmt::to_string(buffer);
|
||||
const auto diff =
|
||||
std::mismatch(ref.cbegin(), ref.cend(), test.cbegin(), test.cend());
|
||||
const auto idx = diff.second - test.cbegin();
|
||||
const auto idx = static_cast<std::size_t>(diff.second - test.cbegin());
|
||||
ASSERT_MSG(test == ref,
|
||||
"Differs at character {}.\n"
|
||||
"Expected:\n\"{}\"\n\n"
|
||||
|
||||
@@ -32,7 +32,7 @@ void test_const()
|
||||
nvbench::detail::stdrel_criterion criterion;
|
||||
|
||||
criterion.initialize(params);
|
||||
for (int i = 0; i < 5; i++)
|
||||
for (int i = 0; i < 5; i++)
|
||||
{ // nvbench wants at least 5 to compute the standard deviation
|
||||
criterion.add_measurement(42.0);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ std::vector<double> generate(double mean, double rel_std_dev, int size)
|
||||
{
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
std::vector<nvbench::float64_t> v(size);
|
||||
std::vector<nvbench::float64_t> v(static_cast<std::size_t>(size));
|
||||
std::normal_distribution<nvbench::float64_t> dist(mean, mean * rel_std_dev);
|
||||
std::generate(v.begin(), v.end(), [&]{ return dist(gen); });
|
||||
return v;
|
||||
@@ -61,7 +61,7 @@ void test_stdrel()
|
||||
nvbench::detail::stdrel_criterion criterion;
|
||||
criterion.initialize(params);
|
||||
|
||||
for (nvbench::float64_t measurement: generate(mean, max_noise / 2, size))
|
||||
for (nvbench::float64_t measurement: generate(mean, max_noise / 2, size))
|
||||
{
|
||||
criterion.add_measurement(measurement);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ void test_stdrel()
|
||||
params.set_float64("max-noise", max_noise);
|
||||
criterion.initialize(params);
|
||||
|
||||
for (nvbench::float64_t measurement: generate(mean, max_noise * 2, size))
|
||||
for (nvbench::float64_t measurement: generate(mean, max_noise * 2, size))
|
||||
{
|
||||
criterion.add_measurement(measurement);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user