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

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 175 of file EnableFloatingPointExceptions.cc.

Member Typedef Documentation

Definition at line 178 of file EnableFloatingPointExceptions.cc.

Constructor & Destructor Documentation

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

Definition at line 258 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().

259  :
260  defaultState_(0),
261  stateMap_(),
262  reportSettings_(false) {
263 
264  reportSettings_ = pset.getUntrackedParameter<bool>("reportSettings", false);
265  bool precisionDouble = pset.getUntrackedParameter<bool>("setPrecisionDouble", true);
266 
267  if(reportSettings_) {
268  LogVerbatim("FPE_Enable") << "\nSettings in EnableFloatingPointExceptions constructor";
269  echoState();
270  }
271 
273 
275 
276  setPrecision(precisionDouble);
277 
278  // Note that we must watch all of the transitions even if there are no module specific settings.
279  // This is because the floating point environment may be modified by code outside of this service.
280  registry.watchPostEndJob(this, &EnableFloatingPointExceptions::postEndJob);
281 
282  registry.watchPreModuleBeginStream(this, &EnableFloatingPointExceptions::preModuleBeginStream);
283  registry.watchPostModuleBeginStream(this, &EnableFloatingPointExceptions::postModuleBeginStream);
284 
285  registry.watchPreModuleEndStream(this, &EnableFloatingPointExceptions::preModuleEndStream);
286  registry.watchPostModuleEndStream(this, &EnableFloatingPointExceptions::postModuleEndStream);
287 
288  registry.watchPreModuleConstruction(this, &EnableFloatingPointExceptions::preModuleConstruction);
289  registry.watchPostModuleConstruction(this, &EnableFloatingPointExceptions::postModuleConstruction);
290 
291  registry.watchPreModuleBeginJob(this, &EnableFloatingPointExceptions::preModuleBeginJob);
292  registry.watchPostModuleBeginJob(this, &EnableFloatingPointExceptions::postModuleBeginJob);
293 
294  registry.watchPreModuleEndJob(this, &EnableFloatingPointExceptions::preModuleEndJob);
295  registry.watchPostModuleEndJob(this, &EnableFloatingPointExceptions::postModuleEndJob);
296 
297  registry.watchPreModuleEvent(this, &EnableFloatingPointExceptions::preModuleEvent);
298  registry.watchPostModuleEvent(this, &EnableFloatingPointExceptions::postModuleEvent);
299 
300  registry.watchPreModuleStreamBeginRun(this, &EnableFloatingPointExceptions::preModuleStreamBeginRun);
301  registry.watchPostModuleStreamBeginRun(this, &EnableFloatingPointExceptions::postModuleStreamBeginRun);
302  registry.watchPreModuleStreamEndRun(this, &EnableFloatingPointExceptions::preModuleStreamEndRun);
303  registry.watchPostModuleStreamEndRun(this, &EnableFloatingPointExceptions::postModuleStreamEndRun);
304 
305  registry.watchPreModuleStreamBeginLumi(this, &EnableFloatingPointExceptions::preModuleStreamBeginLumi);
306  registry.watchPostModuleStreamBeginLumi(this, &EnableFloatingPointExceptions::postModuleStreamBeginLumi);
307  registry.watchPreModuleStreamEndLumi(this, &EnableFloatingPointExceptions::preModuleStreamEndLumi);
308  registry.watchPostModuleStreamEndLumi(this, &EnableFloatingPointExceptions::postModuleStreamEndLumi);
309 
310  registry.watchPreModuleGlobalBeginRun(this, &EnableFloatingPointExceptions::preModuleGlobalBeginRun);
311  registry.watchPostModuleGlobalBeginRun(this, &EnableFloatingPointExceptions::postModuleGlobalBeginRun);
312  registry.watchPreModuleGlobalEndRun(this, &EnableFloatingPointExceptions::preModuleGlobalEndRun);
313  registry.watchPostModuleGlobalEndRun(this, &EnableFloatingPointExceptions::postModuleGlobalEndRun);
314 
315  registry.watchPreModuleGlobalBeginLumi(this, &EnableFloatingPointExceptions::preModuleGlobalBeginLumi);
316  registry.watchPostModuleGlobalBeginLumi(this, &EnableFloatingPointExceptions::postModuleGlobalBeginLumi);
317  registry.watchPreModuleGlobalEndLumi(this, &EnableFloatingPointExceptions::preModuleGlobalEndLumi);
318  registry.watchPostModuleGlobalEndLumi(this, &EnableFloatingPointExceptions::postModuleGlobalEndLumi);
319  }
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 759 of file EnableFloatingPointExceptions.cc.

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

759  {
760  feclearexcept(FE_ALL_EXCEPT);
761  fpu_flags_type femask = fegetexcept();
762  LogVerbatim("FPE_Enable") << "Floating point exception mask is "
763  << std::showbase << std::hex << femask;
764 
765  if(femask & FE_DIVBYZERO)
766  LogVerbatim("FPE_Enable") << "\tDivByZero exception is on";
767  else
768  LogVerbatim("FPE_Enable") << "\tDivByZero exception is off";
769 
770  if(femask & FE_INVALID)
771  LogVerbatim("FPE_Enable") << "\tInvalid exception is on";
772  else
773  LogVerbatim("FPE_Enable") << "\tInvalid exception is off";
774 
775  if(femask & FE_OVERFLOW)
776  LogVerbatim("FPE_Enable") << "\tOverFlow exception is on";
777  else
778  LogVerbatim("FPE_Enable") << "\tOverflow exception is off";
779 
780  if(femask & FE_UNDERFLOW)
781  LogVerbatim("FPE_Enable") << "\tUnderFlow exception is on";
782  else
783  LogVerbatim("FPE_Enable") << "\tUnderFlow exception is off";
784  }
void edm::service::EnableFloatingPointExceptions::enableAndDisableExcept ( fpu_flags_type  target)
private

Definition at line 711 of file EnableFloatingPointExceptions.cc.

References filterCSVwithJSON::target.

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

711  {
712  feclearexcept(FE_ALL_EXCEPT);
713  fpu_flags_type current = fegetexcept();
714  fpu_flags_type exceptionsToModify = current ^ target;
715  fpu_flags_type exceptionsToEnable = 0;
716  fpu_flags_type exceptionsToDisable = 0;
717 
718  if(exceptionsToModify & FE_DIVBYZERO) {
719  if(target & FE_DIVBYZERO) {
720  exceptionsToEnable |= FE_DIVBYZERO;
721  }
722  else {
723  exceptionsToDisable |= FE_DIVBYZERO;
724  }
725  }
726  if(exceptionsToModify & FE_INVALID) {
727  if(target & FE_INVALID) {
728  exceptionsToEnable |= FE_INVALID;
729  }
730  else {
731  exceptionsToDisable |= FE_INVALID;
732  }
733  }
734  if(exceptionsToModify & FE_OVERFLOW) {
735  if(target & FE_OVERFLOW) {
736  exceptionsToEnable |= FE_OVERFLOW;
737  }
738  else {
739  exceptionsToDisable |= FE_OVERFLOW;
740  }
741  }
742  if(exceptionsToModify & FE_UNDERFLOW) {
743  if(target & FE_UNDERFLOW) {
744  exceptionsToEnable |= FE_UNDERFLOW;
745  }
746  else {
747  exceptionsToDisable |= FE_UNDERFLOW;
748  }
749  }
750  if(exceptionsToEnable != 0) {
751  feenableexcept(exceptionsToEnable);
752  }
753  if(exceptionsToDisable != 0) {
754  fedisableexcept(exceptionsToDisable);
755  }
756  }
void edm::service::EnableFloatingPointExceptions::establishModuleEnvironments ( ParameterSet const &  pset)
private

Definition at line 323 of file EnableFloatingPointExceptions.cc.

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

Referenced by EnableFloatingPointExceptions().

323  {
324 
325  // Scan the module name list and set per-module values. Be careful to treat
326  // any user-specified default first. If there is one, use it to override our default.
327  // Then remove it from the list so we don't see it again while handling everything else.
328 
329  typedef std::vector<std::string> VString;
330 
331  std::string const def("default");
332  ParameterSet const empty_PSet;
333  VString const empty_VString;
334  VString moduleNames = pset.getUntrackedParameter<VString>("moduleNames", empty_VString);
335 
336  for(VString::const_iterator it(moduleNames.begin()), itEnd = moduleNames.end(); it != itEnd; ++it) {
337  ParameterSet const& modulePSet = pset.getUntrackedParameterSet(*it, empty_PSet);
338  bool enableDivByZeroEx = modulePSet.getUntrackedParameter<bool>("enableDivByZeroEx", false);
339  bool enableInvalidEx = modulePSet.getUntrackedParameter<bool>("enableInvalidEx", false);
340  bool enableOverFlowEx = modulePSet.getUntrackedParameter<bool>("enableOverFlowEx", false);
341  bool enableUnderFlowEx = modulePSet.getUntrackedParameter<bool>("enableUnderFlowEx", false);
342 
343  fpu_flags_type flags = 0;
344  if(enableDivByZeroEx) flags |= FE_DIVBYZERO;
345  if(enableInvalidEx) flags |= FE_INVALID;
346  if(enableOverFlowEx) flags |= FE_OVERFLOW;
347  if(enableUnderFlowEx) flags |= FE_UNDERFLOW;
348  enableAndDisableExcept(flags);
349 
350  fpu_flags_type fpuState = fegetexcept();
351  assert(flags == fpuState);
352 
353  if(reportSettings_) {
354  LogVerbatim("FPE_Enable") << "\nSettings for module " << *it;
355  echoState();
356  }
357  if(*it == def) {
358  defaultState_ = fpuState;
359  }
360  else {
361  stateMap_[*it] = fpuState;
362  }
363  }
364  }
assert(m_qm.get())
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 545 of file EnableFloatingPointExceptions.cc.

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

545  {
547 
548  desc.addUntracked<bool>("reportSettings", false)->setComment(
549  "Log FPE settings at different phases of the job.");
550  desc.addUntracked<bool>("setPrecisionDouble", true)->setComment(
551  "Set the FPU to use double precision");
552 
553  ParameterSetDescription validator;
554  validator.setComment("FPU exceptions to enable/disable for the requested module");
555  validator.addUntracked<bool>("enableDivByZeroEx", false)->setComment(
556  "Enable/disable exception for 'divide by zero'");
557  validator.addUntracked<bool>("enableInvalidEx", false)->setComment(
558  "Enable/disable exception for 'invalid' math operations (e.g. sqrt(-1))");
559  validator.addUntracked<bool>("enableOverFlowEx", false)->setComment(
560  "Enable/disable exception for numeric 'overflow' (value to big for type)");
561  validator.addUntracked<bool>("enableUnderFlowEx", false)->setComment(
562  "Enable/disable exception for numeric 'underflow' (value to small to be represented accurately)");
563 
564  AllowedLabelsDescription<ParameterSetDescription> node("moduleNames", validator, false);
565  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");
566  desc.addNode(node);
567 
568  descriptions.add("EnableFloatingPointExceptions", desc);
569  descriptions.setComment("This service allows you to control the FPU and its exceptions on a per module basis.");
570  }
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 641 of file EnableFloatingPointExceptions.cc.

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

641  {
642 
643  fpu_flags_type fpuState = defaultState_;
644 
645  edm::ModuleCallingContext const* previous_mcc = mcc.previousModuleOnThread();
646  if(previous_mcc) {
647  std::map<std::string, fpu_flags_type>::const_iterator iModule = stateMap_.find(previous_mcc->moduleDescription()->moduleLabel());
648  if(iModule != stateMap_.end()) {
649  fpuState = iModule->second;
650  }
651  }
652  enableAndDisableExcept(fpuState);
653 
654  if(reportSettings_) {
655  LogVerbatim("FPE_Enable")
656  << "\nSettings for module label \""
657  << mcc.moduleDescription()->moduleLabel()
658  << "\" after "
659  << debugInfo;
660  echoState();
661  }
662  }
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 367 of file EnableFloatingPointExceptions.cc.

References echoState(), and reportSettings_.

Referenced by EnableFloatingPointExceptions().

367  {
368 
369  if(reportSettings_) {
370  LogVerbatim("FPE_Enable") << "\nSettings after endJob ";
371  echoState();
372  }
373  }
void edm::service::EnableFloatingPointExceptions::postModuleBeginJob ( ModuleDescription const &  md)

Definition at line 395 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 419 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

419  {
420  postActions(mcc, "beginStream");
421  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleConstruction ( ModuleDescription const &  md)

Definition at line 383 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

383  {
384  postActions(md, "construction");
385  }
void postActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::postModuleEndJob ( ModuleDescription const &  md)

Definition at line 407 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 431 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 539 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 467 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 443 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 479 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 455 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 515 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 491 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 527 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 503 of file EnableFloatingPointExceptions.cc.

References postActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 575 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().

576  {
577 
578  std::string const& moduleLabel = description.moduleLabel();
579  std::map<std::string, fpu_flags_type>::const_iterator iModule = stateMap_.find(moduleLabel);
580 
581  fpu_flags_type fpuState = defaultState_;
582 
583  if(iModule != stateMap_.end()) {
584  fpuState = iModule->second;
585  }
586  enableAndDisableExcept(fpuState);
587 
588  if(reportSettings_) {
589  LogVerbatim("FPE_Enable")
590  << "\nSettings for module label \""
591  << moduleLabel
592  << "\" before "
593  << debugInfo;
594  echoState();
595  }
596  }
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 616 of file EnableFloatingPointExceptions.cc.

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

617  {
618 
619  std::string const& moduleLabel = mcc.moduleDescription()->moduleLabel();
620  std::map<std::string, fpu_flags_type>::const_iterator iModule = stateMap_.find(moduleLabel);
621 
622  fpu_flags_type fpuState = defaultState_;
623 
624  if(iModule != stateMap_.end()) {
625  fpuState = iModule->second;
626  }
627  enableAndDisableExcept(fpuState);
628 
629  if(reportSettings_) {
630  LogVerbatim("FPE_Enable")
631  << "\nSettings for module label \""
632  << moduleLabel
633  << "\" before "
634  << debugInfo;
635  echoState();
636  }
637  }
std::map< std::string, fpu_flags_type > stateMap_
void edm::service::EnableFloatingPointExceptions::preModuleBeginJob ( ModuleDescription const &  md)

Definition at line 389 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 413 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

413  {
414  preActions(mcc, "beginStream");
415  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleConstruction ( ModuleDescription const &  md)

Definition at line 377 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

377  {
378  preActions(md, "construction");
379  }
void preActions(ModuleDescription const &, char const *debugInfo)
void edm::service::EnableFloatingPointExceptions::preModuleEndJob ( ModuleDescription const &  md)

Definition at line 401 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 425 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 533 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 461 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 437 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 473 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 449 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 509 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 485 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 521 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 497 of file EnableFloatingPointExceptions.cc.

References preActions().

Referenced by EnableFloatingPointExceptions().

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

Definition at line 706 of file EnableFloatingPointExceptions.cc.

Referenced by EnableFloatingPointExceptions().

706  {
707  }

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