Last Update 2026/08/08
低スペック寄りのPCでローカルLLMを動作させた際の記録です。
LLM以外の仮想マシンなどが起動され、多少負荷がかかった状態で実行しています。
ベンチマークなどでLLMの性能を評価する内容ではありません。
LLM以外の仮想マシンなどが起動され、多少負荷がかかった状態で実行しています。
ベンチマークなどでLLMの性能を評価する内容ではありません。
検証用PC
|
OS |
Debian GNU/Linux 12 (bookworm) |
|
CPU |
Intel(R) Core(TM) i5-14400F |
|
GPU |
GeForce RTX 3060 12GB |
|
メモリ |
DDR4 PC4-25600 32GB × 4 |
|
SSD |
crucial P310 CT1000P310SSD8-JP |
構築環境 : Docker + Ollama (特別な設定などは無い状態)
検証用プロンプト
```
### 依頼内容
- コード生成
### 指示
- C言語
- コード以外の出力は不要
- 中括弧スタイルはオールマン
- テストコードも生成
- テストコードは別ファイル
- 実行用ソースファイル名 : sample_code.c
- テスト用ソースファイル名 : sample_test.c
- 標準ヘッダ以外は使用しない
- 戻り値はEXIT_SUCCESSを使用
- 関数はmain()の前で定義
### コード仕様(sample_code.c)
- コマンドラインから整数2つを取得
- [引数1]から[引数2]までをインクリメントして空白区切りで標準出力に出力
- 出力する文字列はmain()ではなく関数で生成
### コード仕様(sample_test.c)
- unity.hを使用しない
```
モデル詳細
Model
architecture granite
parameters 28.9B
context length 131072
embedding length 4096
quantization Q4_K_M
Capabilities
completion
tools
Granite 4.1 [実測結果一覧へ]
(1) temperature=---; top_p=---; top_k=--
2026-07-30
total duration: 2m33.281799933s
load duration: 2.16744806s
prompt eval count: 274 token(s)
prompt eval duration: 1.44643989s
prompt eval rate: 189.43 tokens/s
eval count: 499 token(s)
eval duration: 2m29.401429862s
eval rate: 3.34 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列用メモリはchar配列1024バイト固定
インクリメント+空白区切りで文字列用メモリに書き込み
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
文字列用メモリの解放
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
文字列生成関数を3種類の引数の組み合わせでテスト実行
(1) 整数1 < 整数2
(2) 整数1 == 整数2
(3) 整数1 < 整数2 ただし、整数1が負数
(注) LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
sample_code.c: In function ‘generate_sequence’:
sample_code.c:13:30: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
13 | size_t current_len = strlen(output);
| ^~~~~~
sample_code.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
2 | #include <stdlib.h>
+++ |+#include <string.h>
3 |
sample_code.c:13:30: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
13 | size_t current_len = strlen(output);
| ^~~~~~
sample_code.c:13:30: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
sample_code.c:15:13: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
15 | strcat(output, " ");
| ^~~~~~
sample_code.c:15:13: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
sample_code.c:15:13: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
sample_code.c:15:13: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
sample_code.c:17:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
17 | strcat(output, buffer);
| ^~~~~~
sample_code.c:17:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
$ gcc -Wall -o sample_test sample_code.c sample_test.c
sample_code.c: In function ‘generate_sequence’:
sample_code.c:13:30: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
13 | size_t current_len = strlen(output);
| ^~~~~~
sample_code.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
2 | #include <stdlib.h>
+++ |+#include <string.h>
3 |
sample_code.c:13:30: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
13 | size_t current_len = strlen(output);
| ^~~~~~
sample_code.c:13:30: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
sample_code.c:15:13: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
15 | strcat(output, " ");
| ^~~~~~
sample_code.c:15:13: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
sample_code.c:15:13: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
sample_code.c:15:13: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
sample_code.c:17:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
17 | strcat(output, buffer);
| ^~~~~~
sample_code.c:17:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
/bin/ld: /tmp/ccmpMvaQ.o: in function `main':
sample_test.c:(.text+0x16d): multiple definition of `main'; /tmp/ccR7Snv6.o:sample_code.c:(.text+0xc4): first defined here
collect2: error: ld returned 1 exit status
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
sample_code.c: In function ‘generate_sequence’:
sample_code.c:13:30: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
13 | size_t current_len = strlen(output);
| ^~~~~~
sample_code.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
2 | #include <stdlib.h>
+++ |+#include <string.h>
3 |
sample_code.c:13:30: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
13 | size_t current_len = strlen(output);
| ^~~~~~
sample_code.c:13:30: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
sample_code.c:15:13: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
15 | strcat(output, " ");
| ^~~~~~
sample_code.c:15:13: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
sample_code.c:15:13: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
sample_code.c:15:13: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
sample_code.c:17:9: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
17 | strcat(output, buffer);
| ^~~~~~
sample_code.c:17:9: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
$ ./sample_code 1 5
1 2 3 4 5
$ ./sample_code -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code 1 1
1
$ ./sample_code 5 1
$ ./sample_test
All tests passed!
(2) temperature=0.70; top_p=0.7; top_k=--
2026-07-30
total duration: 2m51.451707135s
load duration: 54.693891ms
prompt eval count: 274 token(s)
prompt eval duration: 303.862419ms
prompt eval rate: 901.72 tokens/s
eval count: 566 token(s)
eval duration: 2m50.740377159s
eval rate: 3.31 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列用メモリは最初に定義したchar配列1024バイトとは別にmallocで確保
配列サイズを超える場合はエラーを返す
インクリメント+空白区切りで配列に書き込み
配列内容を文字列用メモリにコピー
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
文字列用メモリの解放
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
文字列生成関数を3種類の引数の組み合わせでテスト実行
(1) 整数1 < 整数2
(2) 整数1 == 整数2
(3) 整数1 < 整数2 ただし、整数1が負数
(注) LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
sample_code.c: In function ‘generate_sequence’:
sample_code.c:26:5: warning: implicit declaration of function ‘strncpy’ [-Wimplicit-function-declaration]
26 | strncpy(result, buffer, index + 1);
| ^~~~~~~
sample_code.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strncpy’
2 | #include <stdlib.h>
+++ |+#include <string.h>
3 |
sample_code.c:26:5: warning: incompatible implicit declaration of built-in function ‘strncpy’ [-Wbuiltin-declaration-mismatch]
26 | strncpy(result, buffer, index + 1);
| ^~~~~~~
sample_code.c:26:5: note: include ‘<string.h>’ or provide a declaration of ‘strncpy’
$ gcc -Wall -o sample_test sample_code.c sample_test.c
sample_code.c: In function ‘generate_sequence’:
sample_code.c:26:5: warning: implicit declaration of function ‘strncpy’ [-Wimplicit-function-declaration]
26 | strncpy(result, buffer, index + 1);
| ^~~~~~~
sample_code.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strncpy’
2 | #include <stdlib.h>
+++ |+#include <string.h>
3 |
sample_code.c:26:5: warning: incompatible implicit declaration of built-in function ‘strncpy’ [-Wbuiltin-declaration-mismatch]
26 | strncpy(result, buffer, index + 1);
| ^~~~~~~
sample_code.c:26:5: note: include ‘<string.h>’ or provide a declaration of ‘strncpy’
sample_test.c: In function ‘test_generate_sequence’:
sample_test.c:13:5: warning: implicit declaration of function ‘assert’ [-Wimplicit-function-declaration]
13 | assert(strcmp(result, expected1) == 0);
| ^~~~~~
sample_test.c:4:1: note: ‘assert’ is defined in header ‘<assert.h>’; did you forget to ‘#include <assert.h>’?
3 | #include <string.h>
+++ |+#include <assert.h>
4 |
/bin/ld: /tmp/cch4V3Zi.o: in function `main':
sample_test.c:(.text+0x149): multiple definition of `main'; /tmp/ccdusXh9.o:sample_code.c:(.text+0x1ad): first defined here
/bin/ld: /tmp/cch4V3Zi.o: in function `test_generate_sequence':
sample_test.c:(.text+0x61): undefined reference to `assert'
/bin/ld: sample_test.c:(.text+0xb1): undefined reference to `assert'
/bin/ld: sample_test.c:(.text+0x113): undefined reference to `assert'
collect2: error: ld returned 1 exit status
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ vi sample_test.c ← assert.h のインクルードを追加
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
sample_code.c: In function ‘generate_sequence’:
sample_code.c:26:5: warning: implicit declaration of function ‘strncpy’ [-Wimplicit-function-declaration]
26 | strncpy(result, buffer, index + 1);
| ^~~~~~~
sample_code.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strncpy’
2 | #include <stdlib.h>
+++ |+#include <string.h>
3 |
sample_code.c:26:5: warning: incompatible implicit declaration of built-in function ‘strncpy’ [-Wbuiltin-declaration-mismatch]
26 | strncpy(result, buffer, index + 1);
| ^~~~~~~
sample_code.c:26:5: note: include ‘<string.h>’ or provide a declaration of ‘strncpy’
$ ./sample_code 1 5
1 2 3 4 5
$ ./sample_code -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code 1 1
1
$ ./sample_code 5 1
$ ./sample_test
All tests passed!
(3) temperature=0.50; top_p=0.7; top_k=--
2026-07-30
total duration: 2m27.678861052s
load duration: 1.828624507s
prompt eval count: 274 token(s)
prompt eval duration: 1.447589688s
prompt eval rate: 189.28 tokens/s
eval count: 482 token(s)
eval duration: 2m24.112825284s
eval rate: 3.34 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列長に応じたメモリの確保(エラー処理有)
インクリメント+空白区切りで文字列用メモリに書き込み
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
文字列用メモリの解放
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
文字列生成関数を4種類の引数の組み合わせでテスト実行
(1) 整数1 < 整数2
(2) 整数1 < 整数2 ただし、整数1が負数
(3) 整数1 == 整数2
(4) 整数1 < 整数2 ただし、整数1、整数2が共に2桁
(注) LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
$ gcc -Wall -o sample_test sample_code.c sample_test.c
/bin/ld: /tmp/ccse8lKC.o: in function `main':
sample_test.c:(.text+0x18f): multiple definition of `main'; /tmp/ccbvOAsA.o:sample_code.c:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
$ ./sample_code 1 5
1 2 3 4 5
$ ./sample_code -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code 1 1
1
$ ./sample_code 5 1
$ ./sample_test
All tests passed!
(4) temperature=0.30; top_p=0.7; top_k=--
2026-07-30
total duration: 2m28.013271992s
load duration: 1.810027274s
prompt eval count: 274 token(s)
prompt eval duration: 1.453015539s
prompt eval rate: 188.57 tokens/s
eval count: 482 token(s)
eval duration: 2m24.460098481s
eval rate: 3.34 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列長に応じたメモリの確保(エラー処理有)
インクリメント+空白区切りで文字列用メモリに書き込み
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し(エラー処理有)
生成文字列の標準出力への出力
文字列用メモリの解放
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
文字列生成関数を4種類の引数の組み合わせでテスト実行
(1) 整数1 < 整数2
(2) 整数1 < 整数2 ただし、整数1が負数
(3) 整数1 == 整数2
(4) 整数1 < 整数2 ただし、整数1、整数2が共に2桁
(注) LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
$ gcc -Wall -o sample_test sample_code.c sample_test.c
/bin/ld: /tmp/ccDhGIrD.o: in function `main':
sample_test.c:(.text+0x18f): multiple definition of `main'; /tmp/ccSHOogd.o:sample_code.c:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
$ ./sample_code 1 5
1 2 3 4 5
$ ./sample_code -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code 1 1
1
$ ./sample_code 5 1
$ ./sample_test
All tests passed!
(5) temperature=0.15; top_p=---; top_k=--
2026-07-30
total duration: 3m10.199960958s
load duration: 2.166113189s
prompt eval count: 274 token(s)
prompt eval duration: 1.459011515s
prompt eval rate: 187.80 tokens/s
eval count: 617 token(s)
eval duration: 3m6.187394121s
eval rate: 3.31 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列用メモリはchar配列1000バイト固定
インクリメント+空白区切りで文字列用メモリに書き込み
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
文字列用メモリの解放
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
文字列生成関数を3種類の引数の組み合わせでテスト実行
(1) 整数1 < 整数2
(2) 整数1 < 整数2 ただし、整数1が負数
(3) 整数1 == 整数2
(注) LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
$ gcc -Wall -o sample_test sample_code.c sample_test.c
/bin/ld: /tmp/ccIdcg68.o: in function `main':
sample_test.c:(.text+0x1fd): multiple definition of `main'; /tmp/ccxUHm1L.o:sample_code.c:(.text+0x73): first defined here
collect2: error: ld returned 1 exit status
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
$ ./sample_code 1 5
1 2 3 4 5
$ ./sample_code -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code 1 1
1
$ ./sample_code 5 1
$ ./sample_test
All tests passed.
(6) temperature=0.15; top_p=0.7; top_k=--
2026-07-30
total duration: 3m32.574979761s
load duration: 63.241348ms
prompt eval count: 274 token(s)
prompt eval duration: 305.661298ms
prompt eval rate: 896.42 tokens/s
eval count: 699 token(s)
eval duration: 3m31.770915438s
eval rate: 3.30 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列用メモリはchar配列1024バイト固定
インクリメント+空白区切りで文字列用メモリに書き込み
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
文字列用メモリの解放
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
文字列生成関数を3種類の引数の組み合わせでテスト実行
(1) 整数1 < 整数2
(2) 整数1 == 整数2
(3) 整数1 > 整数2
(注) LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
$ gcc -Wall -o sample_test sample_code.c sample_test.c
sample_test.c: In function ‘test_generate_sequence’:
sample_test.c:8:10: warning: unused variable ‘buffer’ [-Wunused-variable]
8 | char buffer[1024];
| ^~~~~~
/bin/ld: /tmp/ccdenFaw.o: in function `main':
sample_test.c:(.text+0x204): multiple definition of `main'; /tmp/cc9uaikU.o:sample_code.c:(.text+0x7a): first defined here
collect2: error: ld returned 1 exit status
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
sample_test.c: In function ‘test_generate_sequence’:
sample_test.c:8:10: warning: unused variable ‘buffer’ [-Wunused-variable]
8 | char buffer[1024];
| ^~~~~~
$ ./sample_code 1 5
1 2 3 4 5
$ ./sample_code -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code 1 1
1
$ ./sample_code 5 1
$ ./sample_test
Test case 1 failed: Expected '1 2 3 4 5 ', got '1 2 3 4 '
1 test(s) failed.
$ vi sample_test.c ← 生成文字列の最後尾に書き込まれる(おそらく不要)ヌル文字位置を修正
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
sample_test.c: In function ‘test_generate_sequence’:
sample_test.c:8:10: warning: unused variable ‘buffer’ [-Wunused-variable]
8 | char buffer[1024];
| ^~~~~~
$ ./sample_test
Test case 3 failed: Expected '5 4 3 2 1', got '10'
1 test(s) failed.
$ vi sample_code.c ← 生成文字列関数のバッファ配列を実行毎にリセットする仕様に修正
$ gcc -Wall -o sample_code sample_code.c
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
sample_test.c: In function ‘test_generate_sequence’:
sample_test.c:8:10: warning: unused variable ‘buffer’ [-Wunused-variable]
8 | char buffer[1024];
| ^~~~~~
$ ./sample_code 1 5
1 2 3 4 5
$ ./sample_code -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code 1 1
1
$ ./sample_code 5 1
$ ./sample_test
Test case 3 failed: Expected '5 4 3 2 1', got ''
1 test(s) failed.
$ vi sample_test.c ← Test case 3 の期待結果の文字列を空文字列に修正
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
sample_test.c: In function ‘test_generate_sequence’:
sample_test.c:8:10: warning: unused variable ‘buffer’ [-Wunused-variable]
8 | char buffer[1024];
| ^~~~~~
$ ./sample_test
All tests passed.
(7) temperature=0.15; top_p=0.5; top_k=--
2026-07-30
total duration: 3m5.649572086s
load duration: 1.799233064s
prompt eval count: 274 token(s)
prompt eval duration: 1.450364697s
prompt eval rate: 188.92 tokens/s
eval count: 604 token(s)
eval duration: 3m2.021624274s
eval rate: 3.32 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列用メモリはchar配列1024バイト固定
インクリメント+空白区切りで文字列用メモリに書き込み
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
文字列用メモリの解放
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
文字列生成関数を3種類の引数の組み合わせでテスト実行
(1) 整数1 < 整数2
(2) 整数1 > 整数2 ただし、整数1が負数
(3) 整数1 == 整数2 ただし、整数1、整数2が共に0
(注) LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
$ gcc -Wall -o sample_test sample_code.c sample_test.c
sample_test.c: In function ‘test_generate_sequence’:
sample_test.c:8:10: warning: unused variable ‘buffer’ [-Wunused-variable]
8 | char buffer[1024];
| ^~~~~~
/bin/ld: /tmp/ccVBcDjm.o: in function `main':
sample_test.c:(.text+0x18b): multiple definition of `main'; /tmp/ccJmjnLw.o:sample_code.c:(.text+0x7a): first defined here
collect2: error: ld returned 1 exit status
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
sample_test.c: In function ‘test_generate_sequence’:
sample_test.c:8:10: warning: unused variable ‘buffer’ [-Wunused-variable]
8 | char buffer[1024];
| ^~~~~~
$ ./sample_code 1 5
1 2 3 4 5
$ ./sample_code -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code 1 1
1
$ ./sample_code 5 1
$ ./sample_test
All tests passed.
(8) temperature=0.15; top_p=0.4; top_k=--
2026-07-30
total duration: 2m57.702421544s
load duration: 60.636067ms
prompt eval count: 274 token(s)
prompt eval duration: 313.812438ms
prompt eval rate: 873.13 tokens/s
eval count: 586 token(s)
eval duration: 2m56.955806981s
eval rate: 3.31 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列用メモリはchar配列1024バイト固定
インクリメント+空白区切りで文字列用メモリに書き込み
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
文字列用メモリの解放
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
文字列生成関数を3種類の引数の組み合わせでテスト実行
(1) 整数1 < 整数2
(2) 整数1 > 整数2 ただし、整数1が負数
(3) 整数1 == 整数2 ただし、整数1、整数2が共に0
(注) LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
$ gcc -Wall -o sample_test sample_code.c sample_test.c
/bin/ld: /tmp/ccIpsdK1.o: in function `main':
sample_test.c:(.text+0x1df): multiple definition of `main'; /tmp/cc8oLdGr.o:sample_code.c:(.text+0x7a): first defined here
collect2: error: ld returned 1 exit status
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
$ ./sample_code 1 5
1 2 3 4 5
$ ./sample_code -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code 1 1
1
$ ./sample_code 5 1
$ ./sample_test
All tests passed.
(9) temperature=0.15; top_p=0.7; top_k=32
2026-07-30
total duration: 3m6.805755034s
load duration: 1.804609755s
prompt eval count: 274 token(s)
prompt eval duration: 1.457980261s
prompt eval rate: 187.93 tokens/s
eval count: 606 token(s)
eval duration: 3m3.162632172s
eval rate: 3.31 tokens/s
コード生成結果の概要
・C言語による生成
・コード以外の出力無し
・コードの記述スタイルのオールマン指定を無視
・戻り値は stdlib.h の EXIT_*** を使用
・文字列生成関数
文字列用メモリはchar配列1024バイト固定
インクリメント+空白区切りで文字列用メモリに書き込み
文字列用メモリへのポインタを返す
・main()
引数個数のチェック(エラー処理有)
文字列生成関数の呼び出し
生成文字列の標準出力への出力
文字列用メモリの解放
・テストコードを別途生成
テスト対象関数の宣言
main()を伴うテストコード
文字列生成関数を3種類の引数の組み合わせでテスト実行
(1) 整数1 < 整数2
(2) 整数1 > 整数2 ただし、整数1が負数
(3) 整数1 == 整数2
(注) LLMの生成結果は毎回一定ではないため、結果によっては上記内容通りではないことが考えられます。
生成コードの実行結果
sample_code.c : 検証用プロンプトにて生成されたコードsample_test.c : 生成されたテストコード
$ gcc -Wall -o sample_code sample_code.c
$ gcc -Wall -o sample_test sample_code.c sample_test.c
sample_test.c: In function ‘test_generate_sequence’:
sample_test.c:8:10: warning: unused variable ‘buffer’ [-Wunused-variable]
8 | char buffer[1024];
| ^~~~~~
/bin/ld: /tmp/cctzqK7k.o: in function `main':
sample_test.c:(.text+0x18b): multiple definition of `main'; /tmp/cc453MpH.o:sample_code.c:(.text+0x7a): first defined here
collect2: error: ld returned 1 exit status
$ vi sample_code.c ← main()関数重複エラー解消のため条件付きコンパイル用の#ifndefマクロを追加
$ gcc -D TEST_MAIN -Wall -o sample_test sample_code.c sample_test.c
sample_test.c: In function ‘test_generate_sequence’:
sample_test.c:8:10: warning: unused variable ‘buffer’ [-Wunused-variable]
8 | char buffer[1024];
| ^~~~~~
$ ./sample_code 1 5
1 2 3 4 5
$ ./sample_code -3 3
-3 -2 -1 0 1 2 3
$ ./sample_code 1 1
1
$ ./sample_code 5 1
$ ./sample_test
All tests passed.
(10) temperature=0.15; top_p=0.7; top_k=16
2026-07-30
total duration: 2m57.547052788s
load duration: 73.420629ms
prompt eval count: 274 token(s)
prompt eval duration: 305.110465ms
prompt eval rate: 898.04 tokens/s
eval count: 583 token(s)
eval duration: 2m56.798587445s
eval rate: 3.30 tokens/s
コード生成結果の概要
生成されたコードは(8)とほぼ同一コード
テストコードのmain()の返す値の三項演算子に違い有り
(8) return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
(10) return result ? EXIT_FAILURE : EXIT_SUCCESS;
(11) temperature=0.10; top_p=0.7; top_k=--
2026-07-30
total duration: 3m6.802142768s
load duration: 2.154616383s
prompt eval count: 274 token(s)
prompt eval duration: 1.440056833s
prompt eval rate: 190.27 tokens/s
eval count: 606 token(s)
eval duration: 3m2.82905974s
eval rate: 3.31 tokens/s
コード生成結果の概要
生成されたコードは(9)とほぼ同一コード
出力の文言の順序に違い有り。出力内容自体は同一。