728x90

출처

리눅스 확인

bluesanta@bluesanta-AI-Series:~/Application/Llama$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.3 LTS
Release:        24.04
Codename:       noble
bluesanta@bluesanta-AI-Series:~/Application/Llama$ dkms status
amdgpu/6.16.6-2255209.24.04, 6.14.0-37-generic, x86_64: installed
xrt-amdxdna/2.21.0, 6.14.0-37-generic, x86_64: installed

가상환경 생성

bluesanta@bluesanta-AI-Series:~/Application/Llama$ python3 -m venv .venv
bluesanta@bluesanta-AI-Series:~/Application/Llama$ source .venv/bin/activate

PyTorch 설치 (HX 390/gfx1150 아키텍처용)

(.venv) bluesanta@bluesanta-AI-Series:~/Application/Llama$ pip install torch torchvision torchaudio --index-url https://repo.amd.com/rocm/whl/gfx1150/

설치 확인

gpu_check.py

import sys
import torch

# 시스템 및 PyTorch 정보 출력
print(f"Python Version: {sys.version.split()[0]}")
print(f"PyTorch Version: {torch.__version__}")
print(f"GPU 인식 성공: {torch.cuda.is_available()}")

if torch.cuda.is_available():
    print(f"사용 가능 기기: {torch.cuda.get_device_name(0)}")
else:
    print("현재 GPU를 사용할 수 없습니다. 드라이버나 ROCm 설정을 확인하세요.")
 
 
# 실제 텐서 연산 테스트
if torch.cuda.is_available():
    x = torch.randn(1, 3).to("cuda")
    print("GPU 텐서 연산 테스트 완료:", x)

실행

(.venv) bluesanta@bluesanta-AI-Series:~/Application/Llama$ python gpu_check.py
Python Version: 3.12.3
PyTorch Version: 2.9.1+rocm7.10.0
GPU 인식 성공: True
사용 가능 기기: AMD Radeon 890M Graphics
/home/bluesanta/Application/Llama/gpu_check.py:17: UserWarning: expandable_segments not supported on this platform (Triggered internally at /__w/rockrel/rockrel/external-builds/pytorch/pytorch/c10/hip/HIPAllocatorConfig.h:36.)
  x = torch.randn(1, 3).to("cuda")
GPU 텐서 연산 테스트 완료: tensor([[-0.5998, -1.3418, -0.5339]], device='cuda:0')
[W121 10:44:08.608317046 AllocatorConfig.cpp:28] Warning: PYTORCH_CUDA_ALLOC_CONF is deprecated, use PYTORCH_ALLOC_CONF instead (function operator())

PYTORCH_ALLOC_CONF 환경 변수 추가

~/.bashrc 수정

(.venv) bluesanta@bluesanta-AI-Series:~/Application/Llama$ vi ~/.bashrc

내용

export PYTORCH_ALLOC_CONF="expandable_segments:True"

실행

(.venv) bluesanta@bluesanta-AI-Series:~/Application/Llama$ python gpu_check.py 
Python Version: 3.12.3
PyTorch Version: 2.9.1+rocm7.10.0
GPU 인식 성공: True
사용 가능 기기: AMD Radeon 890M Graphics
GPU 텐서 연산 테스트 완료: tensor([[-1.0138, -0.4262,  1.2874]], device='cuda:0')
728x90

+ Recent posts