1

I'm using Tensorflow 1.9.0 version which is built with AVX support, but when I'm packaging the project into an EXE and testing on another machine it crashes due to not having AVX support on this machine. so I revert back to Tensorflow 1.5 and it worked fine. Now the question is can I switch to the desired Tensorflow version after detecting the AVX support in machine dynamically (on run time).

I don't know how to switch version so didn't try but I'm detecting the AVX support. like this

>>> import cpuinfo
>>> cpuinfo.get_cpu_info()
{'python_version': '3.6.5.final.0 (64 bit)', 
'cpuinfo_version': [5, 0, 0], 'arch': 'X86_64', 'bits': 64, 'count': 4, 'raw_arch_string': 'AMD64', 'vendor_id': 'GenuineIntel', 
'brand': 'Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz', 'hz_advertised': '2.3000 GHz', 'hz_actual': '1.6000 GHz', 'hz_advertised_raw': [2300000000, 0], 'hz_actual_raw': [1600000000, 0], 'l2_cache_size': '512 KB', 'stepping': 7, 'model': 42, 'family': 6, 'l3_cache_size': '3072 KB', 
'flags': ['acpi', 'apic', 'avx', 'clflush', 'cmov', 'cx16', 'cx8', 'de', 'ds_cpl', 'dtes64', 'dts', 'est', 'fpu', 'fxsr', 'ht', 'ia64', 'lahf_lm', 'mca', 'mce', 'mmx', 'monitor', 'msr', 'mtrr', 'osxsave', 'pae', 'pat', 'pbe', 'pcid', 'pclmulqdq', 'pdcm', 'pge', 'pni', 'popcnt', 'pse', 'pse36', 'sep', 'serial', 'ss', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'ssse3', 'tm', 'tm2', 'tsc', 'tscdeadline', 'vme', 'vmx', 'x2apic', 'xsave', 'xtpr'], 
'l2_cache_line_size': 6, 'l2_cache_associativity': '0x100', 'extended_model': 2}

I want to package both (AVX support and unsupported) versions in same EXE and use it according to the needs. Any other suggestions are welcomed. Thanks

1 Answers1

0

Your question contains part of the answer. From cpuinfo.get_cpu_info(), you will get whether AVX is supported or not(mentioned in 'flags'). Accordingly, you can install the required packages inside the python code itself( Refer Installing python module within code for details).

Alternatively, you can do the same thing from terminal. grep flags /proc/cpuinfo will give you flags supported. Depending on if avx is there or not, create a script to install tensorflow of the appropriate version

Lakshmi - Intel
  • 581
  • 3
  • 10
  • Your auto installation process is for the code segment which is executed through command line. But I want it should install the package after build into an executable. I'm using pyinstaller to build exe. – Arham Aalam Ansari May 25 '19 at 12:28