You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/11/08 23:46:40 UTC

[GitHub] yuxihu commented on a change in pull request #13190: [WIP] catch floating number divide by zero

yuxihu commented on a change in pull request #13190: [WIP] catch floating number divide by zero
URL: https://github.com/apache/incubator-mxnet/pull/13190#discussion_r232100924
 
 

 ##########
 File path: src/engine/engine.cc
 ##########
 @@ -35,6 +55,18 @@ inline Engine* CreateEngine() {
   if (type == nullptr) type = "ThreadedEnginePerDevice";
   std::string stype = type;
 
+#ifdef _TEST_FLOAT_EXCEPTION
+  struct sigaction act;
+  memset(&act, '\0', sizeof(act));
+  act.sa_sigaction = &float_num_err_handler;
+  act.sa_flags = SA_SIGINFO;
+  if (sigaction(SIGFPE, &act, NULL) < 0) {
+    fprintf(stderr, "Cannot register signal handler\n");
 
 Review comment:
   Might be also good to log the errno in the message such that we can use it to see why it failed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services