import torch
import torch.backends.cudnn as cudnn
print(f"PyTorch version: {torch.__version__}")
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"GPU Name: {torch.cuda.get_device_name(0)}")
print(f"cuDNN version: {torch.backends.cudnn.version()}")
# 현재 연결된 GPU 장치 수
print(f"Device Count: {torch.cuda.device_count()}")
# 간단한 텐서 연산 테스트
x = torch.randn(3, 3).cuda()
print("Tensor operation success!")
if cudnn.is_acceptable(torch.randn(1, device='cuda')):
print(f"cuDNN version: {cudnn.version()}")
print("cuDNN is working perfectly!")
bluesanta@bluesanta-A520M-ITX-ac:~$ whereis cuda
cuda: /usr/lib/cuda /usr/include/cuda /usr/local/cuda
bluesanta@bluesanta-A520M-ITX-ac:~$ ls -l /usr/local | grep cuda
lrwxrwxrwx 1 root root 22 1월 2 22:32 cuda -> /etc/alternatives/cuda
lrwxrwxrwx 1 root root 25 1월 2 22:32 cuda-12 -> /etc/alternatives/cuda-12
drwxr-xr-x 15 root root 4096 1월 2 22:32 cuda-12.4
환경 변수 등록
설치가 완료되면 /usr/local/cuda-12.4 폴더가 생성됩니다. 이제 시스템이 이 폴더를 인식하도록 설정
bluesanta@bluesanta-A520M-ITX-ac:~$ vi ~/.bashrc
~/.bashrc 내용 추가
# 파일 맨 아래에 다음 세 줄 추가
export PATH=/usr/local/cuda-12.4/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda-12.4
CUDA Toolkit 설치 (Ubuntu 24.04 기준) - 위에 설치 된것 같지만 다시 확인 필요
(.venv) bluesanta@bluesanta-AI-Series:~/Application/stable_diffusion$ cd ComfyUI/
(.venv) bluesanta@bluesanta-AI-Series:~/Application/stable_diffusion/ComfyUI$ pip install -r requirements.txt
ComfyUI 실행
(.venv) bluesanta@bluesanta-AI-Series:~/Application/stable_diffusion/ComfyUI$ python main.py
Checkpoint files will always be loaded safely.
Total VRAM 14844 MB, total RAM 29688 MB
pytorch version: 2.9.1+rocm7.10.0
Set: torch.backends.cudnn.enabled = False for better AMD performance.
AMD arch: gfx1150
ROCm version: (7, 2)
Set vram state to: NORMAL_VRAM
Device: cuda:0 AMD Radeon 890M Graphics : native
Using async weight offloading with 2 streams
Enabled pinned memory 28203.0
Using sub quadratic optimization for attention, if you have memory or speed issues try using: --use-split-cross-attention
Python version: 3.12.3 (main, Nov 6 2025, 13:44:16) [GCC 13.3.0]
ComfyUI version: 0.7.0
****** User settings have been changed to be stored on the server instead of browser storage. ******
****** For multi-user setups add the --multi-user CLI argument to enable multiple user profiles. ******
ComfyUI frontend version: 1.35.9
[Prompt Server] web root: /home/bluesanta/Application/stable_diffusion/.venv/lib/python3.12/site-packages/comfyui_frontend_package/static
Total VRAM 14844 MB, total RAM 29688 MB
pytorch version: 2.9.1+rocm7.10.0
Set: torch.backends.cudnn.enabled = False for better AMD performance.
AMD arch: gfx1150
ROCm version: (7, 2)
Set vram state to: NORMAL_VRAM
Device: cuda:0 AMD Radeon 890M Graphics : native
Using async weight offloading with 2 streams
Enabled pinned memory 28203.0
Import times for custom nodes:
0.0 seconds: /home/bluesanta/Application/stable_diffusion/ComfyUI/custom_nodes/websocket_image_save.py
Context impl SQLiteImpl.
Will assume non-transactional DDL.
No target revision found.
Starting server
To see the GUI go to: http://127.0.0.1:8188
orangepi@orangepi5plus:~/orangepi-build$ vi kernel/orange-pi-6.1-rk35xx/drivers/rknpu/rknpu_devfreq.c
237행 주석 처리 : set_soc_info = rockchip_opp_set_low_length,
소스 코드 동기화 비활성화
kernel/orange-pi-5.10-rk35xx 디렉터리에 드라이버를 수동으로 덮어썼기 때문에, 컴파일을 직접 실행하면 스크립트가 클라우드 내 소스 코드와 불일치를 검사해 코드를 다시 풀어서 덮어쓰기 문제가 발생합니다. 따라서 설정 파일에서 소스 코드 동기화 기능을 비활성화해야 합니다.
orangepi@orangepi5plus:~/orangepi-build$ sudo ./build.sh
dpkg-deb: building package 'linux-headers-current-rockchip-rk3588' in '../linux-headers-current-rockchip-rk3588_1.2.0_arm64.deb'.
dpkg-deb: building package 'linux-dtb-current-rockchip-rk3588' in '../linux-dtb-current-rockchip-rk3588_1.2.0_arm64.deb'.
dpkg-deb: building package 'linux-image-current-rockchip-rk3588' in '../linux-image-current-rockchip-rk3588_1.2.0_arm64.deb'.
dpkg-deb: building package 'linux-image-current-rockchip-rk3588-dbg' in '../linux-image-current-rockchip-rk3588-dbg_1.2.0_arm64.deb'.
dpkg-genchanges: info: binary-only upload (no source code included)
dpkg-buildpackage: info: binary-only upload (no source included)
[ o.k. ] Kernel build done [ @host ]
[ o.k. ] Target directory [ /home/orangepi/orangepi-build/output/debs/ ]
[ o.k. ] File name [ linux-image-current-rockchip-rk3588_1.2.0_arm64.deb ]
[ o.k. ] Runtime [ 35 min ]
[ o.k. ] Repeat Build Options [ sudo ./build.sh BOARD=orangepi5plus BRANCH=current BUILD_OPT=kernel KERNEL_CONFIGURE=no ]
deb 패키지 설치
orangepi@orangepi5plus:~/orangepi-build$ ls output/debs/linux-*
output/debs/linux-dtb-current-rockchip-rk3588_1.2.0_arm64.deb 커널에서 사용하는 dtb 파일 포함
output/debs/linux-headers-current-rockchip-rk3588_1.2.0_arm64.deb 커널 헤더 포함
output/debs/linux-image-current-rockchip-rk3588_1.2.0_arm64.deb 커널 미러링 및 커널 모듈 포함
output/debs/linux-image-current-rockchip-rk3588-dbg_1.2.0_arm64.deb
linux-image-legacy-rockchip-rk3588_1.1.8_arm64.deb 설치
orangepi@orangepi5plus:~/orangepi-build$ sudo apt purge -y linux-image-current-rockchip-rk3588
orangepi@orangepi5plus:~/orangepi-build$ sudo dpkg -i output/debs/linux-image-current-rockchip-rk3588_1.2.0_arm64.deb
Selecting previously unselected package linux-image-current-rockchip-rk3588.
(Reading database ... 168054 files and directories currently installed.)
Preparing to unpack .../linux-image-current-rockchip-rk3588_1.2.0_arm64.deb ...
Unpacking linux-image-current-rockchip-rk3588 (1.2.0) ...
Setting up linux-image-current-rockchip-rk3588 (1.2.0) ...
* dkms: running auto installation service for kernel 6.1.43-rockchip-rk3588
...done.
update-initramfs: Generating /boot/initrd.img-6.1.43-rockchip-rk3588
update-initramfs: Converting to u-boot format
Free space after deleting the package linux-image-current-rockchip-rk3588 in /boot: 936.9M