Caffe2 - C++ API
A deep learning, cross platform ML framework
init_denormals.cc
1 #if defined(__SSE3__)
2 
3 #include <immintrin.h>
4 
5 #include "caffe2/core/common.h"
6 #include "caffe2/core/init.h"
7 
8 C10_DEFINE_int(
9  caffe2_ftz,
10  false,
11  "If true, turn on flushing denormals to zero (FTZ)");
12 C10_DEFINE_int(
13  caffe2_daz,
14  false,
15  "If true, turn on replacing denormals loaded from memory with zero (DAZ)");
16 
17 namespace caffe2 {
18 
19 bool Caffe2SetDenormals(int*, char***) {
20  if (FLAGS_caffe2_ftz) {
21  VLOG(1) << "Setting FTZ";
22  _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
23  }
24  if (FLAGS_caffe2_daz) {
25  VLOG(1) << "Setting DAZ";
26  _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
27  }
28  return true;
29 }
30 
31 REGISTER_CAFFE2_INIT_FUNCTION(
32  Caffe2SetDenormals,
33  &Caffe2SetDenormals,
34  "Set denormal settings.");
35 
36 } // namespace caffe2
37 
38 #endif
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13