集群运行C++编译可执行文件报错求助(附PBS脚本)
PBS脚本提交MPI作业报错排查
我在集群上运行C++编译的可执行文件R0.5-0.2K-r2.41-ST,使用qsub提交名为submit的PBS脚本时出现错误,无法定位问题。现将PBS脚本内容附上,请求协助排查:
#PBS -S /bin/bash #PBS -N test #PBS -l nodes=1:ppn=8 #PBS -j oe #PBS -V #PBS -o /home/wyhao/output/out/screen.out #PBS -e /home/wyhao/output/error/error.err #PBS -l walltime=99:23:59:59 # export PATH=$PATH:/share/apps/mpich/bin # export PATH=$PATH:/home/wyhao/cmake-3.10/bi export PATH=/usr/lib64:$PATH export LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH source /share/apps/mpich source /home/wyhao/dealii-8.4.1 # Nprocs=`qstat -xf $PBS_JOBID | grep List.ncpus | sed 's/^.\{26\}//'` # cd $PBS_O_WORKDIR # echo "Job $PBS_JOBID started at `date` on `hostname` using $Nprocs processors" cd /home/wyhao/single-ST/build # mkdir build # cmake -DDEAL_II_DIR=/home/wyhao/dealii-8.4.0 ../ # make # /share/apps/mpich/bin/mpiexec -n 8 ./R0.5-0.2K-r2.41-ST /share/apps/mpich/bin/mpiexec -f hosts -n 8 $PBS_NODEFILE ./R0.5-0.2K-r2.41-ST`
核心问题排查及修正方案
Walltime格式错误
PBS的walltime参数要求格式为hh:mm:ss,当前脚本中写的99:23:59:59是四分段格式,不符合规则。需修改为99:59:59(若需要99小时运行时长)。MPI启动命令语法错误
- 同时使用
-f hosts和$PBS_NODEFILE属于重复指定节点文件,二者选其一即可,推荐使用集群自动生成的$PBS_NODEFILE - 命令末尾多了一个多余的反引号`,会触发语法报错
修正后的启动命令:
/share/apps/mpich/bin/mpiexec -n 8 -machinefile $PBS_NODEFILE ./R0.5-0.2K-r2.41-ST- 同时使用
环境与工作目录优化建议
- 虽然通过
source /share/apps/mpich加载了MPI环境,但建议确认mpiexec路径是否能被正确识别,必要时可取消注释export PATH=$PATH:/share/apps/mpich/bin - 取消注释
cd $PBS_O_WORKDIR,确保作业在提交目录启动后再切换到可执行文件所在目录,避免路径依赖问题
- 虽然通过
修正后的完整脚本示例
#PBS -S /bin/bash #PBS -N test #PBS -l nodes=1:ppn=8 #PBS -j oe #PBS -V #PBS -o /home/wyhao/output/out/screen.out #PBS -e /home/wyhao/output/error/error.err #PBS -l walltime=99:59:59 # 修正walltime格式 # 加载依赖环境 source /share/apps/mpich source /home/wyhao/dealii-8.4.1 # 切换到作业提交目录 cd $PBS_O_WORKDIR # 进入可执行文件所在目录 cd /home/wyhao/single-ST/build # 正确启动MPI作业 /share/apps/mpich/bin/mpiexec -n 8 -machinefile $PBS_NODEFILE ./R0.5-0.2K-r2.41-ST
内容的提问来源于stack exchange,提问作者Haoweiye-Crazy potato
相关产品推荐
相关产品推荐

