如何制作使用OpenMP并使用Intel c Compiler Portable编译的二进制文件?

发布于 2025-01-23 20:21:16 字数 557 浏览 0 评论 0原文

通常,我会使用Intel oneapi命令提示符编译代码(全部在单个文件main.c中),这样

icl.exe main.c -o binary_name

我就可以在常规命令提示符中运行biary_name.exe,而不会出现问题。但是,当我最近利用OpenMP多线程并这样的编译时。

icl.exe main.c -o binary_name /Qopenmp /MD /link libiomp5md.lib

然后,当我尝试通过普通命令提示进行运行时,我会收到此消息:

我最终希望将此简单的代码移动(例如,使用相同的操作系统)。是否可以通过命令提示符或批处理文件进行某些过程,以包装和链接动态库? Windows上似乎不支持OpenMP的静态链接

Normally I compile code (all in a single file main.c) with the intel oneapi command prompt like so

icl.exe main.c -o binary_name

I can then run binary_name.exe without issue from a regular command prompt. However, when I recently exploited openmp multithreading and compiled like so.

icl.exe main.c -o binary_name /Qopenmp /MD /link libiomp5md.lib

Then, when I try to run it through an ordinary command prompt, I get this message:
openmp5 error

I'd ultimately like to move this simple code around (say, to another computer with the same OS). Is there some procedure through a command prompt or batch file for packaging and linking a dynamic library? It is also looking like statically linking for openmp is not supported on windows

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

永不分离 2025-01-30 20:21:16

制作静态链接的版本,或与EXE文件一起分发依赖项DLL文件。

您可以使用依赖关系walker 检查EXE的依赖项。

Either make a statically linked version, or distribute the dependency DLL file(s) along with the EXE file.

You can check the dependencies of your EXE with Dependency Walker.

赠我空喜 2025-01-30 20:21:16

正如您正确说明Windows上不支持OpenMP的静态链接。根据您的用例,您有几个选择。最简单的测试最简单的方法是将动态链接库与可执行文件一起运送,然后将其放在目标系统中的同一目录中。使用DLL构建了许多系统后,通常这是大多数开发人员在生产环境中确保其代码能力的方法。

如果您想在目标系统上做一些更复杂的事情,则可以将动态链接库放在共享位置,并从Microsoft构建站点中遵循搜索订单建议:

https://learn.microsoft.com/en-en-us/windows/windows/windows/windows/win32/win32/dlls/dynamic -link-library-search-order

As you correctly statedk statically linking for OpenMP is not supported on Windows. Depending on your use case you have a couple of options. The simplest one for simple testing is to just ship the Dynamic-Link Library with you executable and place it in the same directory in the target system. Having built a lot of systems using DLLs, this is typically what most developers do to ensure capability with their code in a production environment even.

If you are looking to do something more complex on the target system you can place the Dynamic-Link library in a shared location and follow the search order suggestions from the Microsoft Build site:

https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文