added operator tests. single value operators not working yet
Some checks failed
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.10) (push) Has been cancelled
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, 1.6) (push) Has been cancelled
CI / Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} (x64, ubuntu-latest, pre) (push) Has been cancelled

This commit is contained in:
2024-08-25 13:01:58 +02:00
parent 929789b6ff
commit 6a1811ae6b
3 changed files with 83 additions and 28 deletions

View File

@ -20,7 +20,7 @@ function interpret(expressions::Vector{ExpressionProcessing.PostfixType}, variab
cudaStepsize = CuArray([get_max_inner_length(expressions), get_max_inner_length(parameters), size(variables, 1)]) # max num of values per expression; max nam of parameters per expression; number of variables per expression
# each expression has nr. of variable sets (nr. of columns of the variables) results and there are n expressions
cudaResults = CuArray{Float64}(undef, length(expressions), variableCols)
cudaResults = CuArray{Float64}(undef, variableCols, length(expressions))
# Start kernel for each expression to ensure that no warp is working on different expressions
for i in eachindex(expressions)
@ -33,8 +33,6 @@ function interpret(expressions::Vector{ExpressionProcessing.PostfixType}, variab
end
# TODO: Wait for all the kernels to finish to return the result
# return cudaResults
println(cudaResults)
return cudaResults
end
@ -53,8 +51,6 @@ function interpret_expression(expressions::CuDeviceArray{ExpressionElement}, var
operationStack = MVector{MAX_STACK_SIZE, Float64}(undef) # Try to get this to function with variable size too, to allow better memory usage
operationStackTop = 0 # stores index of the last defined/valid value
# return
for setIndex in index:stride
firstVariableIndex = ((setIndex - 1) * stepsize[3]) # Exclusive
@ -76,7 +72,7 @@ function interpret_expression(expressions::CuDeviceArray{ExpressionElement}, var
operationStack[operationStackTop] = reinterpret(Float64, expressions[i].Value)
elseif expressions[i].Type == OPERATOR
# TODO Maybe put this in seperate function
type = expressions[i].Type
type = reinterpret(Operator, expressions[i].Value)
if type == ADD
operationStackTop -= 1
operationStack[operationStackTop] = operationStack[operationStackTop] + operationStack[operationStackTop + 1]