This commit is contained in:
2026-02-19 16:55:59 +09:00
parent 535989b8ae
commit b6689f4e1a
171 changed files with 81 additions and 4 deletions
+21 -3
View File
@@ -22,17 +22,35 @@ object LlamaServerManager {
fun startServer(binPath: String, modelPath: String, port: Int, nGpuLayers: Int = 99) {
// 이미 해당 포트에서 실행 중이거나 모델 경로가 비었으면 무시합니다.
if (processes.containsKey(port) || modelPath.isBlank()) return
val os = System.getProperty("os.name").lowercase()
val arch = System.getProperty("os.arch").lowercase()
val (nGpuLayers, threads) = when {
// M3 맥: 통합 메모리 활용 최적 (99레이어, 성능코어 위주 8스레드)
os.contains("mac") && (arch.contains("arm64") || arch.contains("aarch64")) -> {
99 to 8
}
// 윈도우 NUC: Core Ultra 7은 코어가 많으므로 스레드 상향 (OpenVINO 사용 시 nGpu 조정 가능)
os.contains("win") -> {
// NUC 15 Pro (Core Ultra 7 155H)는 16코어 22스레드이므로 12~14 권장
40 to 12
}
// 인텔 맥 2017: 16GB 램 한계로 인해 CPU 위주 설정 권장
else -> {
0 to 4 // 쿼드코어 모델일 가능성이 높음
}
}
val command = listOf(
binPath,
"-m", modelPath,
"--port", port.toString(),
"-c", if (port == 8081) "512" else "8192", // 임베딩용은 컨텍스트가 짧아도 충분합니다.
"-c", if (port == 8081) "512" else "8192",
"-ngl", nGpuLayers.toString(),
"-t", "8", // M3 Pro의 성능 코어를 고려하여 6~8개 권장
"--embedding" // 임베딩 기능을 활성화합니다.
"-t", threads.toString(),
"--embedding"
)
scope.launch {
try {
val pb = ProcessBuilder(command)