-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
coretree LC intersection: add workarounds for LastJourney data
- Loading branch information
1 parent
89aba8b
commit 434e033
Showing
2 changed files
with
134 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from mpi4py import MPI | ||
import sys | ||
import logging | ||
import traceback | ||
|
||
comm = MPI.COMM_WORLD | ||
|
||
|
||
def _mpi_exception_handler(exc_type, exc_value, exc_traceback): | ||
rank = comm.Get_rank() | ||
if issubclass(exc_type, KeyboardInterrupt): | ||
sys.__excepthook__(exc_type, exc_value, exc_traceback) | ||
return | ||
logging.error( | ||
f"Uncaught exception on rank {rank}", | ||
exc_info=(exc_type, exc_value, exc_traceback), | ||
) | ||
sys.stderr.write(f"Uncaught exception on rank {rank}\n") | ||
sys.stderr.write( | ||
"".join(traceback.format_exception(exc_type, exc_value, exc_traceback)) | ||
) | ||
with open(f"error_rank_{rank}.txt", "w") as f: | ||
f.write("".join(traceback.format_exception_only(exc_type, exc_value))) | ||
comm.Abort(1) | ||
|
||
|
||
def init_mpi_error_handler(): | ||
sys.excepthook = _mpi_exception_handler |