02 - Run Your First Benchmark
In this small tutorial, we will walk you through setting up your first workflow.
Step 1: Create a GitHub Repository
Start by creating a new GitHub repository. For this guide, name the repository matmul-benchmark
and clone it locally.
git clone https://github.com/<your-username>/matmul-benchmark.gitcd matmul-benchmark
Step 2: Add a Benchmark (C Example)
We will benchmark a simple C program performing a matrix multiplication. Create a file named matmul.c
at the root of your repository with the following content:
#include <stdio.h>#include <stdlib.h>#include <time.h>
#define SIZE 500
void matmul(double *A, double *B, double *C, int size) { for (int i = 0; i < size; i++) for (int j = 0; j < size; j++) { C[i*size + j] = 0.0; for (int k = 0; k < size; k++) C[i*size + j] += A[i*size + k] * B[k*size + j]; }}
int main() { double *A = malloc(SIZE * SIZE * sizeof(double)); double *B = malloc(SIZE * SIZE * sizeof(double)); double *C = malloc(SIZE * SIZE * sizeof(double));
srand(time(NULL)); for (int i = 0; i < SIZE*SIZE; i++) { A[i] = (double)rand() / RAND_MAX; B[i] = (double)rand() / RAND_MAX; }
matmul(A, B, C, SIZE);
printf("Result[0]=%f\n", C[0]);
free(A); free(B); free(C);
return 0;}
Step 3: Define a Workflow
Create a directory called .daisy/
at the root of your repository:
mkdir .daisy
Inside .daisy/
, create a workflow file named benchmark.yml
with the following minimal configuration:
on: push: branches: - main
parameters: partitions: - bellis4
steps: build: | # Update and install dependencies sudo apt-get update sudo apt-get install -y build-essential
# Compile the benchmark gcc -O2 -g matmul.c -o matmul.out
run: matmul: command: ./matmul.out measurements: 1
This workflow
- triggers automatically upon every push to the main branch.
- runs your benchmark on the bellis4 partition of our cluster.
- measures the benchmark’s runtime.
Step 4: Commit and Push the Changes
Commit the files and push them to GitHub:
git add matmul.c .daisy/benchmark.ymlgit commit -m "Add matmul benchmark and workflow"git push origin main
Step 5: Run Your First Benchmark
After pushing your changes, Daisytuner will automatically detect your workflow and execute your benchmark on our cluster.
You can track progress in two places:
- GitHub: Status checks will appear directly.
- Dashboard: Real-time logs and status updates can be found here. Make sure you are logged into the app with your Github account.
Congratulations! 🎉 You have successfully run your first benchmark using Daisytuner.