- Intel GPU에서 llama.cpp를 바로 돌리려는 사용자를 위한 IPEX-LLM portable zip/tgz 빠른 시작 문서로, 최신 패키지에서는 Xeon의 Arc A770 1~2개로 DeepSeek-R1-671B-Q4_K_M 실행까지 다룸
- 대상 환경은 Windows와 Linux 모두이며, Intel Core Ultra/11~14세대와 Intel Arc A-Series/B-Series GPU에서 GGUF 모델 실행 절차를 안내함
- 기본 흐름은 GGUF 모델을 로컬에 준비한 뒤
llama-cli에-ngl 99,-c 2500,-n 2048,--temp 0같은 옵션을 넣어 실행하는 방식임 - Linux 전용 FlashMoE는 DeepSeek V3/R1 계열 MoE GGUF 실행에 맞춘 CLI이며, DeepSeek V3/R1 기준 CPU 메모리 380GB, Arc A770 1~8개, 디스크 500GB가 필요함
- 여러 Intel GPU가 섞인 환경에서는 기본적으로 모든 GPU를 쓰기 때문에, iGPU/dGPU 조합에서는
ONEAPI_DEVICE_SELECTOR로 GPU를 지정하거나SYCL_DEVICE_CHECK=0로 검사를 끌 수 있음
portable zip/tgz로 llama.cpp 실행
- llama.cpp portable zip은
ipex-llm기반으로 Intel GPU에서 llama.cpp를 직접 실행하는 패키지임 - 수동 설치를 줄인 portable zip/tgz 흐름을 전제로 하며, 최신 portable zip은 Xeon의 Arc A770 1개 또는 2개에서 DeepSeek-R1-671B-Q4_K_M 실행을 다룸
- 검증된 하드웨어 범위:
- Intel Core Ultra processors
- Intel Core 11th~14th gen processors
- Intel Arc A-Series GPU
- Intel Arc B-Series GPU
Windows 빠른 시작
-
Intel GPU 드라이버는 최신 버전으로 업데이트하는 것을 권장함
-
v2.3.0-nightly 릴리스에서 Windows용 IPEX-LLM llama.cpp portable zip을 내려받아 압축을 해제함
-
cmd에서 압축 해제 폴더로 이동함cd /d PATH\TO\EXTRACTED\FOLDER
-
여러 GPU를 쓰는 사용자는 실행 전에 GPU 선택 설정을 적용할 수 있음
-
GGUF 모델 실행
- 실행 전 커뮤니티 GGUF 모델을 로컬 디렉터리에 다운로드하거나 복사해야 함
- 예시 모델은 bartowski/DeepSeek-R1-Distill-Qwen-7B-GGUF의
DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf임 - 모델 경로를 실제 위치로 바꾼 뒤
llama-cli.exe를 실행함
llama-cli.exe -m PATH\TO\DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf -p "A conversation between User and Assistant. The user asks a question, and the Assistant solves it. The assistant first thinks about the reasoning process in the mind and then provides the user with the answer. The reasoning process and answer are enclosed within <think> </think> and <answer> </answer> tags, respectively, i.e., <think> reasoning process here </think> <answer> answer here </answer>. User: Question:The product of the ages of three teenagers is 4590. How old is the oldest? a. 18 b. 19 c. 15 d. 17 Assistant: <think>" -n 2048 -t 8 -e -ngl 99 --color -c 2500 --temp 0 -no-cnv- 예시 출력에는
Intel Arc A770 Graphics1개 SYCL 장치, KV 캐시, SYCL compute buffer, sampler 설정, 토큰 생성 성능 정보가 나타남
Linux 빠른 시작
-
GPU 드라이버 버전을 확인하고, 필요하면 Intel client GPU driver installation guide를 따라 설치하는 것을 권장함
-
v2.3.0-nightly 릴리스에서 Linux용 IPEX-LLM llama.cpp portable tgz를 내려받아 압축을 해제함
-
터미널에서 압축 해제 폴더로 이동함
cd /PATH/TO/EXTRACTED/FOLDER
-
Linux에서 llama.cpp portable zip을 사용할 때는 oneAPI를 source하지 않아야 함
-
GGUF 모델 실행
- Windows와 마찬가지로
DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf같은 커뮤니티 GGUF 모델을 로컬에 준비함 - 모델 경로를 실제 위치로 바꾼 뒤
./llama-cli를 실행함
./llama-cli -m /PATH/TO/DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf -p "A conversation between User and Assistant. The user asks a question, and the Assistant solves it. The assistant first thinks about the reasoning process in the mind and then provides the user with the answer. The reasoning process and answer are enclosed within <think> </think> and <answer> </answer> tags, respectively, i.e., <think> reasoning process here </think> <answer> answer here </answer>. User: Question:The product of the ages of three teenagers is 4590. How old is the oldest? a. 18 b. 19 c. 15 d. 17 Assistant: <think>" -n 2048 -t 8 -e -ngl 99 --color -c 2500 --temp 0 -no-cnv- 예시 출력에는 SYCL 장치 목록,
llama_kv_cache_init,llama_init_from_model, sampler chain,n_ctx = 2528,n_batch = 4096,n_predict = 2048같은 실행 정보가 포함됨
- Windows와 마찬가지로
FlashMoE로 DeepSeek V3/R1 실행
-
FlashMoE는
llama.cpp위에 구축된 명령줄 도구이며, DeepSeek V3/R1 같은 MoE 모델 실행에 맞춰져 있음 -
현재 Linux 플랫폼에서 사용할 수 있음
-
테스트된 MoE GGUF 모델:
-
다른 MoE GGUF 모델도 지원됨
-
요구사항과 주의사항
- DeepSeek V3/R1 실행 요구사항:
- CPU 메모리 380GB
- Arc A770 1~8개
-
디스크 500GB
- 더 큰 모델이나 다른 정밀도는 더 많은 리소스가 필요할 수 있음
- Arc A770 1개 플랫폼에서는 OOM을 피하기 위해 컨텍스트 길이를 줄여야 하며, 예시로 명령 끝에
-c 1024를 추가함 - 듀얼 소켓 플랫폼에서는 BIOS에서
SNC (Sub-NUMA Clustering)를 활성화하고 실행 명령 앞에numactl --interleave=all을 붙이면 더 나은 디코딩 성능을 얻을 수 있음 - FlashMoE를 사용할 때도 oneAPI를 source하지 않아야 함
- DeepSeek V3/R1 실행 요구사항:
-
CLI 실행
- 예시 모델은 DeepSeek-R1-Q4_K_M.gguf이며, 첫 번째 분할 파일 경로를 지정함
./flash-moe -m /PATH/TO/DeepSeek-R1-Q4_K_M-00001-of-00009.gguf --prompt "What's AI?" -no-cnv- 예시 출력에는 8개 SYCL 장치의 KV buffer,
pipeline parallelism enabled, graph nodes/splits,n_threads = 48,n_ctx = 4096,n_batch = 4096같은 실행 정보가 나타남
-
Serving 실행
./flash-moe -m /PATH/TO/DeepSeek-R1-Q4_K_M-00001-of-00009.gguf --serve -n 512 -np 2 -c 4096-n은 예측할 토큰 수,-np는 병렬 디코딩 시퀀스 수,-c는 전체 컨텍스트 크기임- 값은 요구사항에 맞게 조정할 수 있음
- Serving 기능은 v2.3.0 nightly build부터 사용할 수 있음
- 예시 출력에는
n_slots = 2, 각 slot의n_ctx_slot = 2048, 모델 로딩, chat template,http://127.0.0.1:8080서버 대기 상태가 포함됨
다중 GPU 선택과 SYCL 오류
-
서로 다른 SYCL 장치 감지
- 서로 다른 GPU가 섞여 있으면
Detected different sycl devices오류가 발생할 수 있음 - 예시는 Arc A770 2개와 Intel UHD Graphics 770 iGPU 1개가 함께 감지되는 상황임
- GPU가 같지 않으면 작업이 장치 메모리에 따라 할당되며, 예시에서는 iGPU가 계산 작업의 2/3를 받아 성능이 크게 떨어짐
- 선택지는 두 가지임
- iGPU를 비활성화해 최상의 성능을 얻음
- 검사를 끄고 모든 장치를 사용함
set SYCL_DEVICE_CHECK=0 export SYCL_DEVICE_CHECK=0 - 서로 다른 GPU가 섞여 있으면
-
사용할 GPU 지정
- 여러 Intel GPU가 있으면 llama.cpp는 기본적으로 모든 GPU에서 실행됨
- 특정 GPU만 쓰려면 llama.cpp 명령을 시작하기 전에
ONEAPI_DEVICE_SELECTOR환경 변수를 설정함 - Windows:
set ONEAPI_DEVICE_SELECTOR=level_zero:0 set ONEAPI_DEVICE_SELECTOR="level_zero:0;level_zero:1"- Linux:
export ONEAPI_DEVICE_SELECTOR=level_zero:0 export ONEAPI_DEVICE_SELECTOR="level_zero:0;level_zero:1"- 다중 GPU 선택 세부 정보는 multi_gpus_selection.md를 참조함
성능 옵션과 서명 검증
-
Immediate command lists
SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS는 GPU 작업 제출에 immediate command lists를 사용할지 결정함- 일반적으로 성능을 높일 수 있지만 예외가 있을 수 있어, 환경 변수를 켠 경우와 끈 경우를 모두 시험해 최적 성능을 찾는 것을 권장함
- Windows:
set SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1- Linux:
export SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1- 자세한 내용은 Intel의 Level Zero immediate command lists 문서를 참조함
-
portable zip/tgz 2.2.0 서명 검증
- portable zip/tgz 버전 2.2.0은
openssl로 서명을 검증할 수 있음 - 검증 전 시스템에
openssl이 설치되어 있어야 함
openssl cms -verify -in <portable-zip-or-tgz-file-name>.pkcs1.sig -inform DER -content <portable-zip-or-tgz-file-name> -out nul -noverify - portable zip/tgz 버전 2.2.0은