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

CGen fails for test_update_w.jl #32

Closed ChunlingHu closed 8 years ago

ChunlingHu commented 8 years ago

source code:

importall ParallelAccelerator

@acc function opt_update_w( k, m, W, Y, E1 )
         for j = 1:k
            #w = view(W,:,j)
            #y = view(Y,:,j)
            e1 = E1[j]
            for i = 1:m
                #w[i] = y[i] - e1 * w[i]
                W[i,j] = Y[i,j] - e1 * W[i,j]
            end
        end
end

function main(m::Int, k::Int)
    Y  = Array(Float64, m, k)    # to store E{x g(w'x)} for components
    E1 = Array(Float64, k)       # store E{g'(w'x)} for components

    W  = Array(Float64, m, k)    # to store E{x g(w'x)} for components

    fill!(W, 3)
    fill!(Y, 9)
    fill!(E1, 2)
    opt_update_w(k,m,W,Y,E1)

    return W

end

main(100, 100)

error:

/tmp/tmpFboymt/cgen_output0.cpp(17): error: expected a type specifier
  void _popt_update_Wp6996(int64_t k, int64_t m,  j2c_array< double > &  W,  j2c_array< double > &  Y,  j2c_array< double > &  E1, )
                                                                                                                                   ^

/tmp/tmpFboymt/cgen_output0.cpp(125): error: expected a type specifier
  void _popt_update_Wp6996_unaliased(int64_t k, int64_t m,  j2c_array< double > & __restrict W,  j2c_array< double > & __restrict Y,  j2c_array< double > & __restrict E1, )
                                                                                                                                                                           ^

/tmp/tmpFboymt/cgen_output0.cpp(236): error: expected an expression
      _popt_update_Wp6996_unaliased(k, m, W, Y, E1, );
                                                    ^

/tmp/tmpFboymt/cgen_output0.cpp(251): error: expected an expression
          _popt_update_Wp6996(k, m, W, Y, E1, );
                                              ^

/tmp/tmpFboymt/cgen_output0.cpp(255): error: expected an expression
          _popt_update_Wp6996_unaliased(k, m, W, Y, E1, );
ninegua commented 8 years ago

Fixed. Will add test case.

ChunlingHu commented 8 years ago

I got the same error as before. Can you double check?

ninegua commented 8 years ago

I have no problem running it with latest master branch.