SGE集群多核工作

时间:2018-06-05 20:13:12

标签: python bash machine-learning scikit-learn

我想在SGE集群计算机上使用sklearn GridSearchCV()1多处理功能。作业提交的bash脚本如下所示。

目前,我使用命令OMP_NUM_THREADS = 1指定使用单个核心的命令,同时从数组列表文件读取。该脚本遍历〜250个不同的超参数组合并记录结果。

最好,我可以使用下面的多处理功能的单个作业来搜索最佳参数。

该函数目前不实用,因为它需要我设置n_jobs参数。在我的电脑上,我可以设置n_jobs = -1或n_jobs = 4来使用我PC上的所有4个内核。该程序使用我的PC上的所有4个核心和一个超参数组合执行大约需要10分钟。但是,我需要评估大约250个超参数组合。

如何指示群集为单个作业使用50到100个核心来代替250个作业的一个核心?

#!/bin/bash
#
#$ -S /bin/bash
#$ -l arch=linux-x64  
#$ -l mem_free=50G     
#$ -R yes     
#$ -V
#$ -cwd 
#$ -l h_rt=120:00:00
#$ -o /output_directory/
#$ -e /output_directory/
#$ -r y
#$ -j y
#$ -t 1-250

##store C and gamma values on separate line of file and read each line as separate array job item.

module load openmpi-1.6-nodlopen
export OMP_NUM_THREADS=1
qstat -j $JOB_ID
#Make data for input and output files
#http://wiki.gridengine.info/wiki/index.php/Simple-Job-Array-Howto
SEEDFILE='./hyperparameters.txt'
SEED=$(awk "NR==$SGE_TASK_ID" $SEEDFILE)
a1=$(echo $SEED | cut -d "," -f 1)
a2=$(echo $SEED | cut -d "," -f 2)
a3=$(echo $SEED | cut -d "," -f 3)
ipython sd.py $a1 $a2 $a3

0 个答案:

没有答案