MCPcopy Create free account
hub / github.com/Niko1221/Strata / sample

Method sample

engine/src/kernels/sampler_parity.cpp:402–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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).

Callers 1

mainFunction · 0.45

Calls 7

checkFunction · 0.70
cudaMemsetFunction · 0.50
sample_tokensFunction · 0.50
cudaStreamSynchronizeFunction · 0.50
cudaMemcpyFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected