| 400 | if (h) cudaFree(h); |
| 401 | } |
| 402 | std::vector<int> sample(const strata::kernels::SamplerParams& p, cudaStream_t stream) { |
| 403 | check(cudaMemset(o, 0xFF, (size_t) n_tokens * sizeof(int)), "fill out"); |
| 404 | strata::kernels::sample_tokens(l, n_tokens, nv, h, hist_len, p, o, stream); |
| 405 | if (stream != nullptr) check(cudaStreamSynchronize(stream), "stream sync"); |
| 406 | std::vector<int> got((size_t) n_tokens); |
| 407 | check(cudaMemcpy(got.data(), o, got.size() * sizeof(int), cudaMemcpyDeviceToHost), "back"); |
| 408 | return got; |
| 409 | } |
| 410 | }; |
| 411 | |
| 412 | // The counted window of row t: the last min(penalty_last_n, hist_len) entries (none without penalties). |
no test coverage detected