Giter Site home page Giter Site logo

julia-matlab-shuttle's Introduction

julia-matlab

This is a Matlab interface for calling Julia, an open-source language providing many features of a Matlab-like environment but offering many of the performance benefits of C. The primary purpose of this Matlab-Julia connector is present a way to enhance performance in Matlab without the need for writing MEX files.

NEWS

Since the author doesn't use this himself, this repository has not been maintained. If you're interested in getting it working, you'll need to start from a version of ZMQ that existed at the time this repository worked: https://github.com/timholy/ZMQancient.jl

It's also very likely that changes in julia will require additional updates.

If you're willing to put the work into it, you are free to take "ownership" (this is released under the MIT license).

Installation and configuration

First, you need ZeroMQ installed on your machine. ZeroMQ is an efficient cross-platform library (available for Windows, Mac, and Linux) used for the communicaton between Matlab and Julia. It is assumed that this is installed as a system-wide library. On (K)Ubuntu this can be installed simply using "apt-get install libzmq1". At present, version 3 of ZeroMQ seems to be too buggy to use, so you should make sure you're installing from the stable (2.x) branch.

Second, from within Matlab navigate to the "mex" directory of this repository and execute the make_mex script. This will compile the necessary MEX files. You need a compiler on your system for this to work.

Finally, configure your communications with Julia by running the julia_configure script. This will allow you to define shortcuts for both local Julia instances and instances running on remote servers. Naturally, you also have to have Julia installed, on every machine that you plan to use.

Using julia-matlab

For a local connection (which is the recommended way to start), you can launch Julia from within Matlab using the juliastart command. After that, read the help for juliacall, juliaparse, and juliasetvar. These are the three main commands that let you send data to the Julia session, perform operations on it, and return the results. Be aware that Julia will hold on to variables between calls, so you can set up fairly elaborate computations with repeated calls.

For a remote connection, you'll need to launch Julia on the remote machine, and then run the zmq_server_julia function. If you've changed any of the default ports in the Matlab julia_configure script, make sure you set the right values. For example, if you prefer to use port 5556, launch the server this way:

julia> load("zmq_server_julia.jl")

julia> run_server("tcp://*:5556")

Errors

Errors are typically reported back to the Matlab client. However, they are also mirrored on the command line of the Julia server. For that reason, if you have trouble you may prefer to launch Julia by hand rather than letting Matlab launch it for you.

If communications between Matlab and Julia get interrupted, an easy fix is often to kill the Julia instance and restart.

Limitations

It would be nice to allow CTRL-C to gracefully interrupt and recover the Julia communication. However, at present this is not implemented.

The most important part of the communication is the serializer (in juliaserialize.m). This targets Julia's native serializer. However, be aware that this is probably not the best solution, and there have been proposals to use a more standards-based serializer such as Thrift or the IPython Notebook. If you are thinking of using this repository as a model for targeting Julia from another language, you are advised to consider first working with the Julia community to implement a more standards-based serializer.

julia-matlab-shuttle's People

Contributors

rened avatar timholy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

julia-matlab-shuttle's Issues

Error building `zmq_exec.c`

Trying to build zmq_exec.c on OS X, MATLAB R2015b and ZMQ 4.1.4, getting the following error.

Error using mex
/Users/abhijithc/.julia/v0.4/julia-matlab/mex/zmq_exec.c:55:32: error: too few arguments to function call, expected 4,
have 3
  rc = zmq_send(socket, &msg, 0);
       ~~~~~~~~                ^
/usr/local/Cellar/zeromq/4.1.4/include/zmq.h:353:1: note: 'zmq_send' declared here

Installation on windows

Hi
Is this package can be used in windows? In installation, there is not documents for windows users. I try conventional method as for other packages, but fails.

Many thanks.

Resurrection

I'm thinking about trying to resurrect this package using latest ZMQ.jl (or just plain sockets) and/or Requests.jl and Matlab's webread and/or tcpclient, which did not exist when this package was written and may eliminate the need for MEX stuff.

Any words of advice, warnings, encouragement? :)

Can not find zmq_server_julia

Hi, maybe this is just a documentation issue, but I can not find were is the zmq_server_julia.jl file mentioned in the documentation and the juliaconfigure matlab command.

Thanks!

Compiling make_mex in MATLAB 2012b

Hi,

I wonder if you can help with an issue that I am seeing, I am running MATLAB on a Windows 7 machine and I would like to compile your julia-matlab code.

I have ZeroMQ installed and I am using the 32-bit version of MATLAB which has its own compiler, however when I do 'make_mex' as instructed I get the following:

make_mex
Error zmq_connect.c: .\zmq.h: 71 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 126 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 129 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 144 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 145 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 146 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 147 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 150 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 151 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 162 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 163 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 164 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 166 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 167 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 168 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 169 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 170 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 171 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 172 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 173 unrecognized declaration
Error zmq_connect.c: .\zmq.h: 174 too many errors

C:\PROGRA~2\MATLAB\R2012B\BIN\MEX.PL: Error: Compile of 'zmq_connect.c' failed.

It seems that each declaration that has the ZMQ_EXPORT definition raises an error, for example on line 71 is the definition:

ZMQ_EXPORT void zmq_version(int *major, int *minor, int *patch)

Do you know how I can resolve this issue?

Thanks in advance,

Chris

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.