Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Hackathon 5th No.37】为 Paddle 新增 householder_product API #703

Merged
merged 2 commits into from
Nov 3, 2023
Merged

【Hackathon 5th No.37】为 Paddle 新增 householder_product API #703

merged 2 commits into from
Nov 3, 2023

Conversation

cocoshe
Copy link
Contributor

@cocoshe cocoshe commented Oct 16, 2023

No description provided.


# 五、设计思路与实现方案

在 Paddle repo 的 python/paddle/linalg.py 文件中直接实现

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(1)是否需要build paddle with lapack support?(2)scipy算法库scipy.linalg.lapack中是否包含所需的function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

辛苦review~

  1. 我当时看提交内容提到直接写py的API,所以之前的pr是直接在python层手动实现了lapack中的算法逻辑(当然py效率应该会比直接cpp调用lapack接口差),您是建议在cpp层引入lapack的方法来实现嘛?BTW,pytorch是cpp层统一调了lapack来做householder_productlinalg_qr,paddle目前对linalg.qr的实现是:CPU的kernel调的是eigen,GPU的kernel调的是cusolve,如果又引入lapack会不会有点太杂。对于如何实现这个householder_product有什么建议嘛?
  2. 对的,scipy.linalg.lapack有相应的实现,接口是直接用的orgqr这种lapack包名,之前只搜了一下householder关键字没注意,sry,稍后在rfc中补上~

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以在python层实现,就是确定一下scipy中是不是有lapack的完整实现,那这样的话直接调包可以吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以在python层实现,就是确定一下scipy中是不是有lapack的完整实现,那这样的话直接调包可以吗

scipy是直接调lapack的。
看了下paddle中确实有直接调用lapack包实现一些代数计算功能,在这里引入外部lapack,如果更建议直接调包而不是python层实现的话,应该可以在这里引入一下然后封装成lapack_function,然后householder_product在cpp层写个算子直接调用这个lapack_function,感觉应该也ok

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python层实现,或者cpp层算子实现其功能都可以,不过python层可以实现的话似乎更简捷一些,可以把这些方案写到RFC里面。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python层实现,或者cpp层算子实现其功能都可以,不过python层可以实现的话似乎更简捷一些,可以把这些方案写到RFC里面。

OK,已添加,辛苦review~

Copy link

@lxd-cumt lxd-cumt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luotao1 luotao1 merged commit 1e87410 into PaddlePaddle:master Nov 3, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants