Skip to content

Commit

Permalink
Add warning when unable to switch back to CPU mode
Browse files Browse the repository at this point in the history
  • Loading branch information
roomrys committed Oct 11, 2023
1 parent 816869b commit 9b5b1c7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion sleap/gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
import platform
import random
import re
import traceback
from logging import getLogger
from pathlib import Path
from typing import Callable, List, Optional, Tuple

Expand Down Expand Up @@ -85,6 +87,9 @@
from sleap.util import parse_uri_path


logger = getLogger(__name__)


class MainWindow(QMainWindow):
"""The SLEAP GUI application.
Expand Down Expand Up @@ -1671,7 +1676,12 @@ def main(args: Optional[list] = None, labels: Optional[Labels] = None):
try:
sleap.use_cpu_only()
except RuntimeError: # Visible devices cannot be modified after being initialized
pass
logger.warning(
"Running processes on the GPU. Restarting your GUI should allow switching "
"back to CPU-only mode.\n"
"Received the following error when trying to switch back to CPU-only mode:"
)
traceback.print_exc()

# Print versions.
print()
Expand Down

0 comments on commit 9b5b1c7

Please sign in to comment.