Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
f6e2bc8
vine: separate pending and ready tasks
JinZhou5042 May 1, 2025
9abf3e5
rename func name
JinZhou5042 May 2, 2025
89fd467
aggressively send tasks
JinZhou5042 May 2, 2025
fbcb4f4
just send one task
JinZhou5042 May 2, 2025
a47e419
Merge branch 'cooperative-computing-lab:master' into separate_pending…
JinZhou5042 May 25, 2025
8f234f3
use vine_schedule_have_committable_resources
May 25, 2025
2333d65
static
May 25, 2025
904b08b
vine_schedule_rotate_pending
May 25, 2025
96162e9
revert
May 25, 2025
de0d70d
adjust location
May 25, 2025
aff40f7
fix int done
May 25, 2025
8961a15
Merge branch 'cooperative-computing-lab:master' into separate_pending…
JinZhou5042 May 29, 2025
00c7300
Merge branch 'cooperative-computing-lab:master' into separate_pending…
JinZhou5042 Jun 12, 2025
b269fa3
Merge branch 'cooperative-computing-lab:master' into separate_pending…
JinZhou5042 Jun 20, 2025
7f589f2
vine_schedule_count_committable_cores
Jun 20, 2025
84c135c
Merge branch 'cooperative-computing-lab:master' into separate_pending…
JinZhou5042 Jun 27, 2025
f944fc6
Merge branch 'cooperative-computing-lab:master' into separate_pending…
JinZhou5042 Jun 27, 2025
a217aa8
merge
Jun 30, 2025
ed57fe0
Merge remote-tracking branch 'origin/separate_pending_and_ready_tasks…
Jun 30, 2025
8b9c37c
Merge branch 'cooperative-computing-lab:master' into separate_pending…
JinZhou5042 Jul 5, 2025
c9ccf6a
Merge branch 'cooperative-computing-lab:master' into separate_pending…
JinZhou5042 Sep 23, 2025
6714bca
vine: function infile load mode
Oct 13, 2025
a78dc95
specify utf-8
Oct 13, 2025
83cd050
utf-8
Oct 13, 2025
d6f2fea
vine: some bug fixes for the library code
Oct 13, 2025
d79b1ed
dttools: progress_bar src and test
Oct 14, 2025
354a6d4
add unit
Oct 14, 2025
81b228f
format issue
Oct 14, 2025
d5dad06
vine: valid link when sending message on worker
Oct 14, 2025
5b5c142
merge
Oct 14, 2025
a599721
Merge remote-tracking branch 'origin/progress-bar' into task-graph
Oct 14, 2025
ad3f0fb
Merge remote-tracking branch 'origin/worker-bug-fix' into task-graph
Oct 14, 2025
39b1d66
vine: LIST_ITERATE_REVERSE
Oct 14, 2025
e94875e
temp
Oct 14, 2025
15fe7fd
Merge remote-tracking branch 'origin/LIST_ITERATE_REVERSE' into task-…
Oct 14, 2025
40e9679
vine: task graph executor in C
Oct 14, 2025
21b25a4
simple fix
Oct 14, 2025
648071f
braces in block
Oct 14, 2025
8242136
type fix
Oct 14, 2025
c841f6c
type fix
Oct 14, 2025
39168ef
lint
Oct 14, 2025
e8c23e6
some fixes
Oct 15, 2025
ef0e8a2
bug
Oct 15, 2025
6b527b1
use proxy function and library
Oct 15, 2025
b4e5a7b
comment functions
Oct 15, 2025
1955fd1
use a separate directory
Oct 15, 2025
6b1a5db
backup
Oct 16, 2025
8cd855f
libtask
Oct 16, 2025
5cb9b49
dagvine
Oct 16, 2025
38c7cff
new interface
Oct 16, 2025
dbe57a8
api change
Oct 16, 2025
6bf5de3
new
Oct 16, 2025
2032815
vine task graph tuning
Oct 16, 2025
642d144
new version
Oct 17, 2025
3fab110
remove _task_graph
Oct 18, 2025
5b85f46
new
Oct 18, 2025
ec96041
reg
Oct 18, 2025
767988f
sog && reg
Oct 18, 2025
fa50958
sog
Oct 18, 2025
0a0dd40
milestone
Oct 19, 2025
73308fb
new files
Oct 19, 2025
90476b8
lint and format
Oct 19, 2025
256c02f
rename executor
Oct 19, 2025
ea9285f
checkpoint works
Oct 19, 2025
35243c5
update apis
Oct 19, 2025
7ba4fac
make
Oct 19, 2025
728531b
lint
Oct 19, 2025
ac40b74
make format
Oct 19, 2025
76d55c8
comment
Oct 20, 2025
31af425
Merge branch 'cooperative-computing-lab:master' into task-graph
JinZhou5042 Oct 20, 2025
945e26f
file name fix
Oct 20, 2025
5d00612
Merge branch 'cooperative-computing-lab:master' into separate_pending…
JinZhou5042 Oct 21, 2025
c668184
rename to vinedag
Oct 21, 2025
b8bca0d
add three fields
Oct 21, 2025
4beda4d
Merge remote-tracking branch 'origin/separate_pending_and_ready_tasks…
Oct 21, 2025
1575045
calculate time spent on scheduling
Oct 21, 2025
eabf0c3
Merge remote-tracking branch 'origin/separate_pending_and_ready_tasks…
Oct 21, 2025
c107a9c
gpus
Oct 22, 2025
ec0c8c5
Merge remote-tracking branch 'origin/separate_pending_and_ready_tasks…
Oct 22, 2025
cc27109
time metrics
Oct 29, 2025
a9b95b2
optimized put
Oct 29, 2025
363b5e7
lint
Oct 29, 2025
c7e9d65
lint
Oct 29, 2025
2faa0d1
time metrics
Oct 29, 2025
fd06a26
new structure
Nov 1, 2025
cca3170
git ignore
Nov 1, 2025
b8a3472
Merge branch 'cooperative-computing-lab:master' into task-graph
JinZhou5042 Nov 3, 2025
c1b4e67
revert vine_manager_put_task
Nov 3, 2025
51c13bc
Merge remote-tracking branch 'origin/task-graph' into task-graph
Nov 3, 2025
c0cc116
traverse w->current_libraries instead of w->current_tasks
Nov 3, 2025
2430286
Merge remote-tracking branch 'origin/use-current-library' into task-g…
Nov 3, 2025
a8dd136
merge
Nov 3, 2025
0372e72
revert push_task_to_ready_tasks
Nov 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dttools/src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ bucketing_manager_test
hash_table_fromkey_test
hash_table_offset_test
hash_table_benchmark
priority_queue_test
priority_queue_test
progress_bar_test
5 changes: 4 additions & 1 deletion dttools/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ SOURCES = \
priority_queue.c \
priority_queue_test.c \
process.c \
progress_bar.c \
progress_bar_test.c \
random.c \
rmonitor.c \
rmonitor_poll.c \
Expand Down Expand Up @@ -164,6 +166,7 @@ HEADERS_PUBLIC = \
macros.h \
path.h \
priority_queue.h \
progress_bar.h \
rmonitor_poll.h \
rmsummary.h \
stringtools.h \
Expand Down Expand Up @@ -193,7 +196,7 @@ PROGRAMS = $(MOST_PROGRAMS) catalog_query

SCRIPTS = cctools_gpu_autodetect
TARGETS = $(LIBRARIES) $(PRELOAD_LIBRARIES) $(PROGRAMS) $(TEST_PROGRAMS)
TEST_PROGRAMS = auth_test disk_alloc_test jx_test microbench multirun jx_count_obj_test jx_canonicalize_test jx_merge_test hash_table_offset_test hash_table_fromkey_test hash_table_benchmark histogram_test category_test jx_binary_test bucketing_base_test bucketing_manager_test priority_queue_test
TEST_PROGRAMS = auth_test disk_alloc_test jx_test microbench multirun jx_count_obj_test jx_canonicalize_test jx_merge_test hash_table_offset_test hash_table_fromkey_test hash_table_benchmark histogram_test category_test jx_binary_test bucketing_base_test bucketing_manager_test priority_queue_test progress_bar_test

all: $(TARGETS) catalog_query

Expand Down
295 changes: 295 additions & 0 deletions dttools/src/progress_bar.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
/*
Copyright (C) 2025 The University of Notre Dame
This software is distributed under the GNU General Public License.
See the file COPYING for details.
*/

/** @file progress_bar.c
Implementation of a terminal progress bar with multiple parts.
*/

#include "progress_bar.h"
#include "xxmalloc.h"
#include "macros.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <assert.h>
#include <stdint.h>
#include <inttypes.h>

/* Max bar width (in block characters) for single-line rendering. */
#define MAX_BAR_WIDTH 30
/* Typed time constants (microseconds). */
static const timestamp_t SECOND_US = 1000000ULL;
static const timestamp_t MILLISECOND_US = 1000ULL;
static const timestamp_t MICROSECOND_US = 1ULL;

/* Minimum redraw interval to avoid flicker (200ms). */
#define PROGRESS_BAR_UPDATE_INTERVAL_US (SECOND_US / 5)

#define COLOR_RESET "\033[0m"
#define COLOR_GREEN "\033[32m"
#define COLOR_CYAN "\033[38;2;0;255;255m"
#define COLOR_ORANGE "\033[38;2;255;165;0m"
#define COLOR_PURPLE "\033[38;2;128;0;128m"
#define COLOR_PINK "\033[38;2;255;192;203m"
#define COLOR_YELLOW "\033[38;2;255;255;0m"

/** Get terminal width in columns; return 80 on failure. */
static int get_terminal_width()
{
struct winsize w;

if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == -1) {
return 80;
}

return w.ws_col;
}

/** Compute bar width based on terminal and labels; clamp to bounds. */
static int compute_bar_width(const char *label, int part_text_len)
{
if (!label) {
return 0;
}

int term_width = get_terminal_width();
int label_len = strlen(label);
int bar_width = term_width - label_len - part_text_len - 28;

if (bar_width > MAX_BAR_WIDTH) {
bar_width = MAX_BAR_WIDTH;
}

if (bar_width < 10) {
bar_width = 10;
}

return (int)(bar_width * 0.8);
}

/** Render one-line progress bar with aggregated totals, progress, and elapsed time. */
static void print_progress_bar(struct ProgressBar *bar)
{
if (!bar) {
return;
}

bar->last_draw_time_us = timestamp_get();

char part_text[256];
char *ptr = part_text;
int remain = sizeof(part_text);
int written = snprintf(ptr, remain, "[");
ptr += written;
remain -= written;

uint64_t total_sum = 0;
uint64_t current_sum = 0;

bool first = true;
struct ProgressBarPart *p;
LIST_ITERATE(bar->parts, p)
{
total_sum += p->total;
current_sum += p->current;

if (!first) {
written = snprintf(ptr, remain, ", ");
ptr += written;
remain -= written;
}

written = snprintf(ptr, remain, "%s: %" PRIu64 "/%" PRIu64, p->label, p->current, p->total);
ptr += written;
remain -= written;

first = false;
}
snprintf(ptr, remain, "]");
part_text[sizeof(part_text) - 1] = '\0';

float progress = (total_sum > 0) ? ((float)current_sum / total_sum) : 0.0f;
if (progress > 1.0f) {
progress = 1.0f;
}

timestamp_t elapsed = timestamp_get() - bar->start_time_us;
int h = elapsed / (3600LL * SECOND_US);
int m = (elapsed % (3600LL * SECOND_US)) / (60LL * SECOND_US);
int s = (elapsed % (60LL * SECOND_US)) / SECOND_US;

if (bar->has_drawn_once) {
printf("\r\033[2K");
} else {
bar->has_drawn_once = 1;
}

int part_text_len = (int)(ptr - part_text) + 1;
int bar_width = compute_bar_width(bar->label, part_text_len);
int filled = (int)(progress * bar_width);

char bar_line[MAX_BAR_WIDTH * 3 + 1];
int offset = 0;
const char *block = "━";

for (int i = 0; i < filled; ++i) {
memcpy(bar_line + offset, block, 3);
offset += 3;
}

memset(bar_line + offset, ' ', (bar_width - filled));
offset += (bar_width - filled);
bar_line[offset] = '\0';

printf("%s " COLOR_GREEN "%s %" PRIu64 "/%" PRIu64 COLOR_YELLOW " %s" COLOR_CYAN " %.1f%%" COLOR_ORANGE " %02d:%02d:%02d" COLOR_RESET,
bar->label ? bar->label : "",
bar_line,
current_sum,
total_sum,
part_text,
progress * 100,
h,
m,
s);

fflush(stdout);
}

/** Create and initialize a progress bar. */
struct ProgressBar *progress_bar_init(const char *label)
{
if (!label) {
return NULL;
}

struct ProgressBar *bar = xxmalloc(sizeof(struct ProgressBar));

bar->label = xxstrdup(label);
bar->parts = list_create();
bar->start_time_us = timestamp_get();
bar->last_draw_time_us = 0;
bar->update_interval_us = PROGRESS_BAR_UPDATE_INTERVAL_US;
bar->update_interval_sec = (double)bar->update_interval_us / SECOND_US;
bar->has_drawn_once = 0;

return bar;
}

/** Set the update interval for the progress bar. */
void progress_bar_set_update_interval(struct ProgressBar *bar, double update_interval_sec)
{
if (!bar) {
return;
}

if (update_interval_sec < 0) {
update_interval_sec = 0;
}
bar->update_interval_sec = update_interval_sec;
/* Convert seconds to microseconds with saturation to avoid overflow. */
if (update_interval_sec >= (double)UINT64_MAX / (double)SECOND_US) {
bar->update_interval_us = (timestamp_t)UINT64_MAX;
} else {
bar->update_interval_us = (timestamp_t)(update_interval_sec * (double)SECOND_US);
}
}

/** Create a new part. */
struct ProgressBarPart *progress_bar_create_part(const char *label, uint64_t total)
{
if (!label) {
return NULL;
}

struct ProgressBarPart *part = xxmalloc(sizeof(struct ProgressBarPart));

part->label = xxstrdup(label);
part->total = total;
part->current = 0;

return part;
}

/** Bind a part to the progress bar. */
void progress_bar_bind_part(struct ProgressBar *bar, struct ProgressBarPart *part)
{
if (!bar || !part) {
return;
}

list_push_tail(bar->parts, part);
print_progress_bar(bar);
}

/** Set the total for a part. */
void progress_bar_set_part_total(struct ProgressBar *bar, struct ProgressBarPart *part, uint64_t new_total)
{
if (!bar || !part) {
return;
}

part->total = new_total;
}

/** Advance a part's current value, redraw if needed. */
void progress_bar_update_part(struct ProgressBar *bar, struct ProgressBarPart *part, uint64_t increment)
{
if (!bar || !part) {
return;
}

part->current += increment;
if (part->current > part->total) {
part->current = part->total;
}

timestamp_t now_us = timestamp_get();
if (!bar->has_drawn_once || (now_us - bar->last_draw_time_us) >= bar->update_interval_us) {
print_progress_bar(bar);
}
}

/** Set the start time for the progress bar. */
void progress_bar_set_start_time(struct ProgressBar *bar, timestamp_t start_time)
{
if (!bar) {
return;
}

bar->start_time_us = start_time;
}

/** Final render and newline. */
void progress_bar_finish(struct ProgressBar *bar)
{
if (!bar) {
return;
}

print_progress_bar(bar);
printf("\n");
}

/** Free the progress bar, its parts, and internal resources. */
void progress_bar_delete(struct ProgressBar *bar)
{
if (!bar) {
return;
}

free(bar->label);
struct ProgressBarPart *p;
LIST_ITERATE(bar->parts, p)
{
free(p->label);
free(p);
}
list_delete(bar->parts);
free(bar);
}
Loading
Loading