| 135 | } |
| 136 | |
| 137 | void RNG::generateBatch(void) |
| 138 | { |
| 139 | using std::runtime_error; |
| 140 | using std::string; |
| 141 | |
| 142 | cudaError_t cudaResult; |
| 143 | curandStatus_t curandResult; |
| 144 | |
| 145 | // Generate random numbers |
| 146 | curandResult = curandGenerateUniform(*m_pCurrent, m_d_samples, m_nSamplesBatchActual); |
| 147 | |
| 148 | if (curandResult != CURAND_STATUS_SUCCESS) { |
| 149 | string msg("Could not generate random numbers: "); |
| 150 | msg += curandResult; |
| 151 | throw runtime_error(msg); |
| 152 | } |
| 153 | |
| 154 | // Copy random numbers to host |
| 155 | cudaResult = cudaMemcpy(m_h_samples, m_d_samples, m_nSamplesBatchActual * sizeof(float), cudaMemcpyDeviceToHost); |
| 156 | |
| 157 | if (cudaResult != cudaSuccess) { |
| 158 | string msg("Could not copy random numbers to host: "); |
| 159 | msg += cudaGetErrorString(cudaResult); |
| 160 | throw runtime_error(msg); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | float RNG::getNextU01(void) |
| 165 | { |
nothing calls this directly
no outgoing calls
no test coverage detected