Setting, Error/Python, Python Library 17

Tensorflow, pyTorch - 원하는 GPU 할당

모델 학습을 하기 위해 원하는 GPU만 사용하기 위해서는 python의 os 모듈을 통해 간단히 접근할 수 있는 GPU 번호를 제한해주면 된다. 1. 1개의 단일 GPU 사용 import os os.environ['CUDA_VISIBLE_DEVICES'] = '0' 2. 2개 이상의 multi-GPU 사용 (ex. 0번, 1번) import os os.environ['CUDA_VISIBLE_DEVICES'] = '0, 1' 이렇게 하고 1. Tensorflow tensorflow.distribute의 MirroredStrategy를 바로 사용해주면 된다. 위에서 이미 GPU를 제한했기 때문에 따로 설정해줄 것은 없다. 단지 선언한 mirrored_strategy안에 모델 define부터 모델 생성, c..

RTX 3090 Tensorflow GPU 동작확인

tf-nightly 2.7.0-dev20210806 버전 기준으로 설명함. 1. Tensorflow 설치 확인 from tensorflow.python.client import device_lib import tensorflow as tf tf.__version__ 2. Cuda 및 GPU 동작 확인 print(tf.test.is_built_with_cuda()) print(tf.test.is_built_with_gpu_support()) 3. physical_device 확인 physical_devices = tf.config.list_physical_devices('GPU') physical_devices 4. 사용 가능한 cpu 및 gpu 확인 (여기에서 gpu가 보여야함) local_devices..

[Install] RTX 3090, cuda 11.2 Tensorflow-gpu 설치

※ 경험한 바로는 3090에 기본 Tensorflow-gpu를 설치하면 tensorflow가 gpu를 똑바로 잡지 못했다. (이유는 아직도 모르겠음) [해결방법] - tensorflow nightly 버전을 이용한다. - nightly 버전 : 안정화된 tensorflow 버전이 아닌 매일매일 개발되고 있는 버전. - 기존의 tensorflow와 똑같이 사용하면 된다. - 아니면 tensorflow-gpu 2.4 버전을 사용한다. (다른 라이브러리들과 버전 충돌 주의) $ pip3 install tf-nightly $ pip3 install tensorflow-gpu==2.4.0 (참고) https://pypi.org/project/tf-nightly/

[Install] RTX 3090, cuda 11.2 Pytorch 설치

※ Docker container 안에 cuda와 호환되는 pytorch 설치 ※ [Error] no kernel image is available for execution on the device CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect. 에러 해결법 ※ 사용환경 : RTX 3090, cuda 11.2 - 본인의 pip 환경에 따라서 pip, pip3 선택해서 설치 pip : python2 pip3 : python3 더보기 Error: Command 'pip3' not found, but can be installed with 에러가 ..

[Jupyter] Jupyter notebook 비밀번호 설정

※ Jupyter notebook 토큰 없이 비밀번호로 실행하기 - 비밀번호 설정하기 $ jupyter notebook --generate-config $ jupyter notebook password ▷ 원하는 비밀번호 입력 - 비밀번호를 변경하고 싶을 때에도 동일한 명령어 입력 $ jupyter notebook password ▷ 변경하고자 하는 비밀번호 입력 $ jupyter notebook --allow-root --ip=x.x.x.x --port=xxxx --allow-root : root 권한으로 jupyter notebook을 실행할 수 있게 함 --ip=x.x.x.x : 해당 ip에로만 접속이 가능하게 함 (0.0.0.0으로 설정하면 모든 ip 허용) --port=xxxx : 해당 port..