I want to compare the speed of matrix multiplication using different number of cores. I want to write a for loop on number of cores in shell code. But the actual computation is done in R. So it's a mix of bash shell code and R code. Something like the following
for p in {1..8}
do
export OMP_NUM_THREADS = p
## R code for matrix multiplication ##
done
Is this possible to do?
Rscript --vanilla script.R.