Program Listing for File hiprand_mtgp32_host.h
↰ Return to documentation for file (hiprand/hiprand_mtgp32_host.h
)
// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#ifndef HIPRAND_MTGP32_HOST_H_
#define HIPRAND_MTGP32_HOST_H_
#if defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__) || HIPRAND_DOXYGEN
#include "hiprand/hiprand_kernel.h"
typedef mtgp32_params mtgp32_kernel_params_t;
typedef mtgp32_fast_params mtgp32_fast_param_t;
inline __host__
hiprandStatus_t hiprandMakeMTGP32Constants(const mtgp32_params_fast_t params[],
mtgp32_kernel_params_t * p)
{
return to_hiprand_status(
rocrand_make_constant(params, p)
);
}
inline __host__
hiprandStatus_t hiprandMakeMTGP32KernelState(hiprandStateMtgp32_t *s,
mtgp32_params_fast_t params[],
mtgp32_kernel_params_t *k,
int n,
unsigned long long seed)
{
return to_hiprand_status(
rocrand_make_state_mtgp32(s, params, n, seed)
);
}
#else // for HIP NVCC platfrom
#include "hiprand/hiprand_kernel.h"
#include <curand_mtgp32_host.h>
__forceinline__ __host__
hiprandStatus_t hiprandMakeMTGP32Constants(const mtgp32_params_fast_t params[],
mtgp32_kernel_params_t * p)
{
return to_hiprand_status(
curandMakeMTGP32Constants(params, p)
);
}
__forceinline__ __host__
hiprandStatus_t hiprandMakeMTGP32KernelState(hiprandStateMtgp32_t *s,
mtgp32_params_fast_t params[],
mtgp32_kernel_params_t *k,
int n,
unsigned long long seed)
{
return to_hiprand_status(
curandMakeMTGP32KernelState(s, params, k, n, seed)
);
}
#endif // __HIP_PLATFORM_HCC__
#endif // HIPRAND_MTGP32_HOST_H_