gnu-parallel

Splitting command line args with GNU parallel

こ雲淡風輕ζ 提交于 2019-12-20 10:18:14
问题 Using GNU parallel : http://www.gnu.org/software/parallel/ I have a program that takes two arguments, e.g. $ ./prog file1 file2 $ ./prog file2 file3 ... $ ./prog file23456 file23457 I'm using a script that generates the file name pairs, however this poses a problem because the result of the script is a single string - not a pair. like: $ ./prog "file1 file2" GNU parallel seems to have a slew of tricks up its sleeves, I wonder if there's one for splitting text around separators: $ generate

Accessing Associative Arrays in GNU Parallel

折月煮酒 提交于 2019-12-19 10:29:07
问题 Assume the following in Bash: declare -A ar='([one]="1" [two]="2" )' declare -a ari='([0]="one" [1]="two")' for i in ${!ari[@]}; do echo $i ${ari[i]} ${ar[${ari[i]}]} done 0 one 1 1 two 2 Can the same be done with GNU Parallel, making sure to use the index of the associative array, not the sequence? Does the fact that arrays can't be exported make this difficult, if not impossible? 回答1: A lot has happened in 4 years. GNU Parallel 20190222 comes with env_parallel . This is a shell function

GNU Parallel and Bash functions: How to run the simple example from the manual

左心房为你撑大大i 提交于 2019-12-18 02:18:46
问题 I'm trying to learn GNU Parallel because I have a case where I think I could easily parallelize a bash function. So in trying to learn, I went to the GNU Parallel manual where there is an example...but I can't even get it working! To wit: (232) $ bash --version GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change

GNU parallel not working at all

笑着哭i 提交于 2019-12-17 05:00:56
问题 I have been trying to use GNU parallel for some time, but I have never been able to get it to function at all! For example, running (in a non-empty directory!): ls | parallel echo # Outputs single new line ls | parallel echo echo echo # Outputs three new lines. ls | parallel echo {} # /bin/bash: {}: command not found ls | parallel echo '{}' # /bin/bash: {}: command not found ls | parallel 'echo {}' # Outputs: {} ls | parallel -IMM 'echo MM' # Outputs: MM It seems that it is simply executing

GNU parallel not working at all

会有一股神秘感。 提交于 2019-12-17 05:00:16
问题 I have been trying to use GNU parallel for some time, but I have never been able to get it to function at all! For example, running (in a non-empty directory!): ls | parallel echo # Outputs single new line ls | parallel echo echo echo # Outputs three new lines. ls | parallel echo {} # /bin/bash: {}: command not found ls | parallel echo '{}' # /bin/bash: {}: command not found ls | parallel 'echo {}' # Outputs: {} ls | parallel -IMM 'echo MM' # Outputs: MM It seems that it is simply executing

How to launch multiple child processes that will automatically receive signals sent to parent

梦想的初衷 提交于 2019-12-13 21:24:35
问题 I want to create a Bash script to launch parallel child processes. Is there a way to do this so that the child scripts still receive signals that are sent to the parent process? Here's roughly how I want to launch child processes, but this doesn't meet my signaling criteria. for (( i=0; i<9; i++ )) { { echo $i start ; sleep 5s ; echo $i complete ; } & } wait Because this works automatically in a C-program (that uses fork/exec ), I believe that it should be possible without the use of trap

Serial program runs slower with multiple instances or in parallel

天大地大妈咪最大 提交于 2019-12-13 16:22:56
问题 I have a fortran code that I am using to calculate some quantities related to the work that I do. The code itself involves several nested loops, and requires very little disk I/O. Whenever the code is modified, I run it against a suite of several input files (just to make sure it's working properly). To make a long story short, the most recent update has increased the run time of the program by about a factor of four, and running each input file serially with one CPU takes about 45 minutes (a

GNU Parallel: How do determine job “slot” you're using?

你离开我真会死。 提交于 2019-12-12 11:18:43
问题 I'm trying to find a way to determine the job "slot" or "core" a command is currently using in parallel . For example, we've all seen a similar image of how parallel distributes commands: If I want to know which column a certain process is in, how do I know? My specific problem illustrated: if set -j 4 to only allow 4 jobs to run at once, I want to dynamically know which slot a command is taking, 1 2 3 or 4. The problem is I have some commands that cannot run in parallel, but if I knew which

How to uninstall GNU parallel?

拟墨画扇 提交于 2019-12-11 11:32:10
问题 I installed GNU parallel with (wget pi.dk/3 -qO - || curl pi.dk/3/) | sh , but I believe it is preferable to install it with Homebrew instead, because that makes updating easier. How do I remove everything the script created? I'm using OS X. 回答1: Try this: (wget pi.dk/3 -qO - || curl pi.dk/3/) | bash cd parallel-20*/ make uninstall 来源: https://stackoverflow.com/questions/34344272/how-to-uninstall-gnu-parallel

GNU Parallel as job queue with named pipes

淺唱寂寞╮ 提交于 2019-12-11 06:16:56
问题 I followed the sample code to create a gnu parallel job queue as below // create a job queue file touch jobqueue //start the job queue tail -f jobqueue | parallel -u php worker.php // in another shell, add the data while read LINE; do echo $LINE >> jobqueue; done < input_data_file.txt This approach does work and handles the job as a simple job queue. But there are two problems 1- reading data from input file and then writing it to the jobqueue (another file) is slow as it involves disk I/O. 2