Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

OptFramework failed to optimize function-Array{Any,1} is incompatible with its type in lambda Void #150

Open
ig0xb opened this issue Jul 12, 2017 · 1 comment

Comments

@ig0xb
Copy link

ig0xb commented Jul 12, 2017

Hi,

I am getting the following error when i use ParallelAccelerator.

OptFramework failed to optimize function ##load_pickle_data#322 in optimization pass ParallelAccelerator.Driver.toParallelIR with error typeOf Opr _8::Array{Any,1} is incompatible with its type in lambda Void

I am loading 5 different python pickle dataset using Pycall package and it is passed into the below function as Array to concatenate into one single array for further processing. When i run this function i get the above mentioned array.

 @acc begin
   function load_pickle_data(ROOT)
    //ROOT is the path where the files are located
    xs=[]
    ys=[]

    for b=1:5
      f=joinpath(ROOT, string("data_batch_",b))  
          //files are named as data_batch_1 and so on...
           
      X,Y = pickle_batch(f)
          //Passed to Pycall function for loading one file at a time
          // X is of type Array{UInt8,4}
          // Y is of type Array{Any,1}

      push!(xs,X)
          push!(ys,Y)

          X= nothing
      Y= nothing
    end

xscat = vcat(xs...)
yscat = vcat(ys...)

xs = nothing
ys = nothing

(1.0.*xscat,1.0.*yscat) //Return the results 
end
end

Kindly let me know what am i doing wrong if i want to optimise the function using ParallelAccelerator.

Thank You

@DrTodd13
Copy link
Member

Several comments.

  1. What operations were you hoping would be parallelized here?
  2. With the C backend (the default under Julia 0.5), the functions optimized with ParallelAccelerator need to be type stable. The above function is not. You have xs first as an array and then later as "nothing." Why are you setting the variables to "nothing" when you're done with them?
  3. ParallelAccelerator with the C backend doesn't handle "Any". So, if you have Array{Any,1}, it isn't going to support that. That should be supported with the native backend.
  4. In general, I'd suggest creating small kernels that you believe should parallelize. So, a general idea would be to split I/O from the parallel computation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants