benchmarking: moved frontend calls and sending postfixExprs+vars outside to drastically reduce amount of calculations
Some checks are pending
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.10) (push) Waiting to run
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.6) (push) Waiting to run
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, pre) (push) Waiting to run
Some checks are pending
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.10) (push) Waiting to run
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.6) (push) Waiting to run
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, pre) (push) Waiting to run
This commit is contained in:
@ -21,8 +21,16 @@ parameters[2][1] = 5.0
|
||||
parameters[2][2] = 0.0
|
||||
|
||||
function testHelper(expression::Expr, variables::Matrix{Float32}, parameters::Vector{Vector{Float32}}, expectedResult)
|
||||
exprs = Vector([expression])
|
||||
result = Interpreter.interpret(exprs, variables, parameters)
|
||||
exprs = [ExpressionProcessing.expr_to_postfix(expression)]
|
||||
cudaExprs = Utils.create_cuda_array(exprs, ExpressionProcessing.ExpressionElement(EMPTY, 0))
|
||||
exprsLength = length(exprs)
|
||||
exprsInnerLength = Utils.get_max_inner_length(exprs)
|
||||
|
||||
X = CuArray(variables)
|
||||
variableCols = size(variables, 2)
|
||||
variableRows = size(variables, 1)
|
||||
|
||||
result = Interpreter.interpret(cudaExprs, exprsLength, exprsInnerLength, X, variableCols, variableRows, parameters)
|
||||
|
||||
expectedResult32 = convert(Float32, expectedResult)
|
||||
@test isequal(result[1,1], expectedResult32)
|
||||
@ -127,8 +135,16 @@ end
|
||||
expr1 = :((x1 + 5) * p1 - 3 / abs(x2) + (2^4) - log(8))
|
||||
expr2 = :(1 + 5 * x1 - 10^2 + (p1 - p2) / 9 + exp(x2))
|
||||
|
||||
exprs = Vector([expr1, expr2])
|
||||
result = Interpreter.interpret(exprs, var, param)
|
||||
exprs = [ExpressionProcessing.expr_to_postfix(expr1), ExpressionProcessing.expr_to_postfix(expr2)]
|
||||
cudaExprs = Utils.create_cuda_array(exprs, ExpressionProcessing.ExpressionElement(EMPTY, 0))
|
||||
exprsLength = length(exprs)
|
||||
exprsInnerLength = Utils.get_max_inner_length(exprs)
|
||||
|
||||
X = CuArray(var)
|
||||
variableCols = size(var, 2)
|
||||
variableRows = size(var, 1)
|
||||
|
||||
result = Interpreter.interpret(cudaExprs, exprsLength, exprsInnerLength, X, variableCols, variableRows, param)
|
||||
|
||||
# var set 1
|
||||
@test isapprox(result[1,1], 37.32, atol=0.01) # expr1
|
||||
|
@ -10,6 +10,7 @@ using .ExpressionProcessing
|
||||
|
||||
include("parser.jl") # to parse expressions from a file
|
||||
|
||||
# ATTENTAION: Evaluation information at the very bottom
|
||||
const BENCHMARKS_RESULTS_PATH = "./results-fh-new"
|
||||
|
||||
# Number of expressions can get really big (into millions)
|
||||
@ -68,7 +69,7 @@ suite["GPUT"]["nikuradse_1"] = @benchmarkable evaluate_gpu(exprs, X_t, parameter
|
||||
|
||||
loadparams!(suite, BenchmarkTools.load("params.json")[1], :samples, :evals, :gctrial, :time_tolerance, :evals_set, :gcsample, :seconds, :overhead, :memory_tolerance)
|
||||
|
||||
results = run(suite, verbose=true, seconds=28800) # 8 hour timeout
|
||||
results = run(suite, verbose=true, seconds=43200) # 12 hour timeout
|
||||
resultsCPU = BenchmarkTools.load("$BENCHMARKS_RESULTS_PATH/cpu.json")[1]
|
||||
|
||||
if compareWithCPU
|
||||
@ -139,3 +140,8 @@ else
|
||||
println(oldVsGPUT_std)
|
||||
end
|
||||
|
||||
|
||||
|
||||
# Initial implementation:
|
||||
# - Interpreter: no cache; 256 blocksize; exprs pre-processed and sent to GPU on every call; vars sent on every call; frontend + dispatch are multithreaded
|
||||
# - Transpiler: no cahce; 256 blocksize; exprs pre-processed and transpiled on every call; vars sent on every call; frontend + transpilation + dispatch are multithreaded
|
@ -41,19 +41,15 @@ parameters[2][1] = 5.0
|
||||
parameters[2][2] = 0.0
|
||||
parameters[3][1] = 16.0
|
||||
|
||||
@testset "TEMP" begin
|
||||
return
|
||||
exprs = [:(x1 + p1)]
|
||||
vars = Matrix{Float32}(undef, 1, 1)
|
||||
params = Vector{Vector{Float32}}(undef, 1)
|
||||
|
||||
vars[1, 1] = 1
|
||||
params[1] = [1]
|
||||
Transpiler.evaluate(exprs, vars, params)
|
||||
end
|
||||
|
||||
@testset "Test transpiler evaluation" begin
|
||||
results = Transpiler.evaluate(expressions, variables, parameters)
|
||||
variableCols = size(variables, 2)
|
||||
variableRows = size(variables, 1)
|
||||
X = CuArray(variables)
|
||||
|
||||
exprs = [ExpressionProcessing.expr_to_postfix(expressions[1]), ExpressionProcessing.expr_to_postfix(expressions[2]), ExpressionProcessing.expr_to_postfix(expressions[3])]
|
||||
|
||||
results = Transpiler.evaluate(exprs, X, variableCols, variableRows, parameters)
|
||||
|
||||
# dump(expressions[3]; maxdepth=10)
|
||||
# Expr 1:
|
||||
|
@ -12,7 +12,7 @@ include(joinpath(baseFolder, "src", "Transpiler.jl"))
|
||||
@testset "Functionality tests" begin
|
||||
# include("ExpressionProcessingTests.jl")
|
||||
# include("InterpreterTests.jl")
|
||||
# include("TranspilerTests.jl")
|
||||
include("TranspilerTests.jl")
|
||||
end
|
||||
|
||||
|
||||
@ -22,5 +22,5 @@ end
|
||||
|
||||
@testset "Performance tests" begin
|
||||
# include("PerformanceTuning.jl")
|
||||
include("PerformanceTests.jl")
|
||||
# include("PerformanceTests.jl")
|
||||
end
|
Reference in New Issue
Block a user