-
Notifications
You must be signed in to change notification settings - Fork 7
/
mfaktc.sh
executable file
·70 lines (56 loc) · 1.43 KB
/
mfaktc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# by teknohog
# Automatic work assignment for mfaktc
# https://www.rieselprime.de/ziki/Mfaktc
# https://www.mersenneforum.org/mfaktc/
# mfloop.py was originally written for mfakto, and they can run in
# parallel with the use of lockfiles. However, mfaktc does not use
# lockfiles, so we need to run them one after the other, using the -t
# 0 option to avoid looping in mfloop.py.
LOOP="mfloop.py"
BASEDIR=~/sources/mfaktc-0.21
FACT="mfaktc.exe"
#BASEOPTS="-u teknohog -p 12345 -d"
#WORKOPTS="-n 1" # Default: let Primenet decide
#WORKOPTS="-n 1 -W 3" # First time TF
# Prefer gpu72.com work assignments; 72 is hardcoded minimum, but a
# lower -e still works for the Primenet fallback
BASEOPTS="-u teknohog -p 12345 -U teknohog -P hunter2 -d"
WORKOPTS="-n 1 -e 72"
# Defaults
DEVICE=0
FLUSH=false
ONESHOT=false
while getopts 1d:f opt; do
case $opt in
1)
ONESHOT=true
;;
d)
DEVICE=$OPTARG
;;
f)
FLUSH=true
;;
esac
done
cd $BASEDIR
# mfloop.py lockfiles may be left over after crashes
rm *.txt.lck
if $ONESHOT; then
# 2020-09-02 Fetch, process and send one batch of work
$LOOP $BASEOPTS $WORKOPTS -t 0
FLUSH=true
fi
if $FLUSH; then
# Complete current work and submit results only at the end
./$FACT -d $DEVICE
$LOOP $BASEOPTS -n 0 -t 0
else
while true; do
$LOOP $BASEOPTS $WORKOPTS -t 0
./$FACT -d $DEVICE
# Some wait time is useful in case of errors
sleep 5
done
fi