有没有办法加速 C++ Solaris Sun Studio 12 中的编译时间?

发布于 2024-09-08 17:33:04 字数 91 浏览 3 评论 0原文

由于我是在一个服务器机器(总共 32 或 64 个核心)上编译 C++ 代码,有没有办法调整编译器选项来加快编译时间?例如告诉编译器使用多线程编译独立的.cpp 文件。

Since I am compiling my C++ code on a very server box (32 or 64 cores in total), is there a way of tweaking compiler options to speed up the compilation times? E.g. to tell compiler to compile independent .cpp files using multiple threads.

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

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

发布评论

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

评论(4

久隐师 2024-09-15 17:33:04

Sun Studio 在 make 的 dmake 版本中包含并行构建支持。
请参见 dmake 手册 了解详细信息。

Sun Studio includes parallel build support in the included dmake version of make.
See the dmake manual for details.

挽清梦 2024-09-15 17:33:04

这取决于您使用的工具链。

如果您使用的是 GNU Make,则将 -j 32 添加到您的 make 调用中,以告诉 Make 并行启动 32 个作业(例如)。只要确保您没有耗尽 RAM 并因此破坏交换文件即可。

This depends on what toolchain you're using.

If you're using GNU Make, then add -j 32 to your make invocation to tell Make to start 32 jobs (for example) in parallel. Just make sure that you're not exhausting RAM and thrashing your swap file as a result.

携余温的黄昏 2024-09-15 17:33:04

使用像 Boost JAM 这样的东西,它可以为你做这种多线程处理——根据我的经验,它比多线程 make 效率更高。

Use something like Boost JAM which does this sort of multithreading for you - and from my experience much more efficiently than multi-threaded make.

飘落散花 2024-09-15 17:33:04

Sun 的 C++ 编译器还有一个 -xjobs 选项,使编译器在内部分叉多个线程。为了提高效率,您可能必须将所有 .cc 文件传递​​给 CC 的单次调用。

Sun's C++ compiler also has an -xjobs option that makes the compiler fork multiple threads internally. For this to be efficient you would probably have to pass all .cc files to a single invocation of CC.

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