| 125 | } |
| 126 | |
| 127 | bool GpuRng::Init() { |
| 128 | absl::MutexLock lock{&mu_}; |
| 129 | CHECK(rng_ == nullptr); |
| 130 | |
| 131 | hiprandStatus_t ret = |
| 132 | wrap::hiprandCreateGenerator(parent_, &rng_, HIPRAND_RNG_PSEUDO_DEFAULT); |
| 133 | if (ret != HIPRAND_STATUS_SUCCESS) { |
| 134 | LOG(ERROR) << "failed to create random number generator: " << ret; |
| 135 | return false; |
| 136 | } |
| 137 | |
| 138 | CHECK(rng_ != nullptr); |
| 139 | return true; |
| 140 | } |
| 141 | |
| 142 | bool GpuRng::SetStream(Stream* stream) { |
| 143 | hiprandStatus_t ret = |
no outgoing calls
no test coverage detected