#!/bin/bash SEND_THREAD_NUM=1 tmp_fifofile="/tmp/$$.fifo" # 脚本运行的当前进程ID号作为文件名 mkfifo "$tmp_fifofile" # 新建一个随机fifo管道文件 exec 6<>"$tmp_fifofile" # 定义文件描述符6指向这个fifo管道文件 rm $tmp_fifofile for i in $(seq 1 $SEND_THREAD_NUM) do echo # for循环 往 fifo管道文件中写入 $SEND_THREAD_NUM 个空行 done >&6 ulimit -t 3600 instance="/pub/data/chenzh/data/sat2022" run_solver(){ solver=$1 res_solver_ins=$2 solver_args=$3 if [ ! -d "$res_solver_ins" ]; then mkdir -p $res_solver_ins fi for dir_file in `cat $instance/all.txt` do file=$dir_file echo "$res_solver_ins $file $solver_args" touch $res_solver_ins/$file read -u 6 { time $solver $instance/$file $solver_args echo >&6 } >$res_solver_ins/$file 2>>$res_solver_ins/$file & done } all_datas=($instance) for((i=0;i<${#all_datas[*]};i++)) do instance=${all_datas[$i]} run_solver \ 'mpirun -np 9 --allow-run-as-root ./light -i ' \ 'exp-result'\ '--share=1 --threads=32 --times=3600' done