Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test using reframe on RLP Gitlab #543

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
stages:
- generate
- test

generate-pipeline:
stage: generate
image: julia:1.10
script:
- pip install reframe-hpc
- reframe --ci-generate=${CI_PROJECT_DIR}/pipeline.yml -c ${CI_PROJECT_DIR}/reframe/checks
artifacts:
paths:
- ${CI_PROJECT_DIR}/pipeline.yml

test-jobs:
stage: test
trigger:
include:
- artifact: pipeline.yml
job: generate-pipeline
strategy: depend
44 changes: 44 additions & 0 deletions reframe/checks/saxpy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import reframe as rfm
import reframe.utility.sanity as sn

# Requires a path
class JuliaTest(rfm.RegressionTest):
executable = 'julia'
executable_opts = ['--project=.']
tags = {'julia'}
build_system = 'CustomBuild'

julia_script = ''
julia_script_opts = []

@run_before('compile')
def setup_build(self):
self.build_system.commands = [
'julia --project=. -e "import Pkg; Pkg.resolve()"',
'julia --project=. -e "import Pkg; Pkg.instantiate()"',
]

@run_before('run')
def set_executable_opts(self):
self.executable_opts.append(self.julia_script)
self.executable_opts.extend(self.julia_script_opts)


@rfm.simple_test
class saxpy_test(JuliaTest):
valid_systems = ['*']
valid_prog_environs = ['*']

julia_script = 'saxpy.jl'

@sanity_function
def validate(self):
return sn.assert_found(r'Solution Validates', self.stdout)

@performance_function('MB/s')
def copy_bw(self):
return sn.extractsingle(r'Copy:\s+(\S+)', self.stdout, 1, float)

@performance_function('MB/s')
def saxpy_bw(self):
return sn.extractsingle(r'Saxpy:\s+(\S+)', self.stdout, 1, float)
3 changes: 3 additions & 0 deletions reframe/checks/src/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
46 changes: 46 additions & 0 deletions reframe/checks/src/saxpy.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using BenchmarkTools
using KernelAbstractions
using Random

@kernel function copy_kernel!(Z, @Const(X))
I = @index(Global)
@inbounds Z[I] = X[I]
end

@kernel function saxpy_kernel!(Z, a, @Const(X), @Const(Y))
I = @index(Global)
@inbounds Z[I] = a * X[I] + Y[I]
end

# TODO: Parse cmdline args
T = Float16
N = 1048576
BACKEND = CPU()

res_copy = @benchmark begin
kernel = copy_kernel!($BACKEND)
kernel(Z, X, ndrange = size(Z))
synchronize($BACKEND)
end setup = (
X = rand!(KernelAbstractions.zeros($BACKEND, $T, $N));
Z = KernelAbstractions.zeros($BACKEND, $T, $N)
)

res_saxpy = @benchmark begin
kernel = saxpy_kernel!($BACKEND)
kernel(Z, convert($T, 2.0), X, Y, ndrange = size(Z))
synchronize($BACKEND)
end setup = (
X = rand!(KernelAbstractions.zeros($BACKEND, $T, $N));
Y = rand!(KernelAbstractions.zeros($BACKEND, $T, $N));
Z = KernelAbstractions.zeros($BACKEND, $T, $N)
)

bytes_saxpy = 3 * sizeof(T) * N # num bytes transferred in SAXPY
bytes_copy = 2 * sizeof(T) * N # num bytes transferred in copy
time_saxpy = minimum(res_saxpy).time
time_copy = minimum(res_copy).time

println("Copy: ", bytes_copy / time_copy)
println("Saxpy: ", bytes_saxpy / time_saxpy)
println("Solution Validates")
Loading