code: def check_env():
      """
      Check the runtime environment for potential performance or stability problems.
      """
      global _already_checked
      problems = 0
      if _already_checked or is_worker():
          return
  
      try:
          blas = blas_info()
          numba = numba_info()
      except Exception as e:
          _log.error("error inspecting runtime environment: %s", e)
          _already_checked = True
          return
  
      if numba is None:
          _log.warning(
              "Numba JIT seems to be disabled - this will hurt performance"
          )
          _already_checked = True
          return
  
      if blas is None:
          _log.warning("threadpoolctl could not find your BLAS")
          _already_checked = True
          return
  
      _log.info("Using BLAS %s", blas.impl)
  
      if numba.threading != "tbb":
          _log.info(
              "Numba is using threading layer %s - consider TBB",
              numba.threading,
          )
  
      if numba.threading == "tbb" and blas.threading == "tbb":
          _log.info("Numba and BLAS both using TBB - good")
  
      if (
          numba.threading == "tbb"
          and blas.impl == "mkl"
          and blas.threading != "tbb"
      ):
          _log.warning(
              "Numba using TBB but MKL is using %s", blas.threading
          )
          _log.info(
              "Set MKL_THREADING_LAYER=tbb for improved performance"
          )
          problems += 1
  
      if blas.threads and blas.threads > 1 and numba.threads > 1:
          # TODO make this be fine in OpenMP configurations
          _log.warning(
              "BLAS using multiple threads - can cause oversubscription"
          )
          _log.info(
              "See https://mde.one/lkpy-blas for information on tuning BLAS for LensKit"
          )
          problems += 1
  
      if problems:
          _log.warning(
              "found %d potential runtime problems - see https://boi.st/lkpy-perf",
              problems,
          )
  
      _already_checked = True
      return problems
  
file_path: lkpy/lenskit/util/debug.py
imports: import sys
  import logging
  from typing import Optional
  from dataclasses import dataclass
  import numba
  import threadpoolctl
  from .parallel import is_worker
label_desc: Use image node_id 4 for calling a global function with example usage: check_env() and returns: problems