在集群上加载库

发布于 2024-10-12 20:24:28 字数 1153 浏览 2 评论 0原文

我在我们这里的集群上使用 boost 成功编译了一个 C++ 程序。我需要运行 SGE 脚本来运行模拟。我得到的错误是这样的

./main: 加载共享时出错 库:libboost_thread.so.1.45.0: 无法打开共享对象文件:否 这样的文件或目录

启动程序时是否需要指定库的名称?我使用的脚本如下

#!/bin/sh
# (c) 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
# This is a simple example of a SGE batch script

# request Bourne shell as shell for job
#$ -S /bin/sh

#$ -N cr_number       # this name shows in qstat
#$ -S /bin/bash      # run with this shell
#$ -l h_rt=50:00:00  # need 50 hour runtime
#$ -pe mpich 4       # define parallel env
#$ -cwd     # run the job in the directory specified.
#$ -o cr_number.out
#$ -e cr_number.err
# (-j will merge stdout and stderr)

#$ -notify
#$ -M [email protected] - send mail about this job to the given email address.
#$ -m beas          # send a mail to owner when the job
#                       begins (b), ends (e), aborted (a),
#                       and suspended(s).         and suspended(s).

./main

谢谢

I successfully compiled a program in c++, with boost, on a cluster we have here. I need to run an SGE script to run the simulation. The error I get is this

./main: error while loading shared
libraries: libboost_thread.so.1.45.0:
cannot open shared object file: No
such file or directory

Do I need to specify the name of the library when I launch the program? The script I used is below

#!/bin/sh
# (c) 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
# This is a simple example of a SGE batch script

# request Bourne shell as shell for job
#$ -S /bin/sh

#$ -N cr_number       # this name shows in qstat
#$ -S /bin/bash      # run with this shell
#$ -l h_rt=50:00:00  # need 50 hour runtime
#$ -pe mpich 4       # define parallel env
#$ -cwd     # run the job in the directory specified.
#$ -o cr_number.out
#$ -e cr_number.err
# (-j will merge stdout and stderr)

#$ -notify
#$ -M [email protected] - send mail about this job to the given email address.
#$ -m beas          # send a mail to owner when the job
#                       begins (b), ends (e), aborted (a),
#                       and suspended(s).         and suspended(s).

./main

Thank you

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

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

发布评论

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

评论(2

洒一地阳光 2024-10-19 20:24:28

最简单的选择是编译静态二进制文件。 (对于 gcc,使用 -static。对于其他编译器,使用 RTFM。)

另一个选项是将 LD_LIBRARY_PATH 环境变量设置为包含作业脚本内的 Boost 库:

LD_LIBRARY_PATH=/where/ever/you/installed/boost

如果您自己没有安装 Boost,您可以使用 ldd main 找出您的程序在哪里寻找其库。

The easiest option is to compile a static binary. (With gcc, use -static. For other compilers, RTFM.)

Another option is to set the LD_LIBRARY_PATH environment variable to the directory containing the Boost libraries, inside the job script:

LD_LIBRARY_PATH=/where/ever/you/installed/boost

If you didn't install Boost yourself, you can find out where your program is looking for its libraries with ldd main.

凹づ凸ル 2024-10-19 20:24:28

您在什么平台上运行 SGE?所有节点都是相同的架构吗?您使用哪些编译器?该库需要存在于您要动态运行它的每个节点上的同一位置。 @larsmans 建议的选项可能是最好的主意(运行静态编译的二进制文件)。

What platform are you running SGE on? Are all of the nodes the same architecture? Which compilers are you using? The library will need to be present, in the same location on each node of you are going to run it dynamically. The option suggested by @larsmans is probably the best idea (running a static compiled binary).

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