IntelLabs / ParallelAccelerator.jl

The ParallelAccelerator package, part of the High Performance Scripting project at Intel Labs
BSD 2-Clause "Simplified" License
294 stars 32 forks source link

Failure for test_update_e.jl #36

Closed ChunlingHu closed 8 years ago

ChunlingHu commented 8 years ago

Test source code:

importall ParallelAccelerator

@acc function opt_update_e(k,n,U,E1)
     _s = 0
     for j = 1:k
         U[:,j] = tanh(U[:,j])
         v = n - sum([U[i,j]*U[i,j]  for i in 1:n])
         _s += v
         E1[j] = _s / n
     end
end

function main(m::Int, k::Int, n::Int)
    U  = Array(Float64, n, k)
    E1 = Array(Float64, k)
    fill!(U, 3)

    opt_update_e(k,n,U,E1)
    println("done")

end

main(100, 100, 200)

Error:

ERROR: LoadError: MethodError: `convert` has no method matching convert(::Type{Symbol}, ::GenSym)
This may have arisen from a call to the constructor Symbol(...),
since type constructors fall back to convert methods.
Closest candidates are:
  call{T}(::Type{T}, ::Any)
  convert(::Type{Symbol}, !Matched::AbstractString)
  convert{T}(::Type{T}, !Matched::T)
ninegua commented 8 years ago

I have a different error, but it is due to _s having Any type. Change s = 0 to s = 0. fixed the problem, and it compiles and runs fine.