未验证 提交 0c363de8 编写于 作者: P piotrekobi 提交者: GitHub

Enable OMP multithreading in lookup_table_v2 (#45249)

* Add omp parallel for directives

* Revert "Add omp parallel for directives"

This reverts commit f4e4f8ddb12454018d9c1e49c074af2543659de6.

* Add #pragma omp parallel for to correct file

* Add check for _OPENMP definition

* Disable omp on gpu

* Trigger CI

* Readd check for _OPENMP definition

* Change macro disabling changes on GPU

* Improve macro readability
上级 91110661
......@@ -48,6 +48,10 @@ struct EmbeddingCPUFunctor {
dev_ctx_.template Alloc<T>(out_);
auto* output = out_->data<T>();
#if defined(_OPENMP) && !defined(PADDLE_WITH_CUDA)
#pragma omp parallel for
#endif
for (int64_t i = 0; i < ids_numel; ++i) {
if (padding_idx_ != kNoPadding && ids[i] == padding_idx_) {
memset(output + i * row_width, 0, row_width * sizeof(T));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册