Groups 184 of 99+ julia-users › Populating RemoteChannel on julia 0.5 1 post by 1 author Patrick Belliveau Sep 26 Hi all, I'm updating some parallel Julia code to support 0.5. I see that the RemoteRef type is no longer supported. It seems I need to replace these with a mix of Future and RemoteChannel. The use of Future is clear enough but I'm unclear on the best way to use RemoteChannels, in the following context: Suppose I want to initialize an instance of some complicated composite type MyBigType on a remote worker. Later on I want to modify that instance, use it for some computations and continue storing it for another later use. On julia 0.4 I can do R = RemoteRef{Channel{Any}} R = remote_call(pid,constructMyBigType,arguments) a can then be a reusable storage location, i.e. one can do things like Rval = take!(R) Rval = computeSomething(Rval) #Modifies some fields of aval, leaves others untouched put!(R,Rval) That doesn't work on 0.5. since the RemoteRef type is gone. So far, my solution is to first send all arguments needed by the constructor function to the remote worker, then define a helper function that calls the constructor then puts it in a channel. The helper function is @everywhere begin function remoteTypeConstructor(arguments) obj = constructMyBigType(arguments) chan = Channel{MyBigType}(1) put!(chan,obj) end end Then from the master Julia process I use the following two lines of code to define the remote channel, which is a reference to the MyBigType instance stored on worker pid. sendToWorker(arguments,pid) R = RemoteChannel(()->remoteTypeConstructor(arguments), pid) Once I've defined R I can work with it using take!() and put!() just like in 0.4. The type constructor function here could possibly be computationally intensive and the resulting object could occupy a lot of memory so I'd like to have the constructor function run on the remote worker. The approach I've just defined seems to work but it's pretty awkward and could become tricky/a pain to manage if I have to write one of these helper functions for every new type of data I want to compute and store using a RemoteChannel. I'm wondering if there's a better way to do what I'm trying to do? Thanks very much, Patrick