CUDA 셋팅
미니콘다 설치
콘다 설치 위한 준비(심볼릭 링크로 캐시도 만듬)
1
2
3
4
5
6
mkdir -p ~/data/.conda
mkdir -p ~/data/.cache
mkdir -p ~/data/miniconda3
ln -s ~/data/.conda ~/.conda
ln -s ~/data/.cache ~/.cache
1
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/data/miniconda3/miniconda.sh
1
2
cd data
bash ./miniconda3/miniconda.sh -b -u -p ~/data/miniconda3
1
~/data/miniconda3/bin/conda init bash
1
source ~/.bashrc
정말 데이터 없어서 홈화면에 아무것도 만들 수 없으면
1
vim ~/data/start_conda.sh
source ~/data/miniconda3/etc/profile.d/conda.sh
conda activate base
위 내용 집어넣기
1
source ~/data/start_conda.sh
이 명령어로 실행
특정 그래픽 카드만 사용
1
2
3
4
5
6
7
8
9
10
11
# 한개만 사용
CUDA_VISIBLE_DEVICES=0 python main.py
# 여러개 사용
CUDA_VISIBLE_DEVICES=0,2 python main.py
# 모든 GPU 사용 (기본 동작)
python main.py
tmux
1
2
3
4
5
6
7
8
9
10
tmux new -s mysession
# 나가는 법 : Ctrl + b -> d
tmux attach -t 세션이름
# 세션 목록 보기 : tmux ls
# 세션 삭제 : tmux kill-session -t 세션이름
저장 공간 확인 코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 현재 디렉토리 저장공간 확인
du -h -d 1 ./
현재 디렉토리 크기
du -sh \*
심볼릭 링크 따라가서 용량 확인
du -shL log1 log2
# 전체 저장공간 확인
df -h
# 실시간 확인
watch -n 5 df -h
VSCode SSH 비밀번호 없이
로컬에서 아래 명령어 치고 다 엔터
ssh-keygen -t ed25519 -C “vscode-ssh”
로컬에서 아래 입력하고 비밀번호 입력하면 끝
ssh-copy-id -p 포트번호 아이디@호스트
UV 사용법
설치
| curl -LsSf https://astral.sh/uv/install.sh | sh |
프로젝트에서 시작시(환경 생성)
uv init
uv python pin 3.13 (버전 지정)
패키지 설치
uv add numpy pandas
uv add -r requirements.txt
uv pip install numpy torch (기존 방식으로도 작동함)
이미 uv 환경이 설정되어 있다면
uv sync
실행시키려면
uv run main.py
라이브러리 제거
uv remove diffusers
uv 가상환경
uv venv –python 3.10
source .venv/bin/activate
Enjoy Reading This Article?
Here are some more articles you might like to read next: