2013-12-19 01:19:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Simple jobs that never fails
|
|
|
|
# Each should be taking >100s and be possible to run in parallel
|
|
|
|
# I.e.: No race conditions, no logins
|
2015-07-22 06:28:05 +00:00
|
|
|
|
2016-06-27 19:00:19 +00:00
|
|
|
# tmpdir with > 5 GB available
|
2015-07-22 06:28:05 +00:00
|
|
|
TMP5G=${TMP5G:-/dev/shm}
|
|
|
|
export TMP5G
|
|
|
|
|
2016-08-03 21:45:13 +00:00
|
|
|
rm -f /tmp/*.{tmx,pac,arg,all,log,swp,loa,ssh,df,pip,tmb,chr,tms,par}
|
|
|
|
|
2016-07-10 21:00:20 +00:00
|
|
|
par_retries_unreachable() {
|
|
|
|
echo '### Test of --retries on unreachable host'
|
2016-05-17 00:11:38 +00:00
|
|
|
seq 2 | stdout parallel -k --retries 2 -v -S 4.3.2.1,: echo
|
2016-07-10 21:00:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
par_outside_file_handle_limit() {
|
|
|
|
echo "### Test Force outside the file handle limit, 2009-02-17 Gave fork error"
|
|
|
|
(echo echo Start; seq 1 20000 | perl -pe 's/^/true /'; echo echo end) |
|
|
|
|
stdout parallel -uj 0 | egrep -v 'processes took|adjusting'
|
|
|
|
}
|
|
|
|
|
|
|
|
par_over_4GB() {
|
|
|
|
echo '### Test if we can deal with output > 4 GB'
|
|
|
|
echo |
|
|
|
|
nice parallel --tmpdir $TMP5G -q perl -e '$a="x"x1000000;for(0..4300){print $a}' |
|
|
|
|
nice md5sum
|
|
|
|
}
|
|
|
|
|
2016-08-14 14:54:27 +00:00
|
|
|
|
|
|
|
measure() {
|
|
|
|
# Input:
|
|
|
|
# $1 = iterations
|
|
|
|
# $2 = sleep 1 sec for every $2
|
2016-09-22 22:57:30 +00:00
|
|
|
seq $1 | ramusage parallel -u sleep '{= $_=$_%'$2'?0:1 =}'
|
2016-08-14 14:54:27 +00:00
|
|
|
}
|
|
|
|
export -f measure
|
|
|
|
|
|
|
|
no_mem_leak() {
|
|
|
|
# Return false if leaking
|
2016-09-22 22:57:30 +00:00
|
|
|
max1000=$(parallel measure {} 100000 ::: 1000 1000 1000 1000 1000 1000 1000 1000 |
|
2016-08-14 14:54:27 +00:00
|
|
|
sort -n | tail -n 1)
|
2016-09-22 22:57:30 +00:00
|
|
|
min30000=$(parallel measure {} 100000 ::: 30000 30000 30000 |
|
2016-08-14 14:54:27 +00:00
|
|
|
sort -n | head -n 1)
|
|
|
|
if [ $max1000 -gt $min30000 ] ; then
|
2016-08-21 13:37:59 +00:00
|
|
|
# Make sure there are a few sleeps
|
2016-09-22 22:57:30 +00:00
|
|
|
max1000=$(parallel measure {} 100 ::: 1000 1000 1000 1000 1000 1000 1000 1000 |
|
2016-08-14 14:54:27 +00:00
|
|
|
sort -n | tail -n 1)
|
2016-09-22 22:57:30 +00:00
|
|
|
min30000=$(parallel measure {} 100 ::: 30000 30000 30000 |
|
2016-08-14 14:54:27 +00:00
|
|
|
sort -n | head -n 1)
|
|
|
|
if [ $max1000 -gt $min30000 ] ; then
|
|
|
|
echo $max1000 -gt $min30000 = no leak
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
echo not $max1000 -gt $min30000 = possible leak
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo not $max1000 -gt $min30000 = possible leak
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
export -f no_mem_leak
|
|
|
|
|
|
|
|
par_mem_leak() {
|
|
|
|
echo "### test for mem leak"
|
|
|
|
if no_mem_leak >/dev/null ; then
|
|
|
|
echo no mem leak detected
|
|
|
|
else
|
|
|
|
echo possible mem leak;
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-07-10 21:00:20 +00:00
|
|
|
export -f $(compgen -A function | grep par_)
|
|
|
|
compgen -A function | grep par_ | sort | parallel -vj0 -k --tag --joblog /tmp/jl-`basename $0` '{} 2>&1'
|