스타일 변환 gpu 사용률 체크(코랩 환경) - 100-hours-a-week/5-yeosa-wiki GitHub Wiki
1. 사용 스펙
-
base CPU 스펙(물리코어1개, vCPU(스레드) 2개)
Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 46 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Vendor ID: GenuineIntel Model name: Intel(R) Xeon(R) CPU @ 2.00GHz CPU family: 6 Model: 85 Thread(s) per core: 2 Core(s) per socket: 1 Socket(s): 1 Stepping: 3 BogoMIPS: 4000.41 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge m ca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht sysc all nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xt opology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dno wprefetch invpcid_single ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm m px avx512f avx512dq rdseed adx smap clflushopt clwb av x512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsave s arat md_clear arch_capabilities Virtualization features: Hypervisor vendor: KVM Virtualization type: full Caches (sum of all): L1d: 32 KiB (1 instance) L1i: 32 KiB (1 instance) L2: 1 MiB (1 instance) L3: 38.5 MiB (1 instance) NUMA: NUMA node(s): 1 NUMA node0 CPU(s): 0,1 Vulnerabilities: Gather data sampling: Not affected Itlb multihit: Not affected L1tf: Mitigation; PTE Inversion Mds: Vulnerable; SMT Host state unknown Meltdown: Vulnerable Mmio stale data: Vulnerable Reg file data sampling: Not affected Retbleed: Vulnerable Spec rstack overflow: Not affected Spec store bypass: Vulnerable Spectre v1: Vulnerable: __user pointer sanitization and usercopy b arriers only; no swapgs barriers Spectre v2: Vulnerable; IBPB: disabled; STIBP: disabled; PBRSB-eIB RS: Not affected; BHI: Vulnerable (Syscall hardening e nabled) Srbds: Not affected Tsx async abort: Vulnerable
-
GPU: Tesla T4 1개
-
메모리: 13290452 kB (대략 13.3GB)
2. 테스트 결과
SD WebUI Startup
)
a. Stable Diffusion WebUI 시작 시 (가. 리소스 사용 추이 요약:
리소스 | 초기값 → 최고값 |
---|---|
CPU | 4~74% (단발성 고점) |
메모리 | 10.2% → 16.2% |
GPU 메모리 | 0 → 102MB |
GPU Load | 0% 고정 |
디스크 사용량 | 42.24 → 45.18GB (약 3GB 증가) |
나. 의미 분석
- 대부분의 부하가 CPU에서 발생: 로딩 과정에서 Python 모듈, 모델 weight 파일, ControlNet 스크립트 등이 처리됨.
- GPU 메모리는 거의 사용되지 않음: 아직 이미지 생성이 시작되지 않아 모델만 로드된 상태.
- 디스크 사용량은 모델 및 캐시 적재로 소폭 증가 (약 3GB).
- 즉, 이 단계는 시스템 초기화 + 모델 준비 단계이며, GPU는 거의 놀고 있는 상태임.
On Request
)
b. 이미지 생성 요청 처리 시 (가. 리소스 변화 추이
시점 | CPU | MEM | GPU Load | GPU Mem |
---|---|---|---|---|
요청 직후 | 2~63% | 18.4% → 22.9% | 0% | 2800MB |
요청 처리 중 | 43% → 94.5% | 22.6% | 6~32% | 2960MB |
처리 완료 후 | 2~6% | 22.9% | 0% | 2984MB |
나. 의미 분석
- GPU 활성화 시작: 요청 직후
GPU Mem: 2800MB
, 처리 중에는GPU Load: 6~32%
, 안정적으로 생성에 GPU가 투입됨. - CPU usage도 90%대까지 치솟음: ControlNet 전처리, 이미지 후처리, 이미지 저장,
mediapipe_face
프리프로세서 등이 CPU 의존도가 높기 때문. - 메모리도 7%가량 증가: 15% → 22.9% 가량으로 SD+ControlNet 모델들 로딩 완료 후 inference 처리에 필요한 메모리 사용 증가.
- GPU 메모리는 고정 유지: 한 번 로딩되면 이후 재사용 → 이후 요청 시 훨씬 빠르게 처리 가능.
c. 핵심 요약 (전체 흐름 분석)
구분 | 내용 |
---|---|
초기 구동 단계 | CPU 중심 로딩 (Torch/Gradio/Weights 등), GPU는 idle |
요청 전송 시 | GPU 메모리 급증, Load 활성화 시작, CPU도 동시 병렬 처리 |
요청 처리 중 | GPU Load 및 메모리 피크, CPU도 90% 이상까지 치솟음 |
요청 종료 후 | CPU/GPU 모두 안정, GPU 메모리는 남아 있음 (캐시 상태) |
- 요청 1개당 최대 사용량
- vCPU 2대 평균 94.5%
- 메모리 23%(3.0GB)
- GPU 1대 32%
- GPU 메모리 3000MB(대략 3GB)