尽管提到了作业应该运行的作业名称,分区和节点,但R仍然在计算节点01上运行而没有迁移到其他节点。我现在正在介绍下面的脚本,感谢任何帮助:
!/bin/bash
#SBATCH --job-name=10/0.30
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=16
#SBATCH --partition=debug
#SBATCH --exclude=compute[23,31-33,40]
#SBATCH --nodelist=compute[07]
echo "program started"
cd /home1/ASP/sourav/coarse_grained_simulations/10/0.30
sbatch /home1/ASP/R-3.3.1/bin/R CMD BATCH --no-save --no-restore test_dcd.R test_dcd.out
运行squeue以获取正在运行的作业列表:
12169 nnvi R ASP R 7:08 1 compute01
12172 nnvi R ASP R 5:03 1 compute01
12175 nnvi R ASP R 3:26 1 compute01
12177 nnvi R ASP R 0:02 1 compute01
答案 0 :(得分:2)
您必须运行sbatch,将脚本作为参数传递,而不是在脚本内部。
所以不要运行:
O(n^2)
你应该跑:
//arr is already sorted
long triangles = 0;
for(int i = 0; i < n-2; i++){
int k = i + 2;
for(int j = i + 1; j < n; j++){
while(arr[i] + arr[j] > arr[k] && k < n){
k++;
}
triangles += k-j-1;
}
}
long answer = n*(n-1)*(n-2)/6 - triangles;
此外,如果您想在作业中使用多个cpu,则应使用sbatch /home1/ASP/R-3.3.1/bin/R...
而不是sbatch myscript.sh
。 --cpus-per-task=16
和--ntasks-per-node
用于MPI应用程序。有关这些选项的更多详细信息,请查看sbatch联机帮助页。