From 463fc11f67f9ec136848bb1be3f7f29e4cc722b2 Mon Sep 17 00:00:00 2001 From: Duc Date: Fri, 28 May 2021 17:42:35 +0900 Subject: [PATCH] minors --- CHANGELOG.md | 6 +++--- auto-changelog | 2 ++ error.c | 25 +++++++++++++++++++++++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4e089b..06a138c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,10 +75,10 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - a fix for launching consecutive GPU jobs [`6ebe392`](https://github.com/justanhduc/task-spooler/commit/6ebe39256921d397e99cce789f7e583fa2af6f8d) - checked if should run gpu job before query free devices [`250f733`](https://github.com/justanhduc/task-spooler/commit/250f733fd1c595a147c5f5d080dcc080199c9de0) - reformatted [`e4102da`](https://github.com/justanhduc/task-spooler/commit/e4102da8722234f185218fea5b273798ef26d4f5) -- skipped job on client side if fewer gpus than required [`c3ab81d`](https://github.com/justanhduc/task-spooler/commit/c3ab81d689ea9794aec926ff766b4cb55a1523b4) +- skipped job on client side if fewer num_gpus than required [`c3ab81d`](https://github.com/justanhduc/task-spooler/commit/c3ab81d689ea9794aec926ff766b4cb55a1523b4) - free memory after query device [`820035e`](https://github.com/justanhduc/task-spooler/commit/820035ee225529ea0a5346308575a10622ca23a3) -- Revert "used nvidia-smi to find free gpus (unstable)" [`c554531`](https://github.com/justanhduc/task-spooler/commit/c5545314f59b3c0b68a863704c39a6200ded3f53) -- used nvidia-smi to find free gpus (unstable) [`a52058b`](https://github.com/justanhduc/task-spooler/commit/a52058b42e0285273e3b658e88adab92d6091dd2) +- Revert "used nvidia-smi to find free num_gpus (unstable)" [`c554531`](https://github.com/justanhduc/task-spooler/commit/c5545314f59b3c0b68a863704c39a6200ded3f53) +- used nvidia-smi to find free num_gpus (unstable) [`a52058b`](https://github.com/justanhduc/task-spooler/commit/a52058b42e0285273e3b658e88adab92d6091dd2) - fixed gpu list [`9ea170e`](https://github.com/justanhduc/task-spooler/commit/9ea170e2cd0e64e8024155326f2d854536abaa7e) - updated readme. added useful scripts [`dde0298`](https://github.com/justanhduc/task-spooler/commit/dde0298fe75e0a5f017a88d03d6934fa6131385f) - made gpu option require an argument [`9ece23a`](https://github.com/justanhduc/task-spooler/commit/9ece23a278654dfc3f7844080c51ec5c3806394d) diff --git a/auto-changelog b/auto-changelog index 714e89f..2f67b9a 100755 --- a/auto-changelog +++ b/auto-changelog @@ -1,3 +1,5 @@ +#!/bin/bash + auto-changelog --sort-commits date-desc git add CHANGELOG.md git commit -m "update changelog" diff --git a/error.c b/error.c index c1a387d..e42b832 100755 --- a/error.c +++ b/error.c @@ -21,7 +21,8 @@ enum Etype { WARNING, - ERROR + ERROR, + DEBUG }; /* Declared in main.h as extern */ @@ -99,6 +100,8 @@ static void print_error(FILE *out, enum Etype type, const char *str, va_list ap) fprintf(out, "Error\n"); else if (type == WARNING) fprintf(out, "Warning\n"); + else if (type == DEBUG) + fprintf(out, "Debug\n"); else fprintf(out, "Unknown kind of error\n"); @@ -107,7 +110,8 @@ static void print_error(FILE *out, enum Etype type, const char *str, va_list ap) vfprintf(out, str, ap); fprintf(out, "\n"); - fprintf(out, " errno %i, \"%s\"\n", real_errno, strerror(real_errno)); + if (type != DEBUG) + fprintf(out, " errno %i, \"%s\"\n", real_errno, strerror(real_errno)); } static void problem(enum Etype type, const char *str, va_list ap) @@ -161,6 +165,23 @@ void error(const char *str, ...) exit(-1); } +void debug(const char *str, ...) +{ + va_list ap; + + va_start(ap, str); + + real_errno = errno; + + if (process_type == CLIENT) + { + vfprintf(stderr, str, ap); + fputc('\n', stderr); + } + + problem(DEBUG, str, ap); +} + void error_msg(const struct Msg *m, const char *str, ...) { va_list ap;