gpt4 book ai didi

ios - 在 iOS 项目中使用 Eigen 和 EIGEN_USE_BLAS

转载 作者:行者123 更新时间:2023-12-01 15:42:57 25 4
gpt4 key购买 nike

出于教育目的,我正在尝试在我的宠物项目中使用 Eigen。为了加快数学运算速度,我加入了宏 EIGEN_USE_BLAS,它激活了 blas 库的使用。

但是当我尝试将我的项目上传到 Testflight 时遇到了问题。 Apple 对此的回应是:

ITMS-90338: Non-public API usage - The app references non-public symbols in My-Project: _saxpy_, _sgemm_, _sgemv_, _strmm_, _strmv_. If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed. For further information, visit the Technical Support Information at http://developer.apple.com/support/technical/

我知道 Apple 有 blas 库作为 Accelerate.framework 的一部分,它应该严格通过 Accelerate API 使用。但问题是 Eigen 也有自己的 blas 包含在他们的源代码中,图书馆实际上无意使用 Accelerate.framework 私有(private)胆量。这就是为什么 Apple 要求我重命名这些功能或完全删除它们以消除这种不便。

但我什至不确定是否可以调整 Eigen 及其 blas 以使用替代名称。

有没有办法以某种有效的方式解决这个问题?或者我对 iOS 环境中 Eigen 的使用一无所知?

最佳答案

我很幸运在同事的一些提示和完成工作的强烈意愿下解决了这个问题,现在我想与大家分享我的结论。

问题: Eigen 没有提供 BLAS 二进制文件,它只有 header 。当一个人使用 EIGEN_USE_BLAS 宏并且它确实有效时,这意味着 Apple 正在将 Eigen BLAS 函数链接到他们的二进制文件 - BLAS 二进制文件,它是 Accelerate 的一部分。框架。最棘手的部分是您的项目不一定应该在内部包含 Accelerate.framework。 XCode 会自动添加必要的文件,当然它不会告诉你这些。

这里对我来说最奇怪的是,使用 Apple 的 Accelerate.framework 提供的“裸”BLAS 是一种明显的违规行为,因为它是私有(private) API。所以......从我的角度来看,这是一种 XCode 无意中违反了这条规则,并且没有告诉我任何关于它的信息。奇怪...

因此,为了修复它,您需要构建BLASOpenBLAS 二进制文件(我已经构建了OpenBLAS),将其添加到项目并通过 Build settings 中的 Other linker flags 进行链接。之后错误消失,您可以将您的构建上传到 Testflight。

为了节省您为 iOS 构建 OpenBLAS 的时间,我将给您留下几个链接。我认为这些就足够了:

http://www.programmersought.com/article/2638161057/ - 关于如何构建 OpenBLAS 的非常清晰的教程 https://github.com/xianyi/OpenBLAS/tree/release-0.2.21 - 图书馆的源代码 https://github.com/xianyi/OpenBLAS/issues/1531 - 讨论您可以在哪里找到您可能遇到的问题的解决方案

我发现整个故事中最令人困惑的部分是来自 Apple 的信息。这是另一个副本:

ITMS-90338: Non-public API usage - The app references non-public symbols in My-Project: saxpy, sgemm, sgemv, strmm, strmv. If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed. For further information, visit the Technical Support Information at http://developer.apple.com/support/technical/

我的母语不是英语,但我非常有信心地说这篇文章是胡说八道,与解决实际问题完全无关。

它完全没有说明私有(private) API 链接到我的代码这一事实,这就是问题所在。而且我需要为这些函数提供我自己的后端以使错误消失。它说名字匹配,更改我的名字将有助于解决问题,但在我的情况下显然不会。

我希望 Apple 能更清楚地说明这个问题,并且错误描述在未来会更有意义。

关于ios - 在 iOS 项目中使用 Eigen 和 EIGEN_USE_BLAS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58139693/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com