Update results and README

This commit is contained in:
2024-07-15 23:18:51 +08:00
parent afec1cbc5e
commit 151d39d5fe
2 changed files with 24 additions and 4 deletions

View File

@ -1,3 +1,16 @@
# how-many-subshells
# Introduction
How many subshells should a shell subshell if a shell could subshell?
Ever wanted to scale up your "simple" job but have no idea how many nprocs to go with? Well now you do! Just drop your script into `./jobs/` and let it scale.
# Warnings
1. Some of the jobs may load your system in ways I did not plan for. Use it at your own risk.
# How To Use
1. Clone this repository.
1. If you have a custom job, just copy your file into the `jobs` folder. `$ cp /path/to/your-job.sh ./jobs/`
1. Run the script. `$ bash how-many-subshells.sh`
How many subshells can a shell subshell if a shell could subshell?

View File

@ -26,7 +26,9 @@ do
CURRENT=9998
BEFORE=9999
RESULT_FILE="$RESULTS_FOLDER/$(basename $JOB_NAME)"
printf "Result file: $(readlink -f $RESULT_FILE)\n"
#printf "Result file: $(readlink -f $RESULT_FILE)\n"
# Keep scaling up until the runtime is slower than the previous result
while [[ $(echo "$CURRENT < $BEFORE" | bc) -eq 1 ]]
do
BEFORE=$CURRENT
@ -40,8 +42,13 @@ do
done
# Display the results
awk -v nproc="$NPROC" '{print NR*nproc, $0}' $RESULTS_FOLDER/*
printf "nproc\tseconds\n"
awk \
-v nproc="$NPROC" \
'{print NR*nproc, "\t", $0}' \
$RESULTS_FOLDER/*
done
# Clean up
rm -rf $RESULTS_FOLDER