mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 05:57:54 +00:00
parallel: Round --block if given as non-integer.
This commit is contained in:
parent
ec20263343
commit
e30d812c99
28
src/parallel
28
src/parallel
|
@ -561,7 +561,7 @@ sub pipe_part_files(@) {
|
||||||
}
|
}
|
||||||
my $header = find_header(\$buf,open_or_exit($file));
|
my $header = find_header(\$buf,open_or_exit($file));
|
||||||
# find positions
|
# find positions
|
||||||
my @pos = find_split_positions($file,$Global::blocksize,$header);
|
my @pos = find_split_positions($file,int($Global::blocksize),$header);
|
||||||
# Make @cat_prepends
|
# Make @cat_prepends
|
||||||
my @cat_prepends = ();
|
my @cat_prepends = ();
|
||||||
for(my $i=0; $i<$#pos; $i++) {
|
for(my $i=0; $i<$#pos; $i++) {
|
||||||
|
@ -590,7 +590,7 @@ sub find_header($$) {
|
||||||
if($opt::header eq ":") { $opt::header = "(.*\n)"; }
|
if($opt::header eq ":") { $opt::header = "(.*\n)"; }
|
||||||
# Number = number of lines
|
# Number = number of lines
|
||||||
$opt::header =~ s/^(\d+)$/"(.*\n)"x$1/e;
|
$opt::header =~ s/^(\d+)$/"(.*\n)"x$1/e;
|
||||||
while(sysread($fh,$$buf_ref,$Global::blocksize,length $$buf_ref)) {
|
while(sysread($fh,$$buf_ref,int($Global::blocksize),length $$buf_ref)) {
|
||||||
if($$buf_ref =~ s/^($opt::header)//) {
|
if($$buf_ref =~ s/^($opt::header)//) {
|
||||||
$header = $1;
|
$header = $1;
|
||||||
last;
|
last;
|
||||||
|
@ -947,7 +947,7 @@ sub spreadstdin() {
|
||||||
my $chunk_number = 1;
|
my $chunk_number = 1;
|
||||||
my $one_time_through;
|
my $one_time_through;
|
||||||
my $two_gb = 2**31-1;
|
my $two_gb = 2**31-1;
|
||||||
my $blocksize = $Global::blocksize;
|
my $blocksize = int($Global::blocksize);
|
||||||
my $in = *STDIN;
|
my $in = *STDIN;
|
||||||
my $timeout = $Global::blocktimeout;
|
my $timeout = $Global::blocktimeout;
|
||||||
|
|
||||||
|
@ -2164,7 +2164,7 @@ sub check_invalid_option_combinations() {
|
||||||
|
|
||||||
sub init_globals() {
|
sub init_globals() {
|
||||||
# Defaults:
|
# Defaults:
|
||||||
$Global::version = 20201023;
|
$Global::version = 20201122;
|
||||||
$Global::progname = 'parallel';
|
$Global::progname = 'parallel';
|
||||||
$::name = "GNU Parallel";
|
$::name = "GNU Parallel";
|
||||||
$Global::infinity = 2**31;
|
$Global::infinity = 2**31;
|
||||||
|
@ -4924,8 +4924,8 @@ sub usage() {
|
||||||
"If you use programs that use GNU Parallel to process data for an article in a",
|
"If you use programs that use GNU Parallel to process data for an article in a",
|
||||||
"scientific publication, please cite:",
|
"scientific publication, please cite:",
|
||||||
"",
|
"",
|
||||||
" Tange, O. (2020, October 22). GNU Parallel 20201022 ('SamuelPaty').",
|
" Tange, O. (2020, November 22). GNU Parallel 20201122 ('Biden').",
|
||||||
" Zenodo. https://doi.org/10.5281/zenodo.4118697",
|
" Zenodo. https://doi.org/10.5281/zenodo.4284075",
|
||||||
"",
|
"",
|
||||||
# Before changing this line, please read
|
# Before changing this line, please read
|
||||||
# https://www.gnu.org/software/parallel/parallel_design.html#Citation-notice
|
# https://www.gnu.org/software/parallel/parallel_design.html#Citation-notice
|
||||||
|
@ -4955,8 +4955,8 @@ sub citation_notice() {
|
||||||
"If you use programs that use GNU Parallel to process data for an article in a",
|
"If you use programs that use GNU Parallel to process data for an article in a",
|
||||||
"scientific publication, please cite:",
|
"scientific publication, please cite:",
|
||||||
"",
|
"",
|
||||||
" Tange, O. (2020, October 22). GNU Parallel 20201022 ('SamuelPaty').",
|
" Tange, O. (2020, November 22). GNU Parallel 20201122 ('Biden').",
|
||||||
" Zenodo. https://doi.org/10.5281/zenodo.4118697",
|
" Zenodo. https://doi.org/10.5281/zenodo.4284075",
|
||||||
"",
|
"",
|
||||||
# Before changing this line, please read
|
# Before changing this line, please read
|
||||||
# https://www.gnu.org/software/parallel/parallel_design.html#Citation-notice and
|
# https://www.gnu.org/software/parallel/parallel_design.html#Citation-notice and
|
||||||
|
@ -5069,20 +5069,20 @@ sub citation() {
|
||||||
"If you use programs that use GNU Parallel to process data for an article in a",
|
"If you use programs that use GNU Parallel to process data for an article in a",
|
||||||
"scientific publication, please cite:",
|
"scientific publication, please cite:",
|
||||||
"",
|
"",
|
||||||
"\@software{tange_2020_4118697,",
|
"\@software{tange_2020_4284075,",
|
||||||
" author = {Tange, Ole},",
|
" author = {Tange, Ole},",
|
||||||
" title = {GNU Parallel 20201022 ('SamuelPaty')},",
|
" title = {GNU Parallel 20201122 ('Biden')},",
|
||||||
" month = Oct,",
|
" month = Nov,",
|
||||||
" year = 2020,",
|
" year = 2020,",
|
||||||
" note = {{GNU Parallel is a general parallelizer to run",
|
" note = {{GNU Parallel is a general parallelizer to run",
|
||||||
" multiple serial command line programs in parallel",
|
" multiple serial command line programs in parallel",
|
||||||
" without changing them.}},",
|
" without changing them.}},",
|
||||||
" publisher = {Zenodo},",
|
" publisher = {Zenodo},",
|
||||||
" doi = {10.5281/zenodo.4118697},",
|
" doi = {10.5281/zenodo.4284075},",
|
||||||
" url = {https://doi.org/10.5281/zenodo.4118697}",
|
" url = {https://doi.org/10.5281/zenodo.4284075}",
|
||||||
"}",
|
"}",
|
||||||
"",
|
"",
|
||||||
"(Feel free to use \\nocite{tange_2020_4118697})",
|
"(Feel free to use \\nocite{tange_2020_4284075})",
|
||||||
"",
|
"",
|
||||||
# Before changing this line, please read
|
# Before changing this line, please read
|
||||||
# https://www.gnu.org/software/parallel/parallel_design.html#Citation-notice and
|
# https://www.gnu.org/software/parallel/parallel_design.html#Citation-notice and
|
||||||
|
|
|
@ -12,6 +12,11 @@ export -f stdsort
|
||||||
# Test amount of parallelization
|
# Test amount of parallelization
|
||||||
# parallel --shuf --jl /tmp/myjl -j1 'export JOBS={1};'bash tests-to-run/parallel-local-0.3s.sh ::: {1..16} ::: {1..5}
|
# parallel --shuf --jl /tmp/myjl -j1 'export JOBS={1};'bash tests-to-run/parallel-local-0.3s.sh ::: {1..16} ::: {1..5}
|
||||||
|
|
||||||
|
par_pipe_float_blocksize() {
|
||||||
|
echo '### Test --block <<non int>>'
|
||||||
|
seq 5 | parallel --block 3.1 --pipe wc
|
||||||
|
}
|
||||||
|
|
||||||
par_opt_gnu() {
|
par_opt_gnu() {
|
||||||
echo '### Test --tollef'
|
echo '### Test --tollef'
|
||||||
stdout parallel -k --tollef echo -- 1 2 3 ::: a b c | LC_ALL=C sort
|
stdout parallel -k --tollef echo -- 1 2 3 ::: a b c | LC_ALL=C sort
|
||||||
|
|
|
@ -521,6 +521,12 @@ par_pipe_N1_regexp JOB4
|
||||||
par_pipe_N1_regexp begin
|
par_pipe_N1_regexp begin
|
||||||
par_pipe_N1_regexp cend
|
par_pipe_N1_regexp cend
|
||||||
par_pipe_N1_regexp END
|
par_pipe_N1_regexp END
|
||||||
|
par_pipe_float_blocksize ### Test --block <<non int>>
|
||||||
|
par_pipe_float_blocksize 1 1 2
|
||||||
|
par_pipe_float_blocksize 1 1 2
|
||||||
|
par_pipe_float_blocksize 1 1 2
|
||||||
|
par_pipe_float_blocksize 1 1 2
|
||||||
|
par_pipe_float_blocksize 1 1 2
|
||||||
par_pipe_no_command ### --pipe without command
|
par_pipe_no_command ### --pipe without command
|
||||||
par_pipe_no_command parallel: Error: --pipe/--pipepart must have a command to pipe into (e.g. 'cat').
|
par_pipe_no_command parallel: Error: --pipe/--pipepart must have a command to pipe into (e.g. 'cat').
|
||||||
par_pipe_recend bug #54328: --pipe --recend blocks
|
par_pipe_recend bug #54328: --pipe --recend blocks
|
||||||
|
|
Loading…
Reference in a new issue