curand.h 1.4 KB
Newer Older
1
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
Q
qijun 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#pragma once

Q
qijun 已提交
16
#include <curand.h>
17 18
#include <mutex>  // NOLINT

19
#include "paddle/pten/backends/dynload/curand.h"
Q
qijun 已提交
20 21

namespace paddle {
Q
qijun 已提交
22
namespace platform {
Q
qijun 已提交
23
namespace dynload {
24 25 26

#define PLATFORM_DECLARE_DYNAMIC_LOAD_CURAND_WRAP(__name)     \
  using DynLoad__##__name = pten::dynload::DynLoad__##__name; \
Y
Yu Yang 已提交
27
  extern DynLoad__##__name __name
Q
qijun 已提交
28

Y
Yu Yang 已提交
29 30 31 32 33 34
#define CURAND_RAND_ROUTINE_EACH(__macro)      \
  __macro(curandCreateGenerator);              \
  __macro(curandSetStream);                    \
  __macro(curandSetPseudoRandomGeneratorSeed); \
  __macro(curandGenerateUniform);              \
  __macro(curandGenerateUniformDouble);        \
Y
Yu Yang 已提交
35
  __macro(curandGenerateNormal);               \
Y
Yu Yang 已提交
36
  __macro(curandDestroyGenerator);
Q
qijun 已提交
37

38
CURAND_RAND_ROUTINE_EACH(PLATFORM_DECLARE_DYNAMIC_LOAD_CURAND_WRAP);
Q
qijun 已提交
39

Q
qijun 已提交
40
}  // namespace dynload
Q
qijun 已提交
41
}  // namespace platform
Q
qijun 已提交
42
}  // namespace paddle