Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document where to find tensorflow for older (non AVX) CPUs #44

Open
mad-ady opened this issue Sep 29, 2020 · 5 comments
Open

Document where to find tensorflow for older (non AVX) CPUs #44

mad-ady opened this issue Sep 29, 2020 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@mad-ady
Copy link

mad-ady commented Sep 29, 2020

I'm trying to run this project on a J4105 Gemini Lake Celeron CPU (an Odroid H2), running Ubuntu 20.04, but I think I'm failing because of the lack of AVX instruction set.

teo@lego:~/Stuff/virtual_webcam_background$ ./virtual_webcam.py 
Illegal instruction (core dumped)
teo@lego:~/Stuff/virtual_webcam_background$ cat /proc/cpuinfo 
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 122
model name	: Intel(R) Celeron(R) J4105 CPU @ 1.50GHz
stepping	: 1
microcode	: 0x32
cpu MHz		: 1634.384
cache size	: 4096 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 4
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 24
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave rdrand lahf_lm 3dnowprefetch cpuid_fault cat_l2 pti cdp_l2 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust smep erms mpx rdt_a rdseed smap clflushopt intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts umip rdpid md_clear arch_capabilities
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass
bogomips	: 2995.20
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 122
model name	: Intel(R) Celeron(R) J4105 CPU @ 1.50GHz
stepping	: 1
microcode	: 0x32
cpu MHz		: 1513.849
cache size	: 4096 KB
physical id	: 0
siblings	: 4
core id		: 1
cpu cores	: 4
apicid		: 2
initial apicid	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 24
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave rdrand lahf_lm 3dnowprefetch cpuid_fault cat_l2 pti cdp_l2 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust smep erms mpx rdt_a rdseed smap clflushopt intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts umip rdpid md_clear arch_capabilities
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass
bogomips	: 2995.20
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 2
vendor_id	: GenuineIntel
cpu family	: 6
model		: 122
model name	: Intel(R) Celeron(R) J4105 CPU @ 1.50GHz
stepping	: 1
microcode	: 0x32
cpu MHz		: 1481.128
cache size	: 4096 KB
physical id	: 0
siblings	: 4
core id		: 2
cpu cores	: 4
apicid		: 4
initial apicid	: 4
fpu		: yes
fpu_exception	: yes
cpuid level	: 24
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave rdrand lahf_lm 3dnowprefetch cpuid_fault cat_l2 pti cdp_l2 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust smep erms mpx rdt_a rdseed smap clflushopt intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts umip rdpid md_clear arch_capabilities
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass
bogomips	: 2995.20
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

processor	: 3
vendor_id	: GenuineIntel
cpu family	: 6
model		: 122
model name	: Intel(R) Celeron(R) J4105 CPU @ 1.50GHz
stepping	: 1
microcode	: 0x32
cpu MHz		: 1505.700
cache size	: 4096 KB
physical id	: 0
siblings	: 4
core id		: 3
cpu cores	: 4
apicid		: 6
initial apicid	: 6
fpu		: yes
fpu_exception	: yes
cpuid level	: 24
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave rdrand lahf_lm 3dnowprefetch cpuid_fault cat_l2 pti cdp_l2 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust smep erms mpx rdt_a rdseed smap clflushopt intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts umip rdpid md_clear arch_capabilities
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass
bogomips	: 2995.20
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:


teo@lego:~/Stuff/virtual_webcam_background$ gdb --args python3 virtual_webcam.py
GNU gdb (Ubuntu 9.1-0ubuntu1) 9.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3...
(No debugging symbols found in python3)
(gdb) run
Starting program: /usr/bin/python3 virtual_webcam.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0x00007ffff1b7bb70 in nsync::nsync_mu_init(nsync::nsync_mu_s_*) () from /usr/local/lib/python3.8/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so

layout asm:
  >0x7ffff1b7bb70 <_ZN5nsync13nsync_mu_initEPNS_11nsync_mu_s_E>                                            vpxor  %xmm0,%xmm0,%xmm0

vpxor belongs to the AVX instruction set and can't run.

So - can I get a tensorflow library that doesn't need AVX? Or can I run it through QEMU or something that can emulate AVX?

Thanks

@allo-
Copy link
Owner

allo- commented Sep 29, 2020

Please have a look into tensorflow docs and support forums or on Stackoverflow.
You seem to have the wrong binary for your machine, but I cannot tell more without reading the tensorflow support forums either.

@allo- allo- closed this as completed Sep 29, 2020
@allo- allo- added the invalid This doesn't seem right label Sep 29, 2020
@mad-ady
Copy link
Author

mad-ady commented Sep 30, 2020

I agree, it's not an issue with this project.
However, for people with weaker CPUs here's the solution:
I've installed tensorflow library from here: yaroslavvb/tensorflow-community-wheels#158:

wget https://github.com/agkphysics/tensorflow-wheels/releases/download/tf_2.4.0_nogpu_noavx_nomkl/tensorflow_cpu-2.4.0-cp38-cp38-linux_x86_64.whl
sudo pip3 install --upgrade tensorflow_cpu-2.4.0-cp38-cp38-linux_x86_64.whl

This replaced the stock tensorflow-cpu python library with the custom built one. Now virtual_webcam_background works well (about 5 fps, 70% CPU usage, 4 cores) and my kid is happy :D

@allo-
Copy link
Owner

allo- commented Sep 30, 2020

Thank you for the feedback! We'll document your solution.

@allo- allo- reopened this Sep 30, 2020
@allo- allo- changed the title Illegal instruction on non AVX CPU (Gemini Lake) Document where to find tensorflow for older (non AVX) CPUs Sep 30, 2020
@mad-ady
Copy link
Author

mad-ady commented Sep 30, 2020

If there is a FAQ there should be a mention about the Illegal Instruction error that you get when you start the python code - that's how I learned my CPU doesn't do AVX. Only then you need to find the alternate tensorflow package.

@allo-
Copy link
Owner

allo- commented Sep 30, 2020

There is only the README, the wiki and the website for this project.

I am not sure what's the goal for this project. I guess currently the installation requires quite a bit of expert knowledge (at least in the sense of being able to use the shell) anyway. When there would be a nice UI, it should also try to guide the user to install the right tensorflow (CPU/GPU/Builds for older CPUs).

@allo- allo- added documentation Improvements or additions to documentation and removed invalid This doesn't seem right labels May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants