Skip to content

llama.cpp with mistral-7b-instruct-v0.2.Q5_K_M.gguf performance comparison between Intel CPU, nVIDIA GPU and Apple M1/M2 #5619

@a-b-n-e-o

Description

@a-b-n-e-o

On Intel CPU, 8 tokens/s
On Apple M1 and M2 (10 core GPU), 20 tokens/s
On 8 x nVIDIA Quadro P6000, compute capability 6.1, 40 tokens/s

I'd expect 8 nVIDIA GPUs would be at least 8 times faster? Is this expected or am I doing something wrong?

Here's the console output from the server example:

./server --host 0.0.0.0 -ngl 33
ggml_init_cublas: GGML_CUDA_FORCE_MMQ:   no
ggml_init_cublas: CUDA_USE_TENSOR_CORES: yes
ggml_init_cublas: found 8 CUDA devices:
  Device 0: Quadro P6000, compute capability 6.1, VMM: yes
  Device 1: Quadro P6000, compute capability 6.1, VMM: yes
  Device 2: Quadro P6000, compute capability 6.1, VMM: yes
  Device 3: Quadro P6000, compute capability 6.1, VMM: yes
  Device 4: Quadro P6000, compute capability 6.1, VMM: yes
  Device 5: Quadro P6000, compute capability 6.1, VMM: yes
  Device 6: Quadro P6000, compute capability 6.1, VMM: yes
  Device 7: Quadro P6000, compute capability 6.1, VMM: yes
{"timestamp":1708479356,"level":"INFO","function":"main","line":2541,"message":"build info","build":1037,"commit":"17bf2ed"}
{"timestamp":1708479356,"level":"INFO","function":"main","line":2544,"message":"system info","n_threads":24,"n_threads_batch":-1,"total_threads":48,"system_info":"AVX = 1 | AVX_VNNI = 0 | AVX2 = 1 | AVX512 = 1 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 | "}

LLM server listening at http://0.0.0.0:8080

{"timestamp":1708479356,"level":"INFO","function":"main","line":2649,"message":"HTTP server listening","port":"8080","hostname":"0.0.0.0"}
llama_model_loader: loaded meta data with 24 key-value pairs and 291 tensors from mistral-7b-instruct-v0.2.Q5_K_M.gguf (version GGUF V3 (latest))
llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv   0:                       general.architecture str              = llama
llama_model_loader: - kv   1:                               general.name str              = mistralai_mistral-7b-instruct-v0.2
llama_model_loader: - kv   2:                       llama.context_length u32              = 32768
llama_model_loader: - kv   3:                     llama.embedding_length u32              = 4096
llama_model_loader: - kv   4:                          llama.block_count u32              = 32
llama_model_loader: - kv   5:                  llama.feed_forward_length u32              = 14336
llama_model_loader: - kv   6:                 llama.rope.dimension_count u32              = 128
llama_model_loader: - kv   7:                 llama.attention.head_count u32              = 32
llama_model_loader: - kv   8:              llama.attention.head_count_kv u32              = 8
llama_model_loader: - kv   9:     llama.attention.layer_norm_rms_epsilon f32              = 0.000010
llama_model_loader: - kv  10:                       llama.rope.freq_base f32              = 1000000.000000
llama_model_loader: - kv  11:                          general.file_type u32              = 17
llama_model_loader: - kv  12:                       tokenizer.ggml.model str              = llama
llama_model_loader: - kv  13:                      tokenizer.ggml.tokens arr[str,32000]   = ["<unk>", "<s>", "</s>", "<0x00>", "<...
llama_model_loader: - kv  14:                      tokenizer.ggml.scores arr[f32,32000]   = [0.000000, 0.000000, 0.000000, 0.0000...
llama_model_loader: - kv  15:                  tokenizer.ggml.token_type arr[i32,32000]   = [2, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, ...
llama_model_loader: - kv  16:                tokenizer.ggml.bos_token_id u32              = 1
llama_model_loader: - kv  17:                tokenizer.ggml.eos_token_id u32              = 2
llama_model_loader: - kv  18:            tokenizer.ggml.unknown_token_id u32              = 0
llama_model_loader: - kv  19:            tokenizer.ggml.padding_token_id u32              = 0
llama_model_loader: - kv  20:               tokenizer.ggml.add_bos_token bool             = true
llama_model_loader: - kv  21:               tokenizer.ggml.add_eos_token bool             = false
llama_model_loader: - kv  22:                    tokenizer.chat_template str              = {{ bos_token }}{% for message in mess...
llama_model_loader: - kv  23:               general.quantization_version u32              = 2
llama_model_loader: - type  f32:   65 tensors
llama_model_loader: - type q5_K:  193 tensors
llama_model_loader: - type q6_K:   33 tensors
llm_load_vocab: special tokens definition check successful ( 259/32000 ).
llm_load_print_meta: format           = GGUF V3 (latest)
llm_load_print_meta: arch             = llama
llm_load_print_meta: vocab type       = SPM
llm_load_print_meta: n_vocab          = 32000
llm_load_print_meta: n_merges         = 0
llm_load_print_meta: n_ctx_train      = 32768
llm_load_print_meta: n_embd           = 4096
llm_load_print_meta: n_head           = 32
llm_load_print_meta: n_head_kv        = 8
llm_load_print_meta: n_layer          = 32
llm_load_print_meta: n_rot            = 128
llm_load_print_meta: n_embd_head_k    = 128
llm_load_print_meta: n_embd_head_v    = 128
llm_load_print_meta: n_gqa            = 4
llm_load_print_meta: n_embd_k_gqa     = 1024
llm_load_print_meta: n_embd_v_gqa     = 1024
llm_load_print_meta: f_norm_eps       = 0.0e+00
llm_load_print_meta: f_norm_rms_eps   = 1.0e-05
llm_load_print_meta: f_clamp_kqv      = 0.0e+00
llm_load_print_meta: f_max_alibi_bias = 0.0e+00
llm_load_print_meta: n_ff             = 14336
llm_load_print_meta: n_expert         = 0
llm_load_print_meta: n_expert_used    = 0
llm_load_print_meta: rope scaling     = linear
llm_load_print_meta: freq_base_train  = 1000000.0
llm_load_print_meta: freq_scale_train = 1
llm_load_print_meta: n_yarn_orig_ctx  = 32768
llm_load_print_meta: rope_finetuned   = unknown
llm_load_print_meta: model type       = 7B
llm_load_print_meta: model ftype      = Q5_K - Medium
llm_load_print_meta: model params     = 7.24 B
llm_load_print_meta: model size       = 4.78 GiB (5.67 BPW) 
llm_load_print_meta: general.name     = mistralai_mistral-7b-instruct-v0.2
llm_load_print_meta: BOS token        = 1 '<s>'
llm_load_print_meta: EOS token        = 2 '</s>'
llm_load_print_meta: UNK token        = 0 '<unk>'
llm_load_print_meta: PAD token        = 0 '<unk>'
llm_load_print_meta: LF token         = 13 '<0x0A>'
llm_load_tensors: ggml ctx size =    1.00 MiB
llm_load_tensors: offloading 32 repeating layers to GPU
llm_load_tensors: offloading non-repeating layers to GPU
llm_load_tensors: offloaded 33/33 layers to GPU
llm_load_tensors:        CPU buffer size =    85.94 MiB
llm_load_tensors:      CUDA0 buffer size =   747.03 MiB
llm_load_tensors:      CUDA1 buffer size =   580.09 MiB
llm_load_tensors:      CUDA2 buffer size =   588.06 MiB
llm_load_tensors:      CUDA3 buffer size =   580.09 MiB
llm_load_tensors:      CUDA4 buffer size =   580.09 MiB
llm_load_tensors:      CUDA5 buffer size =   588.06 MiB
llm_load_tensors:      CUDA6 buffer size =   588.06 MiB
llm_load_tensors:      CUDA7 buffer size =   555.55 MiB
..................................................................................................
llama_new_context_with_model: n_ctx      = 512
llama_new_context_with_model: freq_base  = 1000000.0
llama_new_context_with_model: freq_scale = 1
llama_kv_cache_init:      CUDA0 KV buffer size =    10.00 MiB
llama_kv_cache_init:      CUDA1 KV buffer size =     8.00 MiB
llama_kv_cache_init:      CUDA2 KV buffer size =     8.00 MiB
llama_kv_cache_init:      CUDA3 KV buffer size =     8.00 MiB
llama_kv_cache_init:      CUDA4 KV buffer size =     8.00 MiB
llama_kv_cache_init:      CUDA5 KV buffer size =     8.00 MiB
llama_kv_cache_init:      CUDA6 KV buffer size =     8.00 MiB
llama_kv_cache_init:      CUDA7 KV buffer size =     6.00 MiB
llama_new_context_with_model: KV self size  =   64.00 MiB, K (f16):   32.00 MiB, V (f16):   32.00 MiB
llama_new_context_with_model:  CUDA_Host input buffer size   =     9.01 MiB
llama_new_context_with_model:      CUDA0 compute buffer size =    80.30 MiB
llama_new_context_with_model:      CUDA1 compute buffer size =    89.10 MiB
llama_new_context_with_model:      CUDA2 compute buffer size =    89.10 MiB
llama_new_context_with_model:      CUDA3 compute buffer size =    89.10 MiB
llama_new_context_with_model:      CUDA4 compute buffer size =    89.10 MiB
llama_new_context_with_model:      CUDA5 compute buffer size =    89.10 MiB
llama_new_context_with_model:      CUDA6 compute buffer size =    89.10 MiB
llama_new_context_with_model:      CUDA7 compute buffer size =    89.10 MiB
llama_new_context_with_model:  CUDA_Host compute buffer size =     8.80 MiB
llama_new_context_with_model: graph splits (measure): 17
Available slots:
 -> Slot 0 - max context: 512
{"timestamp":1708479358,"level":"INFO","function":"main","line":2671,"message":"model loaded"}
all slots are idle and system prompt is empty, clear the KV cache
{"timestamp":1708479373,"level":"INFO","function":"log_server_request","line":2481,"message":"request","remote_addr":"10.160.158.226","remote_port":55974,"status":200,"method":"GET","path":"/","params":{}}
{"timestamp":1708479373,"level":"INFO","function":"log_server_request","line":2481,"message":"request","remote_addr":"10.160.158.226","remote_port":55974,"status":200,"method":"GET","path":"/index.js","params":{}}
{"timestamp":1708479373,"level":"INFO","function":"log_server_request","line":2481,"message":"request","remote_addr":"10.160.158.226","remote_port":55973,"status":200,"method":"GET","path":"/completion.js","params":{}}
{"timestamp":1708479373,"level":"INFO","function":"log_server_request","line":2481,"message":"request","remote_addr":"10.160.158.226","remote_port":55975,"status":200,"method":"GET","path":"/json-schema-to-grammar.mjs","params":{}}
slot 0 is processing [task id: 0]
slot 0 : in cache: 0 tokens | to process: 43 tokens
slot 0 : kv cache rm - [0, end)

print_timings: prompt eval time =     196.05 ms /    43 tokens (    4.56 ms per token,   219.33 tokens per second)
print_timings:        eval time =   10046.03 ms /   400 runs   (   25.12 ms per token,    39.82 tokens per second)
print_timings:       total time =   10242.09 ms
slot 0 released (443 tokens in cache)
{"timestamp":1708479387,"level":"INFO","function":"log_server_request","line":2481,"message":"request","remote_addr":"10.160.158.226","remote_port":55995,"status":200,"method":"POST","path":"/completion","params":{}}
slot 0 is processing [task id: 403]
slot 0 : in cache: 443 tokens | to process: 19 tokens
slot 0 : kv cache rm - [443, end)
slot 0: context shift - n_keep = 0, n_left = 510, n_discard = 255
slot 0: context shift - n_keep = 0, n_left = 510, n_discard = 255

print_timings: prompt eval time =     291.14 ms /    19 tokens (   15.32 ms per token,    65.26 tokens per second)
print_timings:        eval time =   10956.24 ms /   400 runs   (   27.39 ms per token,    36.51 tokens per second)
print_timings:       total time =   11247.38 ms
slot 0 released (352 tokens in cache)
{"timestamp":1708479594,"level":"INFO","function":"log_server_request","line":2481,"message":"request","remote_addr":"10.160.158.226","remote_port":57078,"status":200,"method":"POST","path":"/completion","params":{}}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions