Last active
July 25, 2017 15:58
-
-
Save nievergeltlab/cde1b65a90aac487d851febec2867258 to your computer and use it in GitHub Desktop.
Use all cores within a node via a loop E.g. Given N jobs, with K cores, run jobs 1-K, wait for all to finish, then run K+1 - N
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ncommands=22 | |
| nodesize=6 | |
| nodeuse=$(($nodesize )) | |
| totjobs=$(( ($ncommands + $nodeuse - 1 ) / $nodeuse )) | |
| for i in $(seq 1 1 $totjobs) | |
| do | |
| jstart=$((($i-1)*$nodesize +1)) | |
| jstop=$(($i*$nodesize)) | |
| min=$([ $ncommands -le $jstop ] && echo "$ncommands" || echo "$jstop") | |
| jstop=$min | |
| for j in $(seq $jstart 1 $jstop) | |
| do | |
| fileline=$(cat $genotype_loc | awk -v lineno=$j 'NR==lineno {print}') | |
| chrom=$(echo $fileline | awk 'BEGIN {FS="_m"} {print $NF}') | |
| echo "Using $fileline to make PRS for chromosome $chrom" | |
| $plink2_loc --bfile $fileline --score $weights --q-score-file $threshold --q-score-range $range --out "$output_loc"/"$study"_"$sourcedat"_chr"$chrom" & | |
| done | |
| wait #wait for jobs to finish before starting next set | |
| done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment