The following program fails an assertion in from_assignment of ParallelIR. LHS is not in Defs of liveness results.
using ParallelAccelerator
@acc function kmeans(numCenter, iterNum)
D = 10
N = 10000
points = rand(D, N)
centroids = rand(D, numCenter)
for l in 1:iterNum
dist = [ Float64[sqrt(sum((points[:,i].-centroids[:,j]).^2)) for j in 1:numCenter] for i in 1:N]
labels = Int[indmin(dist[i]) for i in 1:N]
centroids = Float64[ sum(points[j,labels.==i])/sum(labels.==i) for j in 1:D, i in 1:numCenter]
end
return centroids
end
function main()
numCenter = 5
iterations = 10
centroids_out = kmeans(numCenter, iterations)
println(centroids_out)
end
main()
$ julia HPAT_kmeans_benchmark.jl
ERROR: LoadError: AssertionError:
in from_assignment at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:2556
in from_expr at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:3458
in top_level_mk_body at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir-top-exprs.jl:41
in top_level_from_exprs at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir-top-exprs.jl:786
in from_exprs at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:2154
in from_expr at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:3449
in from_lambda at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:1194
in from_expr at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:3444
in nested_function_exprs at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:2964
in mk_parfor_args_from_mmap! at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir-mk-parfor.jl:779
in from_expr at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:3509
in from_assignment at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:2538
in from_expr at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:3458
in top_level_mk_body at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir-top-exprs.jl:41
in top_level_from_exprs at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir-top-exprs.jl:786
in from_exprs at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:2154
in from_expr at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:3449
in from_lambda at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:1194
in from_expr at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:3444
in from_root at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/parallel-ir.jl:3179
in toParallelIR at /home/etotoni/.julia/v0.4/ParallelAccelerator/src/driver.jl:158
in processFuncCall at /home/etotoni/.julia/v0.4/CompilerTools/src/OptFramework.jl:336
in kmeans at /home/etotoni/.julia/v0.4/CompilerTools/src/OptFramework.jl:417
in main at /home/etotoni/pse-hpc/benchmarks2/kmeans/HPAT_kmeans_benchmark.jl:32
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
in process_options at ./client.jl:280
in _start at ./client.jl:378
while loading /home/etotoni/pse-hpc/benchmarks2/kmeans/HPAT_kmeans_benchmark.jl, in expression starting on line 36
Liveness depends on line numbers and when you change line numbers by removing "nothing" stmts from the ast you have to re-run liveness to get the line numbers correct.
The following program fails an assertion in
from_assignment
ofParallelIR
. LHS is not in Defs of liveness results.