mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: This PR * adds the breakpad build to most of the remaining docker images (except the mobile + slim ones) * pins to a [fork of breakpad](https://github.com/google/breakpad/compare/master...driazati:master?expand=1) to enable dasiy chaining on signal handlers * renames the API to be nicer Pull Request resolved: https://github.com/pytorch/pytorch/pull/59236 Reviewed By: malfet Differential Revision: D28792511 Pulled By: driazati fbshipit-source-id: 83723e74b7f0a00e1695210ac2620a0c91ab4bf2
27 lines
694 B
Python
27 lines
694 B
Python
import os
|
|
import sys
|
|
import pathlib
|
|
|
|
import torch
|
|
|
|
DEFAULT_MINIDUMP_DIR = "/tmp/pytorch_crashes"
|
|
|
|
def enable_minidumps(directory=DEFAULT_MINIDUMP_DIR):
|
|
if sys.platform != "linux":
|
|
raise RuntimeError("Minidump collection is currently only implemented for Linux platforms")
|
|
|
|
if directory == DEFAULT_MINIDUMP_DIR:
|
|
pathlib.Path(directory).mkdir(parents=True, exist_ok=True)
|
|
elif not os.path.exists(directory):
|
|
raise RuntimeError(f"Directory does not exist: {directory}")
|
|
|
|
torch._C._enable_minidumps(directory)
|
|
|
|
|
|
def enable_minidumps_on_exceptions():
|
|
torch._C._enable_minidumps_on_exceptions()
|
|
|
|
|
|
def disable_minidumps():
|
|
torch._C._disable_minidumps()
|