Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port cub::DeviceReduce tests to catch2 #267

Merged
merged 5 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cub/test/bfloat16.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ struct bfloat16_t
******************************************************************************/

/// Insert formatted \p bfloat16_t into the output stream
std::ostream& operator<<(std::ostream &out, const bfloat16_t &x)
inline std::ostream& operator<<(std::ostream &out, const bfloat16_t &x)
{
out << (float)x;
return out;
}


/// Insert formatted \p __nv_bfloat16 into the output stream
std::ostream& operator<<(std::ostream &out, const __nv_bfloat16 &x)
inline std::ostream& operator<<(std::ostream &out, const __nv_bfloat16 &x)
{
return out << bfloat16_t(x);
}
Expand Down
48 changes: 48 additions & 0 deletions cub/test/c2h/extended_types.cuh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/******************************************************************************
* Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the NVIDIA CORPORATION nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/

#pragma once

#ifndef TEST_HALF_T
#define TEST_HALF_T !_NVHPC_CUDA
#endif

#ifndef TEST_BF_T
#define TEST_BF_T !_NVHPC_CUDA
#endif

#ifdef TEST_HALF_T
#include <cuda_fp16.h>

#include "../half.h"
#endif

#ifdef TEST_BF_T
#include <cuda_bf16.h>

#include "../bfloat16.h"
#endif
9 changes: 9 additions & 0 deletions cub/test/c2h/generators.cu
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <cstdint>

#include <c2h/custom_type.cuh>
#include <c2h/extended_types.cuh>
#include <c2h/generators.cuh>
#include <curand.h>
#include <fill_striped.cuh>
Expand Down Expand Up @@ -316,6 +317,14 @@ INSTANTIATE(std::int64_t);
INSTANTIATE(float);
INSTANTIATE(double);

#ifdef TEST_HALF_T
INSTANTIATE(half_t);
#endif

#ifdef TEST_BF_T
INSTANTIATE(bfloat16_t);
#endif

template <typename T, int VecItem>
struct vec_gen_helper_t;

Expand Down
Loading