Back to "thin" venv, also print cuda stats

This commit is contained in:
Brandon Thomas
2023-04-26 23:50:00 -07:00
parent fe22a102be
commit c43c5ae99c
2 changed files with 20 additions and 2 deletions
+1 -2
View File
@@ -32,8 +32,7 @@ COPY requirements-without-poetry.txt .
#RUN pip install -r requirements-without-poetry.txt
# NB: --copies flag creates a "thick" venv that copies the system python binary
RUN python3 -m venv --copies python \
RUN python3 -m venv python \
&& . python/bin/activate \
&& pip install -r requirements-without-poetry.txt
@@ -25,6 +25,25 @@ from rich.logging import RichHandler
print("Env vars:")
print(os.environ)
def print_gpu_info():
print('========================================')
print('Python interpreter', sys.executable)
print('PyTorch version', torch.__version__)
print('CUDA Available?', torch.cuda.is_available())
print('CUDA Device count', torch.cuda.device_count())
print('CUDA architectures library was compiled for', torch.cuda.get_arch_list())
#try:
# from tensorflow.python.client import device_lib
# print('local devices', str(device_lib.list_local_devices()).replace("\n", "\n "))
#except ImportError:
# print('no tensorflow - cannot list devices')
# pass
print('========================================', flush=True)
print_gpu_info()
def init_logger() -> None:
IN_COLAB = os.getenv("COLAB_RELEASE_TAG")
IS_TEST = "test" in Path(__file__).parent.stem