-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Check for AVX instruction set during install for Precise compatibility #2269
Conversation
Hello @mathmauney! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2019-08-29 15:40:55 UTC |
Hello, @mathmauney, thank you for helping with the Mycroft project! We welcome everyone To protect yourself, the project, and users of Mycroft technologies we require Please visit https://mycroft.ai/cla to initiate this one-time signing. Thank |
Currently waiting on my CLA form. Sorry about the line too long error, I disabled those in my PEP |
dev_setup.sh
Outdated
@@ -137,6 +137,22 @@ This script is designed to make working with Mycroft easy. During this | |||
first run of dev_setup we will ask you a few questions to help setup | |||
your environment.' | |||
sleep 0.5 | |||
if ! grep -q avx /proc/cpuinfo; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this condition apply to the ARM platform as well? Since we have a precise build for that platform it might need to be excluded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know about the ARM exception. Looks like that can be easily checked with $(uname -m) == 'arm'* so I've added that to the logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not easy to know :)
That looks like a good solution, great work with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, we had some chat about this on the Forums. According to @domcross the ARM equivalent is called SIMD (Single Instruction, Multiple Data) and is available since ARMv7 (which includes the Cortex A53 used by the RaspberryPi and the Cortex A7 from the OrangePi).
Is it worth checking for SIMD on ARM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arm equivalents seem to have a bunch of different names. on the Pi it's neon and on the H64 it's called asimd so it might not be trivial to do a correct general check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good to know, ignore me then :)
I think there's much less presumption that it will work on random ARM hardware anyway.
@@ -326,6 +332,10 @@ def initialize(): | |||
hotword, module | |||
)) | |||
instance = None | |||
except PreciseUnavailable: | |||
LOG.warning('Settings prevent Precise Engine use, | |||
falling back to default.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this multiline string doesn't seem to be valid. I suggest using
LOG.warning('Settings prevent Precise Engine use, '
'falling back to default.')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, thought that was what I changed it to already. Should be fixed now.
Fix long line string
CLA has been submitted |
dev_setup.sh
Outdated
Y)es, I want to use the PocketSphinx engine or my own. | ||
N)o, stop the installation." | ||
if get_YN ; then | ||
sed -i "s/\"use_precise\": true/\"use_precise\": false/" config/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this sed line correct?
I get
sed: can't read config/: No such file or directory
Not sure which config you intend to edit here but you should probably make the adjustments in the ~/.mycroft/mycroft.conf
config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah that's where I had a test copy of a .conf.
It looks like there isn't any automatically generated one so we would have to deal with that.
Would the system level one be a better spot since you either will or will not have AVX for the entire system rather than at a user level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed might be better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok that should be done, it worked when I tested on a new system if I forced it to take that path. I don't have any machines that aren't ARM or AVX-compatible to really test on though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there, sorry this dropped off my radar for a bit. It's a great addition though.
What do you think about the following?
if [[ ! -e /etc/mycroft/ ]]; then | ||
$SUDO mkdir /etc/mycroft | ||
fi | ||
$SUDO cp $TOP/mycroft/configuration/mycroft.conf /etc/mycroft/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to copy the default config across?
The default config will be used in its current location, and a config at /etc/mycroft/mycroft.conf
would override it, (details here in our docs).
So wondering if we:
- create the directory
- create an empty json file if it doesn't exist
- use jq to add/update the specific value
jq -c '. + { "use_precise": true }' mycroft.conf > tmp.$$.conf && mv tmp.$$.conf mycroft.conf
if [[ ! -e /etc/mycroft/ ]]; then | ||
$SUDO mkdir /etc/mycroft | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPTIONAL
For creating the directory, personally I use mkdir -p
instead of using a conditional. So these 3 lines could be simplified to:
$SUDO mkdir -p /etc/mycroft
Closing in favor of #2910 |
Description
(Description of what the PR does, such as fixes # {issue number})
Check for AVX instruction set during install and warns the user that the Precise Engine will not be supported.
How to test
(Description of how to validate or test this PR)
Run installer on a machine that does not support AVX
Contributor license agreement signed?
CLA [ ] (Whether you have signed a CLA - Contributor Licensing Agreement