02 - Run Your First Workflow
Daisytuner provides workflows similar to GitHub Actions that automatically build your application, run it on multi-accelerator servers, and produce detailed compiler insights.
In this tutorial, we will set up a workflow to automatically compile and run the vector addition example from the previous chapter on different processors.
We will use the same vector addition example (benchmark.c) as in the previous chapter:
#include <stdio.h>#include <stdlib.h>#include <omp.h>
#define N 8194
int main(int argc, char** argv) { float* x = (float*)malloc(N * sizeof(float)); float* y = (float*)malloc(N * sizeof(float)); float* w = (float*)malloc(N * sizeof(float));
// Initialize arrays float alpha = 2.0f; float beta = 3.0f; for (int i = 0; i < N; i++) { x[i] = (float)i; y[i] = (float)(N - i); w[i] = 0.0f; }
double start = omp_get_wtime();
// Perform waxpby operation: w = x + a * y for (int i=0; i<N; i++) { w[i] = alpha * x[i] + beta * y[i]; }
double end = omp_get_wtime();
// Print the result for (int i = 0; i < 32; i++) { printf("w[%d] = %f, ", i, w[i]); } printf("\n");
free(x); free(y); free(w);
return 0;}Step 1: Define the Workflow
Each Daisy workflow begins with a YAML definition placed in the .daisy/ directory of your repository.
Create a file named .daisy/benchmark.yml with the following content:
on: push: branches: - main pull_request: types: [opened, reopened, synchronize, ready_for_review]
parameters: timeout: 120 partitions: - zinnia
steps: build: | # Instructions on how to build your application docc -g -O3 -docc-tune=openmp benchmark.c -o benchmark.openmp.out docc -g -O3 -docc-tune=cuda benchmark.c -o benchmark.cuda.out
run: openmp_benchmark: command: ./benchmark.openmp.out cuda_benchmark: command: ./benchmark.cuda.outThis workflow triggers on pushes to main and on pull-request updates. Just like a GitHub Action, the build and run steps execute on a runner from one of our compute partitions (in this case, zinnia), where multiple accelerators are available.
Step 2: Commit and Push
Commit the workflow file and your source code to GitHub:
git add benchmark.c .daisy/benchmark.ymlgit commit -m "Add benchmark workflow"git push origin mainStep 3: Open Daisy Dashboard
After pushing, Daisytuner automatically detects the workflow and executes it.
To inspect which parts of your code were offloaded for each backend, open the run inside the Daisy Dashboard and navigate to the Compiler tab. This view provides a detailed report of the compilation process and performance metrics.
You can find a complete example of this setup in our examples repository.