Skip to content

Commit

Permalink
Use GPU based on config for voigt.py
Browse files Browse the repository at this point in the history
  • Loading branch information
smokestacklightnin committed Sep 20, 2023
1 parent 6627f81 commit c5244b3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion stardis/radiation_field/opacities/opacities_solvers/voigt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@
import numba
from numba import cuda
import cmath
from pathlib import Path
from importlib.machinery import PathFinder

GPUs_available = cuda.is_available()
from hydra import compose, initialize

with initialize(
version_base=None,
config_path=pathlib.Path(m.PathFinder.find_spec("stardis").origin).parent.parent,
job_name="stardis",
):
cfg = compose(config_name="config")
GPUs_available = cfg.USE_GPU

if GPUs_available:
import cupy as cp
Expand Down

0 comments on commit c5244b3

Please sign in to comment.