summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Bakita <jbakita@cs.unc.edu>2025-05-13 01:17:45 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2025-05-13 01:19:37 -0400
commit0084607788a196132a1cbd9df930851e38aeba7a (patch)
tree2af9762c5f39c202e228d38f7da0ea9ae2c71512
parent5b7b92b20fe638a400f9918b8da6e98c942ff5d1 (diff)
Add measure_startup_oh benchmark
Supports ECRTS'25 partitioning paper. To nicely parse the resultant output, one could use the following shell pipeline: ./measure_startup_oh 2>&1 | cut -d "=" -s -f 2 | cut -d " " -f 2 \ | tr "\n" " " | sed 's/$/r - p/' | dc
-rw-r--r--Makefile3
-rw-r--r--measure_startup_oh.c44
2 files changed, 47 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 1956d72..61e7bef 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,9 @@ preemption_logger: task_host_utilities.cu preemption_logger.cu testbench.h
12measure_launch_oh: measure_launch_oh.cu testbench.h 12measure_launch_oh: measure_launch_oh.cu testbench.h
13 $(NVCC) measure_launch_oh.cu -o measure_launch_oh 13 $(NVCC) measure_launch_oh.cu -o measure_launch_oh
14 14
15measure_startup_oh: measure_startup_oh.c testbench.h
16 $(NVCC) measure_startup_oh.c -o measure_startup_oh
17
15copy_experiments: 18copy_experiments:
16 $(MAKE) -C $@ 19 $(MAKE) -C $@
17 20
diff --git a/measure_startup_oh.c b/measure_startup_oh.c
new file mode 100644
index 0000000..56f9ea7
--- /dev/null
+++ b/measure_startup_oh.c
@@ -0,0 +1,44 @@
1/* Copyright 2025 Joshua Bakita
2 * Simple kernel that uses measure_launch_oh to measure how long CUDA
3 * initialization takes.
4 * Prints status to stderr and nothing to stdout.
5 */
6#include <time.h> // clock_gettime()
7#include <stdio.h> // fprintf(), perror()
8#include <stdlib.h> // putenv()
9#include <string.h> // strcmp()
10#include <unistd.h> // execve()
11extern char **environ;
12
13#include "testbench.h"
14
15#define measure_launch_oh "./measure_launch_oh"
16
17int main(int argc, char **argv) {
18 int *__unused, i;
19 struct timespec start;
20
21 if (argc == 2 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h"))) {
22 fprintf(stderr, "Usage: %s [environment var to apply to child (optional)]\n", argv[0]);
23 return 1;
24 }
25
26 static char* child_argv[3];
27 child_argv[0] = measure_launch_oh;
28 child_argv[1] = "1";
29 child_argv[2] = NULL;
30
31 // Use this to apply LD_PRELOAD to the child only
32 if (argv[1])
33 putenv(argv[1]);
34
35 clock_gettime(CLOCK_MONOTONIC_RAW, &start);
36 fprintf(stderr, "(%d) Starting '"measure_launch_oh"' at CLOCK_MONOTONIC_RAW = %ld ns\n",
37 getpid(), time2ns(start));
38 if (execve(measure_launch_oh, child_argv, environ)) {
39 perror("Unable to start '"measure_launch_oh"'");
40 return 1;
41 }
42
43 return 0;
44}