Used bc command in Linux Debian

Questions and Answers : Unix/Linux : Used bc command in Linux Debian
Message board moderation

To post messages, you must log in.

AuthorMessage
Crystal Pellet

Send message
Joined: 26 Oct 20
Posts: 53
Credit: 2,520,836
RAC: 0
Message 129 - Posted: 15 Nov 2020, 14:52:35 UTC

The bc command that's used in get_fraction_done is not default installed in Linux Debian.

Echo every 10 seconds to stderr: get_fraction_done: 1: get_fraction_done: bc: not found
No influence on the task outcome, but probably in the progress bar of the task during crunching.
ID: 129 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
hoarfrost
Volunteer moderator
Project administrator
Project developer

Send message
Joined: 11 Oct 20
Posts: 323
Credit: 22,885,130
RAC: 12,001
Message 143 - Posted: 16 Nov 2020, 21:03:26 UTC - in response to Message 129.  
Last modified: 16 Nov 2020, 21:22:07 UTC

The bc command that's used in get_fraction_done is not default installed in Linux Debian.

Could you try to change lines

fraction=`echo "scale=2; $NDOCKED/$NLIGANDS" | bc`
printf "%.3f\n" $fraction > $3

by

fraction=$(echo "$NDOCKED $NLIGANDS" | awk '{ docked = 0.0 + $1; total = 0.0 + $2; fraction = docked / total; printf("%.3f\n", fraction); }')
echo $fraction > $3

?
ID: 143 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Crystal Pellet

Send message
Joined: 26 Oct 20
Posts: 53
Credit: 2,520,836
RAC: 0
Message 144 - Posted: 16 Nov 2020, 21:30:10 UTC - in response to Message 143.  

Sorry, that Debian VM is destroyed, but there are some other Debian hosts connected to this project.
Maybe one of those users is reading this and could try it, else I could give it a try tomorrow with a new Debian-VM and with my low Linux skills.

When changing a file within BOINC when has to disable file size check in BOINC's cc_config.xml.
ID: 144 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Crystal Pellet

Send message
Joined: 26 Oct 20
Posts: 53
Credit: 2,520,836
RAC: 0
Message 145 - Posted: 17 Nov 2020, 10:34:21 UTC - in response to Message 143.  

Could you try to change lines
.
.
.
?
I did and your proposed lines seems to be successful.
I got an error message in BOINC's event log:
sidocktest 17 Nov 11:14:39 [error] merge_info(): failed to change permissions of get_fraction_done_11.8_x86_64-pc-linux-gnu.sh
Probably because I changed the file as root, but it's working.

In the original version fraction_done stayed 0.000 and a lots of errors in stderr.txt https://fightcovid.boinc.ru/sidocktest/result.php?resultid=404437

In the modified version fraction_done is increasing (now 0.258). In BOINC Manager 25.8% progress.
The task is still busy. When ready you can see the result https://fightcovid.boinc.ru/sidocktest/result.php?resultid=405395
ID: 145 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Profile Natalia
Volunteer moderator
Project administrator
Project developer
Project scientist

Send message
Joined: 9 Oct 20
Posts: 181
Credit: 2,689,264
RAC: 449
Message 147 - Posted: 17 Nov 2020, 11:32:51 UTC - in response to Message 145.  

The task has finished successfully. Thank you for testing! We updated the application script.
ID: 147 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
smoe

Send message
Joined: 25 Dec 20
Posts: 4
Credit: 26,851,740
RAC: 21,216
Message 897 - Posted: 9 May 2021, 17:55:07 UTC - in response to Message 147.  

Hey,

It gets just a bit better. Since NDOCK and NLIGANDS are both integers, say

NDOCKED=4
NLIGANDS=17

please change the line to

printf "%.3f\n" $(($NDOCKED*1000/$NLIGANDS))e-3 > $3

which then gives you (for above setting, obviously)

0.235

without invoking any other binaries. "awk" is indeed installed almost everywhere, but, someone may not have the symlink from awk to gawk or ... whatever. Thanks go to https://www.shell-tips.com/bash/math-arithmetic-calculation/ for pointing me to this alternative.

Best wishes,
Steffen
ID: 897 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote
Profile Natalia
Volunteer moderator
Project administrator
Project developer
Project scientist

Send message
Joined: 9 Oct 20
Posts: 181
Credit: 2,689,264
RAC: 449
Message 899 - Posted: 10 May 2021, 6:20:41 UTC - in response to Message 897.  

Dear Steffen,

we don't use the script get_fraction_done anymore, but thank you for the point. We might return to the script later.
ID: 899 · Rating: 0 · rate: Rate + / Rate - Report as offensive     Reply Quote

Questions and Answers : Unix/Linux : Used bc command in Linux Debian

©2024 SiDock@home Team