diff --git a/src/load-parallel-results.r b/src/load-parallel-results.r new file mode 100644 index 00000000..331e8b47 --- /dev/null +++ b/src/load-parallel-results.r @@ -0,0 +1,34 @@ + +load_parallel_results <- function(resdir) { + ## Find files called .../stdout + stdoutnames <- list.files(path=resdir, pattern="stdout", recursive=T); + ## Read them + stdoutcontents <- + lapply(stdoutnames, function(x) { return(paste(readLines(paste(resdir,x,sep="/")),collapse="\n")) } ); + ## Find files called .../stderr + stderrnames <- list.files(path=resdir, pattern="stderr", recursive=T); + ## Read them + stderrcontents <- + lapply(stderrnames, function(x) { return(paste(readLines(paste(resdir,x,sep="/")),collapse="\n")) } ); + if(length(stdoutnames) == 0) { + ## Return empty data frame if no files found + return(data.frame()); + } + + ## Make the columns containing the variable values + m <- matrix(unlist(strsplit(stdoutnames, "/")),nrow = length(stdoutnames),byrow=T); + mm <- m[,c(F,T)]; + ## Append the stdout and stderr column + mmm <- cbind(mm,unlist(stdoutcontents),unlist(stderrcontents)); + colnames(mmm) <- c(strsplit(stdoutnames[1],"/")[[1]][c(T,F)],"stderr"); + ## Example: + ## parallel --results my/res/dir --header : 'echo {};seq {myvar2}' ::: myvar1 1 2 ::: myvar2 A B + + ## > load_parallel_results("my/res/dir") + ## myvar1 myvar2 stdout stderr + ## [1,] "1" "A" "1 A\n1" "" + ## [2,] "1" "B" "1 B\n1" "" + ## [3,] "2" "A" "2 A\n1\n2" "" + ## [4,] "2" "B" "2 B\n1\n2" "" + return(mmm); +} diff --git a/src/parallel b/src/parallel index a9d958ac..2d470e0a 100755 --- a/src/parallel +++ b/src/parallel @@ -625,7 +625,7 @@ sub get_options_from_array { sub parse_options { # Returns: N/A # Defaults: - $Global::version = 20140102; + $Global::version = 20140103; $Global::progname = 'parallel'; $Global::infinity = 2**31; $Global::debug = 0; @@ -3398,6 +3398,8 @@ sub no_of_cpus { || no_of_cpus_openserver() || no_of_cpus_irix() || no_of_cpus_tru64() + # Number of cores is better than no guess for #CPUs + || nproc() ); } if($no_of_cpus) { @@ -3454,6 +3456,7 @@ sub no_of_cores { || no_of_cores_openserver() || no_of_cores_irix() || no_of_cores_tru64() + || nproc() ); } if($no_of_cores) { @@ -3465,6 +3468,13 @@ sub no_of_cores { } } +sub nproc { + # Returns: + # Number of cores using `nproc` + my $no_of_cores = `nproc 2>/dev/null`; + return $no_of_cores; +} + sub no_of_cpus_gnu_linux { # Returns: # Number of physical CPUs on GNU/Linux @@ -3480,7 +3490,7 @@ sub no_of_cpus_gnu_linux { if(/^physical id.*[:](.*)/ and not $seen{$1}++) { $no_of_cpus++; } - /^processor.*[:]/ and $no_of_cores++; + /^processor.*[:]/i and $no_of_cores++; } close $in_fh; } @@ -3496,7 +3506,7 @@ sub no_of_cores_gnu_linux { $no_of_cores = 0; open(my $in_fh, "-|", "cat /proc/cpuinfo") || return undef; while(<$in_fh>) { - /^processor.*[:]/ and $no_of_cores++; + /^processor.*[:]/i and $no_of_cores++; } close $in_fh; } diff --git a/src/parallel.pdf b/src/parallel.pdf index aa74fb68..d2f2187c 100644 Binary files a/src/parallel.pdf and b/src/parallel.pdf differ diff --git a/src/parallel.pod b/src/parallel.pod index d5a5e01b..1494f44c 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -44,13 +44,19 @@ often be used as a substitute for B or B. =head2 Reader's guide -Before looking at the options you may want to check out the Bs -after the list of options. That will give you an idea of what GNU -B is capable of. - -You can also watch the intro video for a quick introduction: +Start by watching the intro videos for a quick introduction: http://www.youtube.com/playlist?list=PL284C9FF2488BC6D1 +Then look at the Bs after the list of B. That will +give you an idea of what GNU B is capable of. + +Then spend an hour walking through the tutorial (B). Your command line will love you for it. + +Finally you may want to look at the rest of this manual if you have +special needs not already covered. + + =head1 OPTIONS =over 9 diff --git a/src/parallel.texi b/src/parallel.texi index 3664206e..7479167d 100644 --- a/src/parallel.texi +++ b/src/parallel.texi @@ -54,13 +54,18 @@ often be used as a substitute for @strong{xargs} or @strong{cat | bash}. @section Reader's guide @anchor{Reader's guide} -Before looking at the options you may want to check out the @strong{EXAMPLE}s -after the list of options. That will give you an idea of what GNU -@strong{parallel} is capable of. - -You can also watch the intro video for a quick introduction: +Start by watching the intro videos for a quick introduction: http://www.youtube.com/playlist?list=PL284C9FF2488BC6D1 +Then look at the @strong{EXAMPLE}s after the list of @strong{OPTIONS}. That will +give you an idea of what GNU @strong{parallel} is capable of. + +Then spend an hour walking through the tutorial (@strong{man +parallel_tutorial}). Your command line will love you for it. + +Finally you may want to look at the rest of this manual if you have +special needs not already covered. + @chapter OPTIONS @anchor{OPTIONS} diff --git a/testsuite/wanted-results/parallel-local23 b/testsuite/wanted-results/parallel-local23 index efe20e25..62093cc1 100644 --- a/testsuite/wanted-results/parallel-local23 +++ b/testsuite/wanted-results/parallel-local23 @@ -40,7 +40,7 @@ GNU parallel comes with no warranty. Web site: http://www.gnu.org/software/parallel -When using GNU Parallel for a publication please cite: +When using programs that use GNU Parallel to process data for publication please cite: O. Tange (2011): GNU Parallel - The Command-Line Power Tool, ;login: The USENIX Magazine, February 2011:42-47. diff --git a/testsuite/wanted-results/parallel-local9 b/testsuite/wanted-results/parallel-local9 index e672a74a..1830675b 100644 --- a/testsuite/wanted-results/parallel-local9 +++ b/testsuite/wanted-results/parallel-local9 @@ -87,7 +87,7 @@ cat ... | parallel --pipe [options] [command [arguments]] See 'man parallel' for details -When using GNU Parallel for a publication please cite: +When using programs that use GNU Parallel to process data for publication please cite: O. Tange (2011): GNU Parallel - The Command-Line Power Tool, ;login: The USENIX Magazine, February 2011:42-47.