@@ -158,12 +158,12 @@ void get_runtime_info(RuntimeInfo* info) {
158158 strncpy (info->llamafile_version , LLAMAFILE_VERSION_STRING, MAX_STRING_LENGTH - 1 );
159159 strncpy (info->llama_commit , LLAMA_COMMIT, MAX_STRING_LENGTH - 1 );
160160
161- fprintf (stderr, " \ 033 [0;35m\n " ); // Sets purple color
162- utils::print_centered (stderr, 70 , ' =' , " \033 [1mLocalScore Runtime Information\033 [0;35m" );
161+ fprintf (stderr, " %s \n " , utils::color_str ( " \ 033 [0;35m" ) ); // Sets purple color
162+ utils::print_centered (stderr, 70 , ' =' , " %sLocalScore Runtime Information%s " , utils::color_str ( " \033 [1m " ), utils::color_str ( " \033 [ 0;35m" ) );
163163 fprintf (stderr, " \n " );
164- fprintf (stderr, " %-20s \033 [1m%s \033 [22m \ n" , " llamafile version:" , info->llamafile_version );
164+ fprintf (stderr, " %-20s %s%s%s \ n" , " llamafile version:" , utils::color_str ( " \033 [1m " ), info->llamafile_version , utils::color_str ( " \033 [22m " ) );
165165 fprintf (stderr, " %-20s %s\n " , " llama.cpp commit:" , info->llama_commit );
166- fprintf (stderr, " \n ======================================================================\n\n\033 [0m" );
166+ fprintf (stderr, " \n ======================================================================\n\n %s " , utils::color_str ( " \033 [0m" ) );
167167}
168168
169169double get_mem_gb () {
@@ -194,7 +194,7 @@ void get_sys_info(SystemInfo* info) {
194194
195195 info->ram_gb = get_mem_gb ();
196196
197- utils::print_centered (stderr, 70 , ' =' , " \033 [1mSystem Information \033 [0m" );
197+ utils::print_centered (stderr, 70 , ' =' , " %sSystem Information%s " , utils::color_str ( " \033 [1m " ), utils::color_str ( " \033 [0m" ) );
198198 fprintf (stderr, " \n " );
199199 fprintf (stderr, " %-20s %s\n " , " Kernel Type:" , info->kernel_type );
200200 fprintf (stderr, " %-20s %s\n " , " Kernel Release:" , info->kernel_release );
@@ -232,11 +232,11 @@ void get_accelerator_info(AcceleratorInfo* info, cmd_params * params) {
232232 }
233233
234234 if (i == params->main_gpu ) {
235- fprintf (stderr, " \033 [0;32m" ); // Sets green color
236- utils::print_centered (stderr, 70 , ' =' , " \033 [1mActive GPU (GPU %d) Information\033 [0;32m " , i);
235+ fprintf (stderr, " %s " , utils::color_str ( " \033 [0;32m" ) ); // Sets green color
236+ utils::print_centered (stderr, 70 , ' =' , " %sActive GPU (GPU %d) Information%s " , utils::color_str ( " \033 [1m " ) , i, utils::color_str ( " \033 [0;32m " ) );
237237 fprintf (stderr, " \n " );
238238 } else {
239- fprintf (stderr, " \033 [0;90m" ); // Sets gray color
239+ fprintf (stderr, " %s " , utils::color_str ( " \033 [0;90m" ) ); // Sets gray color
240240 utils::print_centered (stderr, 70 , ' =' , " GPU %d Information" , i);
241241 fprintf (stderr, " \n " );
242242 }
@@ -245,7 +245,7 @@ void get_accelerator_info(AcceleratorInfo* info, cmd_params * params) {
245245 fprintf (stderr, " %-26s %.1f GiB\n " , " VRAM:" , rounded_memory_gb);
246246 fprintf (stderr, " %-26s %d\n " , " Streaming Multiprocessors:" , props.multiProcessorCount );
247247 fprintf (stderr, " %-26s %.1f\n " , " CUDA Capability:" , atof (props.compute ));
248- fprintf (stderr, " \n ======================================================================\n\n\033 [0m" );
248+ fprintf (stderr, " \n ======================================================================\n\n %s " , utils::color_str ( " \033 [0m" ) );
249249 }
250250 }
251251
@@ -276,14 +276,14 @@ void get_accelerator_info(AcceleratorInfo* info, cmd_params * params) {
276276 strncpy (info->manufacturer , " Apple" , MAX_STRING_LENGTH - 1 );
277277
278278
279- fprintf (stderr, " \033 [0;32m ===== GPU information =====\n\n " );
279+ fprintf (stderr, " %s ===== GPU information =====\n\n " , utils::color_str ( " \033 [0;32m " ) );
280280 fprintf (stderr, " %-26s %s\n " , " GPU Name:" , props.name );
281281 fprintf (stderr, " %-26s %.1f GiB\n " , " VRAM:" , info->total_memory_gb );
282282 fprintf (stderr, " %-26s %d\n " , " Core Count:" , props.core_count );
283283 fprintf (stderr, " %-26s %d\n " , " Metal Version:" , props.metal_version );
284284 fprintf (stderr, " %-26s %d\n " , " GPU Family:" , props.gpu_family );
285285 fprintf (stderr, " %-26s %d\n " , " Common GPU Family:" , props.gpu_family_common );
286- fprintf (stderr, " \n ======================================================================\n\n\033 [0m" );
286+ fprintf (stderr, " \n ======================================================================\n\n %s " , utils::color_str ( " \033 [0m" ) );
287287 }
288288 } else {
289289 #ifdef __x86_64__
@@ -306,7 +306,7 @@ void list_available_accelerators() {
306306 fprintf (stderr, " Apple Metal\n " );
307307 } else if (llamafile_has_cuda ()) {
308308 int count = ggml_backend_cuda_get_device_count ();
309- fprintf (stderr, " \n\033 [0;32m ==================== Available GPUs ====================\n\n " );
309+ fprintf (stderr, " \n %s ==================== Available GPUs ====================\n\n " , utils::color_str ( " \033 [0;32m " ) );
310310 for (int i = 0 ; i < count; i++) {
311311 struct ggml_cuda_device_properties props;
312312 ggml_backend_cuda_get_device_properties (i, &props);
@@ -318,7 +318,7 @@ void list_available_accelerators() {
318318 } else {
319319 fprintf (stderr, " No Accelerator support available\n " );
320320 }
321- fprintf (stderr, " \n ======================================================================\n\033 [0m" );
321+ fprintf (stderr, " \n ======================================================================\n %s " , utils::color_str ( " \033 [0m" ) );
322322}
323323
324324void get_model_info (ModelInfo *info, llama_model *model) {
0 commit comments