I have given this a shot. Using the two files testOctaveJulia.m and 
testOctaveJulia.jl

testOctaveJulia.m:

if not(MPI_Initialized) MPI_Init; end
CW = MPI_Comm_Load("NEWORLD");
myrank = MPI_Comm_rank(CW);
commsize = MPI_Comm_size(CW);
sleep(myrank*0.5);
printf("I am Octave rank %d\n", myrank);        
if myrank == 0
        MPI_Send([5], 3, 0, CW);
endif        
MPI_Barrier(CW);
MPI_Finalize();

testOctaveJulia.jl:
import MPI

function main()
    MPI.Init()
    comm = MPI.COMM_WORLD
    rank = MPI.Comm_rank(comm)
    commsize = MPI.Comm_size(comm)
    sleep(rank*0.5)
    println("I am Julia rank ", rank)
    contrib = [0]
    if rank==3
        println("contrib before receive: ", contrib)
        MPI.Recv!(contrib, 0, 0, comm)
        println("contrib after receive: ", contrib)
    end    
    MPI.Barrier(comm)
    MPI.Finalize()
end
main()

I can launch using 
mpirun -np 2 octave-cli --eval testOctaveJulia : -np 3 julia 
testOctaveJulia.jl

The result is 

michael@yosemite:~/Desktop/JO$ mpirun -np 2 octave-cli --eval 
testOctaveJulia : -np 3 julia testOctaveJulia.jl
I am Octave rank 0
I am Octave rank 1
I am Julia rank 2
I am Julia rank 3
contrib before receive: [0]
contrib after receive: [2]
I am Julia rank 4

If you look at the two files, you'll see that rank 0, Octave, sends the a 
scalar array containing the number 5 to rank 3. Rank 3 is a julia instance. 
On rank 3, the variable contrib is initialized as a scalar array containing 
0. After the receive, it contains a 2.

So... it seems to be possible to send messages from Octave to Julia, but 
the contents are not received correctly. I suppose that Octave and Julia 
have different methods of serializing contents when using MPI functions, 
and that's something I don't know about. Any ideas?

Note, the Octave code requires the MPI wrappers 
at http://octave.sourceforge.net/mpi/index.html
Julia is using MPI.jl on github. In my case, both are wrapping Open MPI 
functions.



On Tuesday, April 5, 2016 at 11:30:33 AM UTC+2, michae...@gmail.com wrote:
>
> I use MPI with both Julia (using MPI.jl) and Octave (using the MPI package 
> for Octave). For both Julia and Octave, the packages are wrapping (in my 
> case) Open MPI functions. I believe that it should be possible for Julia 
> and Octave to send information back and forth via MPI. Before trying this 
> myself, does anyone have an example of something similar? Any pointers 
> would be appreciated.
>

Reply via email to