How to disable SSE4.1 when compiling TensorFlow?

2,837 views
Skip to first unread message

baox...@gmail.com

unread,
Jan 4, 2017, 10:48:36 PM1/4/17
to Discuss
Hello guys,

I followed the instruction on TF's website and install the TensorFlow from the source code. I did not change any configurations, all are the default values.

When I run my program (which works fine when using the pre-complied TensorFlow 0.12 wheel), it gives me the following error

F tensorflow/core/platform/cpu_feature_guard.cc:86] The TensorFlow library was compiled to use SSE4.1 instructions, but these aren't available on your machine.

By default TensorFlow enables SSE4 support, I guess there is a way to disable it? It would be good if I could use SSE4a instead or use SSE2. Thanks for any inputs.

By the way I also tried `$ bazel build --copt=-march=native -c opt //tensorflow/tools/pip_package:build_pip_package` with no luck.

Here are the `/proc/cpuinfo` in case you are interested.


processor : 57

vendor_id : AuthenticAMD

cpu family : 6

model : 13

model name : QEMU Virtual CPU version (cpu64-rhel6)

stepping : 3

microcode : 0x1000065

cpu MHz : 2400.028

cache size : 512 KB

physical id : 57

siblings : 1

core id : 0

cpu cores : 1

apicid : 57

initial apicid : 57

fpu : yes

fpu_exception : yes

cpuid level : 4

wp : yes

flags : fpu de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl pni cx16 hypervisor lahf_lm abm sse4a vmmcall

bogomips : 4800.05

TLB size : 1024 4K pages

clflush size : 64

cache_alignment : 64

address sizes : 48 bits physical, 48 bits virtual

power management:


Thanks!

Martin Wicke

unread,
Jan 4, 2017, 11:47:04 PM1/4/17
to baox...@gmail.com, Discuss
This is interesting. Since you use -march=native, it should compile with the optimizations available on your machine. You can try removing that flag, which should remove any optimization (you can add them back manually) just to make sure you're actually running the binary you've compiled.

--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+unsubscribe@tensorflow.org.
To post to this group, send email to dis...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/d415c040-2398-4e97-b2fd-06a6ef156fa8%40tensorflow.org.

Derek Murray

unread,
Jan 5, 2017, 12:11:29 AM1/5/17
to Discuss, baox...@gmail.com
I posted an answer on Stack Overflow: http://stackoverflow.com/a/41477681/3574081

--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@tensorflow.org.

baox...@gmail.com

unread,
Jan 5, 2017, 10:26:37 AM1/5/17
to Discuss, baox...@gmail.com
Hi @Derek, thanks for the reply! It solved my problem.

@Martin, As @Derek points out in https://github.com/tensorflow/tensorflow/blob/c4b09b5df79625a70853fd66b5caa7dd92fb4d1f/tensorflow/tensorflow.bzl#L130, the SSE4.1 support is enabled for all X86 platforms, would it be a good idea to let TF checks the CPU first then set -msse4,1 accordingly? 

Best,

Pete Warden

unread,
Jan 5, 2017, 11:43:55 AM1/5/17
to baox...@gmail.com, Discuss
We have some documentation on this here:

Unfortunately it hasn't made it to the website yet.

To unsubscribe from this group and stop receiving emails from it, send an email to discuss+unsubscribe@tensorflow.org.

To post to this group, send email to dis...@tensorflow.org.
Reply all
Reply to author
Forward
0 new messages