src.acoustools.Utilities.Setup

 1import torch, sys
 2from typing import Literal 
 3import warnings
 4
 5DTYPE = torch.complex64
 6DTYPE = torch.complex32 if '-c32' in sys.argv else DTYPE
 7DTYPE = torch.complex64 if '-c64' in sys.argv else DTYPE
 8DTYPE = torch.complex128 if '-c128' in sys.argv else DTYPE
 9'''
10Data type to use for matricies - use `.to(DTYPE)` to convert
11'''
12
13device:Literal['cuda','cpu'] = 'cuda' if torch.cuda.is_available() else 'cpu' 
14# device = 'mps' if torch.backends.mps.is_available() else device
15'''Constant storing device to use, `cuda` if cuda is available else cpu. \n
16Use -cpu when running python to force cpu use'''
17device = device if '-cpu' not in sys.argv else 'cpu'
18device = device if '-mps' not in sys.argv else 'mps'
19
20deprecated = '--deprecated' in sys.argv
21supress_warnings = '--supress_warninigs' in sys.argv
22if deprecated and not supress_warnings: warnings.warn('AcousTools is running in deprecated mode - some functions may behave unexpectedly in ways that may be removed in future updates')
DTYPE = torch.complex64

Data type to use for matricies - use .to(DTYPE) to convert

device: Literal['cuda', 'cpu'] = 'cpu'

Constant storing device to use, cuda if cuda is available else cpu.

Use -cpu when running python to force cpu use

deprecated = False
supress_warnings = False