// // SPDX-FileCopyrightText: Hadad // SPDX-License-Identifier: Apache-2.0 // #include "accelerator_core.hpp" #include #include #include #include void print_usage(const char* program_name) { std::cout << "Usage: " << program_name << " [options]" << std::endl; std::cout << std::endl; std::cout << "Options:" << std::endl; std::cout << " --socket PATH IPC socket path (default: /tmp/pocket_tts_accelerator.sock)" << std::endl; std::cout << " --threads N Number of worker threads (default: 2)" << std::endl; std::cout << " --memory MB Memory pool size in megabytes (default: 64)" << std::endl; std::cout << " --quiet Disable verbose logging" << std::endl; std::cout << " --help Show this help message" << std::endl; } int main(int argc, char* argv[]) { pocket_tts_accelerator::AcceleratorConfiguration configuration = pocket_tts_accelerator::AcceleratorCore::get_default_configuration(); for (int argument_index = 1; argument_index < argc; ++argument_index) { std::string argument(argv[argument_index]); if (argument == "--help" || argument == "-h") { print_usage(argv[0]); return 0; } if (argument == "--socket" && argument_index + 1 < argc) { configuration.ipc_socket_path = argv[++argument_index]; continue; } if (argument == "--threads" && argument_index + 1 < argc) { configuration.number_of_worker_threads = std::stoul(argv[++argument_index]); continue; } if (argument == "--memory" && argument_index + 1 < argc) { std::size_t memory_mb = std::stoul(argv[++argument_index]); configuration.memory_pool_size_bytes = memory_mb * 1024 * 1024; continue; } if (argument == "--quiet" || argument == "-q") { configuration.enable_verbose_logging = false; continue; } std::cerr << "Unknown argument: " << argument << std::endl; print_usage(argv[0]); return 1; } if (configuration.number_of_worker_threads < 1) { configuration.number_of_worker_threads = 1; } if (configuration.number_of_worker_threads > 2) { configuration.number_of_worker_threads = 2; } pocket_tts_accelerator::AcceleratorCore accelerator(configuration); if (!accelerator.initialize()) { std::cerr << "Failed to initialize accelerator" << std::endl; return 1; } accelerator.run(); return 0; }