mirror of
https://github.com/CNugteren/CLBlast.git
synced 2024-07-07 12:23:46 +02:00
Added benchmark script for small matrix sizes, testing the direct GEMM kernels
This commit is contained in:
parent
7baac46e72
commit
d7cfb6aa9b
|
@ -31,8 +31,12 @@ options("width"=170)
|
|||
|
||||
# ==================================================================================================
|
||||
|
||||
# Constants
|
||||
num_runs <- 4
|
||||
# Settings
|
||||
num_runs <- 5
|
||||
num_runs_short <- 50
|
||||
xtics_subset_threshold <- 100
|
||||
xtics_subset_stepsize <- 8
|
||||
|
||||
devices <- c("-platform","-device")
|
||||
options_string <- "-q -no_abbrv -cblas 0"
|
||||
library_names <- c("CLBlast", "clBLAS")
|
||||
|
@ -66,11 +70,21 @@ main <- function(routine_name, precision, test_names, test_values,
|
|||
executable <- paste("./clblast_client_", routine_name, sep="")
|
||||
|
||||
# Configures the outputfile
|
||||
pdf(paste(display_name, ".pdf", sep=""), height=8, width=13)
|
||||
par(mfrow=c(2, 3))
|
||||
par(oma=c(0, 0, 0, 0))
|
||||
par(mar=c(4.6, 4.4, 1.5, 0)) # bottom, left, top, right [c(5.1, 4.1, 4.1, 2.1)]
|
||||
par(mgp=c(2.8, 0.6, 0)) # location of xlab/ylab, tick-mark labels, tick marks [c(3, 1, 0)]
|
||||
file_name <- paste(display_name, ".pdf", sep="")
|
||||
if (length(test_names) == 6) {
|
||||
pdf(file_name, height=8, width=13)
|
||||
par(mfrow=c(2, 3))
|
||||
par(oma=c(0, 0, 0, 0))
|
||||
par(mar=c(4.6, 4.4, 1.5, 0)) # bottom, left, top, right [c(5.1, 4.1, 4.1, 2.1)]
|
||||
par(mgp=c(2.8, 0.6, 0)) # location of xlab/ylab, tick-mark labels, tick marks [c(3, 1, 0)]
|
||||
}
|
||||
else { # length(test_names) == 2
|
||||
pdf(file_name, height=8, width=13)
|
||||
par(mfrow=c(2, 1))
|
||||
par(oma=c(0, 0, 0, 0))
|
||||
par(mar=c(4.6, 4.4, 1.5, 0)) # bottom, left, top, right [c(5.1, 4.1, 4.1, 2.1)]
|
||||
par(mgp=c(2.8, 0.6, 0)) # location of xlab/ylab, tick-mark labels, tick marks [c(3, 1, 0)]
|
||||
}
|
||||
|
||||
# Loops over the test-cases
|
||||
for (test_id in 1:length(test_names)) {
|
||||
|
@ -169,7 +183,12 @@ plot_graph <- function(xdata, ydata, log_setting,
|
|||
main="", xlab="", ylab="",
|
||||
ylim=c(ymin, ymax), xlim=c(xmin, xmax), axes=F, "n")
|
||||
axis(side=2, las=2)
|
||||
axis(side=1, at=xdata, labels=xtics, las=2)
|
||||
if (length(xdata) > xtics_subset_threshold) { # Too many indices to print, plot only every Nth
|
||||
subset <- seq(from=1, to=length(xdata), by=xtics_subset_stepsize)
|
||||
axis(side=1, at=xdata[subset], labels=xtics[subset], las=2)
|
||||
} else {
|
||||
axis(side=1, at=xdata, labels=xtics, las=2)
|
||||
}
|
||||
title(xlab=xlabel, line=-1)
|
||||
title(ylab=ylabel, line=2)
|
||||
title(graph_title, line=-2)
|
||||
|
|
56
scripts/graphs/xgemm_small.r
Normal file
56
scripts/graphs/xgemm_small.r
Normal file
|
@ -0,0 +1,56 @@
|
|||
|
||||
# ==================================================================================================
|
||||
# This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
|
||||
# project uses a tab-size of two spaces and a max-width of 100 characters per line.
|
||||
#
|
||||
# Author(s):
|
||||
# Cedric Nugteren <www.cedricnugteren.nl>
|
||||
#
|
||||
# This file implements the performance script for small sizes of Xgemm, testing the direct kernel
|
||||
#
|
||||
# ==================================================================================================
|
||||
|
||||
# Includes the common functions
|
||||
args <- commandArgs(trailingOnly = FALSE)
|
||||
thisfile <- (normalizePath(sub("--file=", "", args[grep("--file=", args)])))
|
||||
source(file.path(dirname(thisfile), "common.r"))
|
||||
|
||||
# ==================================================================================================
|
||||
|
||||
# Settings
|
||||
routine_name <- "xgemm"
|
||||
parameters <- c("-m","-n","-k","-layout","-transA","-transB",
|
||||
"-num_steps","-step","-runs","-precision")
|
||||
precision <- 32
|
||||
|
||||
# Sets the names of the test-cases
|
||||
test_names <- list(
|
||||
"small matrices in steps of 16",
|
||||
"small matrices in steps of 1"
|
||||
)
|
||||
|
||||
# Defines the test-cases
|
||||
test_values <- list(
|
||||
list(c( 128, 128, 128, 102, 111, 111, 57, 16, num_runs_short, precision)),
|
||||
list(c( 128, 128, 128, 102, 111, 111, 385, 1, num_runs_short, precision))
|
||||
)
|
||||
|
||||
# Defines the x-labels corresponding to the test-cases
|
||||
test_xlabels <- list(
|
||||
"matrix sizes (m=n=k)",
|
||||
"matrix sizes (m=n=k)"
|
||||
)
|
||||
|
||||
# Defines the x-axis of the test-cases
|
||||
test_xaxis <- list(
|
||||
c("m", ""),
|
||||
c("m", "")
|
||||
)
|
||||
|
||||
# ==================================================================================================
|
||||
|
||||
# Start the script
|
||||
main(routine_name=routine_name, precision=precision, test_names=test_names, test_values=test_values,
|
||||
test_xlabels=test_xlabels, test_xaxis=test_xaxis, metric_gflops=TRUE)
|
||||
|
||||
# ==================================================================================================
|
Loading…
Reference in a new issue