I am not very familiar with bash, but would like to break this code so that I can run it on a server with 12 processors:
#!/bin/bash #bashScript.sh for i in {1..209} do Rscript Compute.R $i done
How can I achieve this?
Thanks!
Use xargs with the --max-procs ( -P ) option. If there are enough arguments, xargs will use exactly this number of parallel processes to process input:
xargs
--max-procs
-P
#! /bin/bash seq 209 | xargs -P12 -r -n1 Rscript Compute.R
Try:
#!/bin/bash #bashScript.sh for i in {1..209} do Rscript Compute.R $i & done
Using the GNU Parallel Interface:
parallel Rscript Compute.R ::: {1..209}
Installation in 10 seconds:
wget -O - pi.dk/3 | sh
Watch the video for a quick introduction: https://www.youtube.com/playlist?list=PL284C9FF2488BC6D1
Source: https://habr.com/ru/post/1492373/More articles:How can I get data synchronously from cordova-sqlite? - jqueryString Parameters - c ++Unicode platform independence - pythonpymc.NormApprox unexpected behavior - unable to see mu and C and nuking namespaces - pythoncreate an instance of a python object immediately after defining its class - pythonIs the azure calculation emulator a simulation of performance? - azurePrint the first few list items in perl - perllua - how to create functions - functionReading from standard input using emscripten gets non-existent newlines - cThe button does not trigger the corresponding action (tag button and enter button = button) - javascriptAll Articles