I'm a student who wants to benchmark a NGS pipeline, monitoring performance according to how many cores it has allocated to it and the size of the input file. For this reason, I wrote a bash script to call it multiple times with different nr_of_cores parameters and input files, noting down completion time and other stats. The whole thing takes about a day to run through the various scenarios. (Spending, of course, most time on running the biggest file with a single core, so it's not like I'm blocking the whole server for the duration)
I have access to a shared 64-core server to run it on. The shared server, however, varies wildly in number of idle cores depending on time of day and people trying to get projects done. (The top nr_of_cores I'll test is 36, with a small file.)
My question: Is there an easy way to make my bash script wait until it knows [X] cores are available before executing a command? I figure that way, I'd get more reliable data, I wouldn't slow down people with more urgent tasks to run, and I could start the script whenever, instead of waiting until I happen to see with htop that it's a slow day.