Skip to content

Commit

Permalink
minors
Browse files Browse the repository at this point in the history
  • Loading branch information
justanhduc committed May 28, 2021
1 parent ea5e493 commit 463fc11
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions auto-changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

auto-changelog --sort-commits date-desc
git add CHANGELOG.md
git commit -m "update changelog"
25 changes: 23 additions & 2 deletions error.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
enum Etype
{
WARNING,
ERROR
ERROR,
DEBUG
};

/* Declared in main.h as extern */
Expand Down Expand Up @@ -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");

Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 463fc11

Please sign in to comment.