CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edm::service::EnableFloatingPointExceptions Class Reference

#include <EnableFloatingPointExceptions.h>

Public Types

typedef int fpu_flags_type
 

Public Member Functions

 EnableFloatingPointExceptions (ParameterSet const &pset, ActivityRegistry &registry)
 
void postEndJob ()
 
void postModuleBeginJob (ModuleDescription const &)
 
void postModuleBeginStream (StreamContext const &, ModuleCallingContext const &)
 
void postModuleConstruction (ModuleDescription const &)
 
void postModuleEndJob (ModuleDescription const &md)
 
void postModuleEndStream (StreamContext const &, ModuleCallingContext const &)
 
void postModuleEvent (StreamContext const &, ModuleCallingContext const &)
 
void postModuleGlobalBeginLumi (GlobalContext const &, ModuleCallingContext const &)
 
void postModuleGlobalBeginRun (GlobalContext const &, ModuleCallingContext const &)
 
void postModuleGlobalEndLumi (GlobalContext const &, ModuleCallingContext const &)
 
void postModuleGlobalEndRun (GlobalContext const &, ModuleCallingContext const &)
 
void postModuleStreamBeginLumi (StreamContext const &, ModuleCallingContext const &)
 
void postModuleStreamBeginRun (StreamContext const &, ModuleCallingContext const &)
 
void postModuleStreamEndLumi (StreamContext const &, ModuleCallingContext const &)
 
void postModuleStreamEndRun (StreamContext const &, ModuleCallingContext const &)
 
void preModuleBeginJob (ModuleDescription const &)
 
void preModuleBeginStream (StreamContext const &, ModuleCallingContext const &)
 
void preModuleConstruction (ModuleDescription const &)
 
void preModuleEndJob (ModuleDescription const &md)
 
void preModuleEndStream (StreamContext const &, ModuleCallingContext const &)
 
void preModuleEvent (StreamContext const &, ModuleCallingContext const &)
 
void preModuleGlobalBeginLumi (GlobalContext const &, ModuleCallingContext const &)
 
void preModuleGlobalBeginRun (GlobalContext const &, ModuleCallingContext const &)
 
void preModuleGlobalEndLumi (GlobalContext const &, ModuleCallingContext const &)
 
void preModuleGlobalEndRun (GlobalContext const &, ModuleCallingContext const &)
 
void preModuleStreamBeginLumi (StreamContext const &, ModuleCallingContext const &)
 
void preModuleStreamBeginRun (StreamContext const &, ModuleCallingContext const &)
 
void preModuleStreamEndLumi (StreamContext const &, ModuleCallingContext const &)
 
void preModuleStreamEndRun (StreamContext const &, ModuleCallingContext const &)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void echoState () const
 
void enableAndDisableExcept (fpu_flags_type target)
 
void establishModuleEnvironments (ParameterSet const &)
 
void postActions (ModuleDescription const &, char const *debugInfo)
 
void postActions (ModuleCallingContext const &, char const *debugInfo)
 
void preActions (ModuleDescription const &, char const *debugInfo)
 
void preActions (ModuleCallingContext const &, char const *debugInfo)
 
void setPrecision (bool precisionDouble)
 

Private Attributes

fpu_flags_type defaultState_
 
bool reportSettings_
 
std::map< std::string,
fpu_flags_type
stateMap_
 

Detailed Description

Description: This service gives cmsRun users the ability to configure the behavior of the Floating Point (FP) environment. There are two separate aspects of the FP environment this service can control:

1. floating-point exceptions (on a module by module basis if desired)
2. precision control on x87 FP processors (obsolete for 64 bit x86_64)

If you do not use the service at all, floating point exceptions will not be trapped anywhere (FP exceptions will not cause a crash). Add something like the following to the configuration file to enable to the exceptions:

process.EnableFloatingPointExceptions = cms.Service("EnableFloatingPointExceptions", moduleNames = cms.untracked.vstring( 'default', 'sendMessages1', 'sendMessages2' ), default = cms.untracked.PSet( enableOverFlowEx = cms.untracked.bool(False), enableDivByZeroEx = cms.untracked.bool(False), enableInvalidEx = cms.untracked.bool(False), enableUnderFlowEx = cms.untracked.bool(False) ), sendMessages1 = cms.untracked.PSet( enableOverFlowEx = cms.untracked.bool(False), enableDivByZeroEx = cms.untracked.bool(True), enableInvalidEx = cms.untracked.bool(False), enableUnderFlowEx = cms.untracked.bool(False) ), sendMessages2 = cms.untracked.PSet( enableOverFlowEx = cms.untracked.bool(False), enableDivByZeroEx = cms.untracked.bool(False), enableInvalidEx = cms.untracked.bool(True), enableUnderFlowEx = cms.untracked.bool(False) ) )

In this example, the "Divide By Zero" exception is enabled only for the module with label "sendMessages1", the "Invalid" exception is enabled only for the module with label sendMessages2 and no floating point exceptions are otherwise enabled.

The defaults for these options are currently all false. (in an earlier version DivByZero, Invalid, and Overflow defaulted to true, we hope to return to those defaults someday when the frequency of such exceptions has decreased)

Enabling exceptions is very useful if you are trying to track down where a floating point value of 'nan' or 'inf' is being generated and is even better if the goal is to eliminate them.

Warning. The flags that control the behavior of floating point are globally available. Anything could potentially change them at any point in time, including the module itself and third party code that module calls. In a threading environment if the module waits in the middle of execution and others tasks run on the same thread, they could potentially change the behavior. Also if the module internally creates tasks that run on other threads those will run with whatever settings are on that thread unless special code has been written in the module to set the floating point exception control flags.

Note that we did tests to determine that the floating point exception control of feenableexcept was thread local and therefore could be use with the multithreaded framework. Although the functions in fenv.h that are part of the standard are required to be thread local, we were unable to find any documentation about this for feenableexcept which is an extension of the GCC compiler. Hopefully our test on one machine can be safely extrapolated to all machines ...

Precision control is obsolete in x86_64 architectures and other architectures CMS currently uses (maybe we should remove this part of the service). It has no effect. The x86_64 architecture uses SSE for floating point calculations, not x87. SSE always uses 64 bit precision. Precision control works for x87 floating point calculations as follows:

process.EnableFloatingPointExceptions = cms.Service("EnableFloatingPointExceptions", setPrecisionDouble = cms.untracked.bool(True) )

If set true (the default if the service is used), the floating precision in the x87 math processor will be set to round results of addition, subtraction, multiplication, division, and square root to 64 bits after each operation instead of the x87 default, which is 80 bits for values in registers (this is the default you get if this service is not used at all).

The precision control only affects Intel and AMD 32 bit CPUs under LINUX. We have not implemented precision control in the service for other CPUs. (most other CPUs round to 64 bits by default and/or do not allow control of the precision of floating point calculations).

Definition at line 120 of file EnableFloatingPointExceptions.h.

Member Typedef Documentation

Definition at line 123 of file EnableFloatingPointExceptions.h.

Constructor & Destructor Documentation

edm::service::EnableFloatingPointExceptions::EnableFloatingPointExceptions ( ParameterSet const &  pset,
ActivityRegistry registry 
)

Definition at line 79 of file EnableFloatingPointExceptions.cc.

References defaultState_, echoState(), enableAndDisableExcept(), establishModuleEnvironments(), edm::ParameterSet::getUntrackedParameter(), postEndJob(), postModuleBeginJob(), postModuleBeginStream(), postModuleConstruction(), postModuleEndJob(), postModuleEndStream(), postModuleEvent(), postModuleGlobalBeginLumi(), postModuleGlobalBeginRun(), postModuleGlobalEndLumi(), postModuleGlobalEndRun(), postModuleStreamBeginLumi(), postModuleStreamBeginRun(), postModuleStreamEndLumi(), postModuleStreamEndRun(), preModuleBeginJob(), preModuleBeginStream(), preModuleConstruction(), preModuleEndJob(), preModuleEndStream(), preModuleEvent(), preModuleGlobalBeginLumi(), preModuleGlobalBeginRun(), preModuleGlobalEndLumi(), preModuleGlobalEndRun(), preModuleStreamBeginLumi(), preModuleStreamBeginRun(), preModuleStreamEndLumi(), preModuleStreamEndRun(), reportSettings_, setPrecision(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModuleBeginJob(), edm::ActivityRegistry::watchPostModuleBeginStream(), edm::ActivityRegistry::watchPostModuleConstruction(), edm::ActivityRegistry::watchPostModuleEndJob(), edm::ActivityRegistry::watchPostModuleEndStream(), edm::ActivityRegistry::watchPostModuleEvent(), edm::ActivityRegistry::watchPostModuleGlobalBeginLumi(), edm::ActivityRegistry::watchPostModuleGlobalBeginRun(), edm::ActivityRegistry::watchPostModuleGlobalEndLumi(), edm::ActivityRegistry::watchPostModuleGlobalEndRun(), edm::ActivityRegistry::watchPostModuleStreamBeginLumi(), edm::ActivityRegistry::watchPostModuleStreamBeginRun(), edm::ActivityRegistry::watchPostModuleStreamEndLumi(), edm::ActivityRegistry::watchPostModuleStreamEndRun(), edm::ActivityRegistry::watchPreModuleBeginJob(), edm::ActivityRegistry::watchPreModuleBeginStream(), edm::ActivityRegistry::watchPreModuleConstruction(), edm::ActivityRegistry::watchPreModuleEndJob(), edm::ActivityRegistry::watchPreModuleEndStream(), edm::ActivityRegistry::watchPreModuleEvent(), edm::ActivityRegistry::watchPreModuleGlobalBeginLumi(), edm::ActivityRegistry::watchPreModuleGlobalBeginRun(), edm::ActivityRegistry::watchPreModuleGlobalEndLumi(), edm::ActivityRegistry::watchPreModuleGlobalEndRun(), edm::ActivityRegistry::watchPreModuleStreamBeginLumi(), edm::ActivityRegistry::watchPreModuleStreamBeginRun(), edm::ActivityRegistry::watchPreModuleStreamEndLumi(), and edm::ActivityRegistry::watchPreModuleStreamEndRun().

80  :
81  defaultState_(0),
82  stateMap_(),
83  reportSettings_(false) {
84 
85  reportSettings_ = pset.getUntrackedParameter<bool>("reportSettings", false);
86  bool precisionDouble = pset.getUntrackedParameter<bool>("setPrecisionDouble", true);
87 
88  if(reportSettings_) {
89  LogVerbatim("FPE_Enable") << "\nSettings in EnableFloatingPointExceptions constructor";
90  echoState();
91  }
92 
94 
96 
97  setPrecision(precisionDouble);
98 
99  // Note that we must watch all of the transitions even if there are no module specific settings.
100  // This is because the floating point environment may be modified by code outside of this service.
101  registry.watchPostEndJob(this, &EnableFloatingPointExceptions::postEndJob);
102 
103  registry.watchPreModuleBeginStream(this, &EnableFloatingPointExceptions::preModuleBeginStream);
104  registry.watchPostModuleBeginStream(this, &EnableFloatingPointExceptions::postModuleBeginStream);
105 
106  registry.watchPreModuleEndStream(this, &EnableFloatingPointExceptions::preModuleEndStream);
107  registry.watchPostModuleEndStream(this, &EnableFloatingPointExceptions::postModuleEndStream);
108 
109  registry.watchPreModuleConstruction(this, &EnableFloatingPointExceptions::preModuleConstruction);
110  registry.watchPostModuleConstruction(this, &EnableFloatingPointExceptions::postModuleConstruction);
111 
112  registry.watchPreModuleBeginJob(this, &EnableFloatingPointExceptions::preModuleBeginJob);
113  registry.watchPostModuleBeginJob(this, &EnableFloatingPointExceptions::postModuleBeginJob);
114 
115  registry.watchPreModuleEndJob(this, &EnableFloatingPointExceptions::preModuleEndJob);
116  registry.watchPostModuleEndJob(this, &EnableFloatingPointExceptions::postModuleEndJob);
117 
118  registry.watchPreModuleEvent(this, &EnableFloatingPointExceptions::preModuleEvent);
119  registry.watchPostModuleEvent(this, &EnableFloatingPointExceptions::postModuleEvent);
120 
121  registry.watchPreModuleStreamBeginRun(this, &EnableFloatingPointExceptions::preModuleStreamBeginRun);
122  registry.watchPostModuleStreamBeginRun(this, &EnableFloatingPointExceptions::postModuleStreamBeginRun);
123  registry.watchPreModuleStreamEndRun(this, &EnableFloatingPointExceptions::preModuleStreamEndRun);
124  registry.watchPostModuleStreamEndRun(this, &EnableFloatingPointExceptions::postModuleStreamEndRun);
125 
126  registry.watchPreModuleStreamBeginLumi(this, &EnableFloatingPointExceptions::preModuleStreamBeginLumi);
127  registry.watchPostModuleStreamBeginLumi(this, &EnableFloatingPointExceptions::postModuleStreamBeginLumi);
128  registry.watchPreModuleStreamEndLumi(this, &EnableFloatingPointExceptions::preModuleStreamEndLumi);
129  registry.watchPostModuleStreamEndLumi(this, &EnableFloatingPointExceptions::postModuleStreamEndLumi);
130 
131  registry.watchPreModuleGlobalBeginRun(this, &EnableFloatingPointExceptions::preModuleGlobalBeginRun);
132  registry.watchPostModuleGlobalBeginRun(this, &EnableFloatingPointExceptions::postModuleGlobalBeginRun);
133  registry.watchPreModuleGlobalEndRun(this, &EnableFloatingPointExceptions::preModuleGlobalEndRun);
134  registry.watchPostModuleGlobalEndRun(this, &EnableFloatingPointExceptions::postModuleGlobalEndRun);
135 
136  registry.watchPreModuleGlobalBeginLumi(this, &EnableFloatingPointExceptions::preModuleGlobalBeginLumi);
137  registry.watchPostModuleGlobalBeginLumi(this, &EnableFloatingPointExceptions::postModuleGlobalBeginLumi);
138  registry.watchPreModuleGlobalEndLumi(this, &EnableFloatingPointExceptions::preModuleGlobalEndLumi);
139  registry.watchPostModuleGlobalEndLumi(this, &EnableFloatingPointExceptions::postModuleGlobalEndLumi);
140  }
void preModuleGlobalEndLumi(GlobalContext const &, ModuleCallingContext const &)
void preModuleGlobalBeginLumi(GlobalContext const &, ModuleCallingContext const &)
void postModuleGlobalBeginLumi(GlobalContext const &, ModuleCallingContext const &)
void preModuleEvent(StreamContext const &, ModuleCallingContext const &)
void preModuleStreamEndRun(StreamContext const &, ModuleCallingContext const &)
void preModuleStreamEndLumi(StreamContext const &, ModuleCallingContext const &)
void postModuleBeginStream(StreamContext const &, ModuleCallingContext const &)
void preModuleStreamBeginLumi(StreamContext const &, ModuleCallingContext const &)
void postModuleStreamBeginLumi(StreamContext const &, ModuleCallingContext const &)
std::map< std::string, fpu_flags_type > stateMap_
void postModuleGlobalEndLumi(GlobalContext const &, ModuleCallingContext const &)
void postModuleStreamEndLumi(StreamContext const &, ModuleCallingContext const &)
void postModuleStreamBeginRun(StreamContext const &, ModuleCallingContext const &)
void postModuleGlobalEndRun(GlobalContext const &, ModuleCallingContext const &)
void preModuleBeginStream(StreamContext const &, ModuleCallingContext const &)
void preModuleEndStream(StreamContext const &, ModuleCallingContext const &)
void postModuleGlobalBeginRun(GlobalContext const &, ModuleCallingContext const &)
void preModuleStreamBeginRun(StreamContext const &, ModuleCallingContext const &)
void postModuleEndStream(StreamContext const &, ModuleCallingContext const &)
void postModuleEvent(StreamContext const &, ModuleCallingContext const &)
void preModuleGlobalBeginRun(GlobalContext const &, ModuleCallingContext const &)
void preModuleGlobalEndRun(GlobalContext const &, ModuleCallingContext const &)
void postModuleStreamEndRun(StreamContext const &, ModuleCallingContext const &)

Member Function Documentation

void edm::service::EnableFloatingPointExceptions::echoState ( ) const
private

Definition at line 580 of file EnableFloatingPointExceptions.cc.

Referenced by EnableFloatingPointExceptions(), establishModuleEnvironments(), postActions(), postEndJob(), and preActions().

580  {
581  feclearexcept(FE_ALL_EXCEPT);
582  fpu_flags_type femask = fegetexcept();
583  LogVerbatim("FPE_Enable") << "Floating point exception mask is "
584  << std::showbase << std::hex << femask;
585 
586  if(femask & FE_DIVBYZERO)
587  LogVerbatim("FPE_Enable") << "\tDivByZero exception is on";
588  else
589  LogVerbatim("FPE_Enable") << "\tDivByZero exception is off";
590 
591  if(femask & FE_INVALID)
592  LogVerbatim("FPE_Enable") << "\tInvalid exception is on";
593  else
594  LogVerbatim("FPE_Enable") << "\tInvalid exception is off";
595 
596  if(femask & FE_OVERFLOW)
597  LogVerbatim("FPE_Enable") << "\tOverFlow exception is on";
598  else
599  LogVerbatim("FPE_Enable") << "\tOverflow exception is off";
600 
601  if(femask & FE_UNDERFLOW)
602  LogVerbatim("FPE_Enable") << "\tUnderFlow exception is on";
603  else
604  LogVerbatim("FPE_Enable") << "\tUnderFlow exception is off";
605  }
void edm::service::EnableFloatingPointExceptions::enableAndDisableExcept ( fpu_flags_type  target)
private

Definition at line 532 of file EnableFloatingPointExceptions.cc.

References cond::rpcobimon::current, and filterCSVwithJSON::target.

Referenced by EnableFloatingPointExceptions(), establishModuleEnvironments(), postActions(), and preActions().

532  {
533  feclearexcept(FE_ALL_EXCEPT);
534  fpu_flags_type current = fegetexcept();
535  fpu_flags_type exceptionsToModify = current ^ target;
536  fpu_flags_type exceptionsToEnable = 0;
537  fpu_flags_type exceptionsToDisable = 0;
538 
539  if(exceptionsToModify & FE_DIVBYZERO) {
540  if(target & FE_DIVBYZERO) {
541  exceptionsToEnable |= FE_DIVBYZERO;
542  }
543  else {
544  exceptionsToDisable |= FE_DIVBYZERO;
545  }
546  }
547  if(exceptionsToModify & FE_INVALID) {
548  if(target & FE_INVALID) {
549  exceptionsToEnable |= FE_INVALID;
550  }
551  else {
552  exceptionsToDisable |= FE_INVALID;
553  }
554  }
555  if(exceptionsToModify & FE_OVERFLOW) {
556  if(target & FE_OVERFLOW) {
557  exceptionsToEnable |= FE_OVERFLOW;
558  }
559  else {
560  exceptionsToDisable |= FE_OVERFLOW;
561  }
562  }
563  if(exceptionsToModify & FE_UNDERFLOW) {
564  if(target & FE_UNDERFLOW) {
565  exceptionsToEnable |= FE_UNDERFLOW;
566  }
567  else {
568  exceptionsToDisable |= FE_UNDERFLOW;
569  }
570  }
571  if(exceptionsToEnable != 0) {
572  feenableexcept(exceptionsToEnable);
573  }
574  if(exceptionsToDisable != 0) {
575  fedisableexcept(exceptionsToDisable);
576  }
577  }
void edm::service::EnableFloatingPointExceptions::establishModuleEnvironments ( ParameterSet const &  pset)
private

Definition at line 144 of file EnableFloatingPointExceptions.cc.

References def, defaultState_, echoState(), enableAndDisableExcept(), flags, edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), reportSettings_, stateMap_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EnableFloatingPointExceptions().

144  {
145 
146  // Scan the module name list and set per-module values. Be careful to treat
147  // any user-specified default first. If there is one, use it to override our default.
148  // Then remove it from the list so we don't see it again while handling everything else.
149 
150  typedef std::vector<std::string> VString;
151 
152  std::string const def("default");
153  ParameterSet const empty_PSet;
154  VString const empty_VString;
155  VString moduleNames = pset.getUntrackedParameter<VString>("moduleNames", empty_VString);
156 
157  for(VString::const_iterator it(moduleNames.begin()), itEnd = moduleNames.end(); it != itEnd; ++it) {
158  ParameterSet const& modulePSet = pset.getUntrackedParameterSet(*it, empty_PSet);
159  bool enableDivByZeroEx = modulePSet.getUntrackedParameter<bool>("enableDivByZeroEx", false);
160  bool enableInvalidEx = modulePSet.getUntrackedParameter<bool>("enableInvalidEx", false);
161  bool enableOverFlowEx = modulePSet.getUntrackedParameter<bool>("enableOverFlowEx", false);
162  bool enableUnderFlowEx = modulePSet.getUntrackedParameter<bool>("enableUnderFlowEx", false);
163 
164  fpu_flags_type flags = 0;
165  if(enableDivByZeroEx) flags |= FE_DIVBYZERO;
166  if(enableInvalidEx) flags |= FE_INVALID;
167  if(enableOverFlowEx) flags |= FE_OVERFLOW;
168  if(enableUnderFlowEx) flags |= FE_UNDERFLOW;
169  enableAndDisableExcept(flags);
170 
171  fpu_flags_type fpuState = fegetexcept();
172  assert(flags == fpuState);
173 
174  if(reportSettings_) {
175  LogVerbatim("FPE_Enable") << "\nSettings for module " << *it;
176  echoState();
177  }
178  if(*it == def) {
179  defaultState_ = fpuState;
180  }
181  else {
182  stateMap_[*it] = fpuState;
183  }
184  }
185  }
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
std::map< std::string, fpu_flags_type > stateMap_
JetCorrectorParameters::Definitions def
Definition: classes.h:6
void edm::service::EnableFloatingPointExceptions::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 366 of file EnableFloatingPointExceptions.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addNode(), edm::ParameterSetDescription::addUntracked(), python.Node::node, edm::ConfigurationDescriptions::setComment(), edm::ParameterSetDescription::setComment(), and edm::ParameterDescriptionNode::setComment().

366  {
368 
369  desc.addUntracked<bool>("reportSettings", false)->setComment(
370  "Log FPE settings at different phases of the job.");
371  desc.addUntracked<bool>("setPrecisionDouble", true)->setComment(
372  "Set the FPU to use double precision");
373 
374  ParameterSetDescription validator;
375  validator.setComment("FPU exceptions to enable/disable for the requested module");
376  validator.addUntracked<bool>("enableDivByZeroEx", false)->setComment(
377  "Enable/disable exception for 'divide by zero'");
378  validator.addUntracked<bool>("enableInvalidEx", false)->setComment(
379  "Enable/disable exception for 'invalid' math operations (e.g. sqrt(-1))");
380  validator.addUntracked<bool>("enableOverFlowEx", false)->setComment(
381  "Enable/disable exception for numeric 'overflow' (value to big for type)");
382  validator.addUntracked<bool>("enableUnderFlowEx", false)->setComment(
383  "Enable/disable exception for numeric 'underflow' (value to small to be represented accurately)");
384 
385  AllowedLabelsDescription<ParameterSetDescription> node("moduleNames", validator, false);
386  node.setComment("Contains the names for PSets where the PSet name matches the label of a module for which you want to modify the FPE");
387  desc.addNode(node);
388 
389  descriptions.add("EnableFloatingPointExceptions", desc);
390  descriptions.setComment("This service allows you to control the FPU and its exceptions on a per module basis.");
391  }
tuple node
Definition: Node.py:50
void setComment(std::string const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void edm::service::EnableFloatingPointExceptions::postActions ( ModuleDescription const &  description,
char const *  debugInfo 
)
private
void edm::service::EnableFloatingPointExceptions::postActions ( ModuleCallingContext const &  mcc,
char const *  debugInfo 
)
private

Definition at line 462 of file EnableFloatingPointExceptions.cc.

References defaultState_, echoState(), enableAndDisableExcept(), edm::ModuleCallingContext::moduleDescription(), edm::ModuleDescription::moduleLabel(), edm::ModuleCallingContext::previousModuleOnThread(), reportSettings_, and stateMap_.

462  {
463 
464  fpu_flags_type fpuState = defaultState_;
465 
466  edm::ModuleCallingContext const* previous_mcc = mcc.previousModuleOnThread();
467  if(previous_mcc) {
468  std::map<std::string, fpu_flags_type>::const_iterator iModule = stateMap_.find(previous_mcc->moduleDescription()->moduleLabel());
469  if(iModule != stateMap_.end()) {
470  fpuState = iModule->second;
471  }
472  }
473  enableAndDisableExcept(fpuState);
474 
475  if(reportSettings_) {
476  LogVerbatim("FPE_Enable")
477  << "\nSettings for module label \""
478  << mcc.moduleDescription()->moduleLabel()
479  << "\" after "
480  << debugInfo;
481  echoState();
482  }
483  }
std::string const & moduleLabel() const
std::map< std::string, fpu_flags_type > stateMap_
ModuleDescription const * moduleDescription() const
ModuleCallingContext const * previousModuleOnThread() const
void edm::service::EnableFloatingPointExceptions::postEndJob ( )

Definition at line 188 of file EnableFloatingPointExceptions.cc.

References echoState(), and reportSettings_.

Referenced by EnableFloatingPointExceptions().

188  {
189 
190  if(reportSettings_) {
191  LogVerbatim("FPE_Enable") << "\nSettings after endJob ";
192  echoState();
193  }
194  }
void edm::service::EnableFloatingPointExceptions::postModuleBeginJob ( ModuleDescription const &  md)

Definition at line 216 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

216  {
217  postActions(md, "beginJob");
218  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleBeginStream ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 240 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

240  {
241  postActions(mcc, "beginStream");
242  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleConstruction ( ModuleDescription const &  md)

Definition at line 204 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

204  {
205  postActions(md, "construction");
206  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleEndJob ( ModuleDescription const &  md)

Definition at line 228 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

228  {
229  postActions(md, "endJob");
230  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleEndStream ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 252 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

252  {
253  postActions(mcc, "endStream");
254  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleEvent ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 360 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

360  {
361  postActions(mcc, "event");
362  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleGlobalBeginLumi ( GlobalContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 288 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

288  {
289  postActions(mcc, "globalBeginLumi");
290  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleGlobalBeginRun ( GlobalContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 264 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

264  {
265  postActions(mcc, "globalBeginRun");
266  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleGlobalEndLumi ( GlobalContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 300 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

300  {
301  postActions(mcc, "globalEndLumi");
302  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleGlobalEndRun ( GlobalContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 276 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

276  {
277  postActions(mcc, "globalEndRun");
278  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleStreamBeginLumi ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 336 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

336  {
337  postActions(mcc, "streamBeginLumi");
338  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleStreamBeginRun ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 312 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

312  {
313  postActions(mcc, "streamBeginRun");
314  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleStreamEndLumi ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 348 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

348  {
349  postActions(mcc, "streamEndLumi");
350  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleStreamEndRun ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 324 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

324  {
325  postActions(mcc, "streamEndRun");
326  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preActions ( ModuleDescription const &  description,
char const *  debugInfo 
)
private

Definition at line 396 of file EnableFloatingPointExceptions.cc.

References defaultState_, echoState(), enableAndDisableExcept(), edm::ModuleDescription::moduleLabel(), reportSettings_, stateMap_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by preModuleBeginJob(), preModuleBeginStream(), preModuleConstruction(), preModuleEndJob(), preModuleEndStream(), preModuleEvent(), preModuleGlobalBeginLumi(), preModuleGlobalBeginRun(), preModuleGlobalEndLumi(), preModuleGlobalEndRun(), preModuleStreamBeginLumi(), preModuleStreamBeginRun(), preModuleStreamEndLumi(), and preModuleStreamEndRun().

397  {
398 
399  std::string const& moduleLabel = description.moduleLabel();
400  std::map<std::string, fpu_flags_type>::const_iterator iModule = stateMap_.find(moduleLabel);
401 
402  fpu_flags_type fpuState = defaultState_;
403 
404  if(iModule != stateMap_.end()) {
405  fpuState = iModule->second;
406  }
407  enableAndDisableExcept(fpuState);
408 
409  if(reportSettings_) {
410  LogVerbatim("FPE_Enable")
411  << "\nSettings for module label \""
412  << moduleLabel
413  << "\" before "
414  << debugInfo;
415  echoState();
416  }
417  }
std::map< std::string, fpu_flags_type > stateMap_
tuple description
Definition: idDealer.py:66
void edm::service::EnableFloatingPointExceptions::preActions ( ModuleCallingContext const &  mcc,
char const *  debugInfo 
)
private

Definition at line 437 of file EnableFloatingPointExceptions.cc.

References defaultState_, echoState(), enableAndDisableExcept(), edm::ModuleCallingContext::moduleDescription(), edm::ModuleDescription::moduleLabel(), reportSettings_, stateMap_, and AlCaHLTBitMon_QueryRunRegistry::string.

438  {
439 
440  std::string const& moduleLabel = mcc.moduleDescription()->moduleLabel();
441  std::map<std::string, fpu_flags_type>::const_iterator iModule = stateMap_.find(moduleLabel);
442 
443  fpu_flags_type fpuState = defaultState_;
444 
445  if(iModule != stateMap_.end()) {
446  fpuState = iModule->second;
447  }
448  enableAndDisableExcept(fpuState);
449 
450  if(reportSettings_) {
451  LogVerbatim("FPE_Enable")
452  << "\nSettings for module label \""
453  << moduleLabel
454  << "\" before "
455  << debugInfo;
456  echoState();
457  }
458  }
std::map< std::string, fpu_flags_type > stateMap_
void edm::service::EnableFloatingPointExceptions::preModuleBeginJob ( ModuleDescription const &  md)

Definition at line 210 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

210  {
211  preActions(md, "beginJob");
212  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleBeginStream ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 234 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

234  {
235  preActions(mcc, "beginStream");
236  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleConstruction ( ModuleDescription const &  md)

Definition at line 198 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

198  {
199  preActions(md, "construction");
200  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleEndJob ( ModuleDescription const &  md)

Definition at line 222 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

222  {
223  preActions(md, "endJob");
224  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleEndStream ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 246 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

246  {
247  preActions(mcc, "endStream");
248  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleEvent ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 354 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

354  {
355  preActions(mcc, "event");
356  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleGlobalBeginLumi ( GlobalContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 282 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

282  {
283  preActions(mcc, "globalBeginLumi");
284  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleGlobalBeginRun ( GlobalContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 258 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

258  {
259  preActions(mcc, "globalBeginRun");
260  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleGlobalEndLumi ( GlobalContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 294 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

294  {
295  preActions(mcc, "globalEndLumi");
296  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleGlobalEndRun ( GlobalContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 270 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

270  {
271  preActions(mcc, "globalEndRun");
272  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleStreamBeginLumi ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 330 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

330  {
331  preActions(mcc, "streamBeginLumi");
332  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleStreamBeginRun ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 306 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

306  {
307  preActions(mcc, "streamBeginRun");
308  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleStreamEndLumi ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 342 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

342  {
343  preActions(mcc, "streamEndLumi");
344  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleStreamEndRun ( StreamContext const &  ,
ModuleCallingContext const &  mcc 
)

Definition at line 318 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

318  {
319  preActions(mcc, "streamEndRun");
320  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::setPrecision ( bool  precisionDouble)
private

Definition at line 527 of file EnableFloatingPointExceptions.cc.

Referenced by EnableFloatingPointExceptions().

527  {
528  }

Member Data Documentation

fpu_flags_type edm::service::EnableFloatingPointExceptions::defaultState_
private
bool edm::service::EnableFloatingPointExceptions::reportSettings_
private
std::map<std::string, fpu_flags_type> edm::service::EnableFloatingPointExceptions::stateMap_
private