16:20
@Szabolcs Especially point 3 is interesting for me. Mainly that you can use auto-vectorization and inspect the created LLVM code is a killing feature for me. And yes, since everything is open, there is no guessing, no hidden features, no surprises that you can't investigate.
One additional thing is absolutely turning me on: You can compile any julia code into a self-containing exe or library. This means, it should be fairly easy to build a LibraryLink function for Mathematica, that calls things that were implemented in Julia but you don't need any Julia on the machine that uses your package.
16:30
My current knowledge is that there are 3 possible ways to use Julia with Mathematica:
1. You can use Julia code directly by taking their C-API, initialize the julia runtime, load your file, get a pointer to the function you want to call and wrap everything nicely so that you can call it from Mathematica. You need Julia on your machine for this.
2. You use your Julia code to create a so called pre-compile Julia image. This can be loaded and it works like 1. but you have a shorter startup time.
3. You take your Julia code and create object code (or an exec). Then, calling the Julia function d…
1. You can use Julia code directly by taking their C-API, initialize the julia runtime, load your file, get a pointer to the function you want to call and wrap everything nicely so that you can call it from Mathematica. You need Julia on your machine for this.
2. You use your Julia code to create a so called pre-compile Julia image. This can be loaded and it works like 1. but you have a shorter startup time.
3. You take your Julia code and create object code (or an exec). Then, calling the Julia function d…
16:47
I'm not entirely sure myself, what my motives behind this exactly are. I guess interest is one of the driving forces, but there is also "not putting everything on one card" as you say it. Since we don't know for how long we have to stick with the old Mathematica compiler, I'm seeing an opportunity to have a way to provide fast compiled functions that can be written in a scientific language rather the C.
17:15
@xslittlegrass To give a very specific example: Assume you are working on a large matrix in Mathematica and you want to call some external function that works on the array. There is only one way to do this without copying and sending the matrix to the other language and that is to use LibraryLink and work directly on the same memory that Mathematica is using. Even if we need to copy it, it is definitely better to do the type transformation in the native object code, than sending a string.
@xslittlegrass I'm currently not using Julia on a daily basis and although I can read Python, I'm not using it. I feel your pain that finding a job related to Mathematica is not easy. In university I can use whatever I like. In industry this this different and finding a job-offer that says "We are earching for an analyst that is fluent in the Wolfram Language" is basically non-existent statistically speaking.
Personally, I'm using Mathematica, Java and Kotlin. I know my way with C/C++ although I'm not using it every day. If you consider any scientific related work, where you need a good set of mathematical stuff in your toolbox, there are indeed only a handful of modern languages. Many people use R, Python and since a few years Julia is becoming very popular. Note that these are free languages, opposed to Matlab, SPSS and other tools.
For me, it was a bit different. I started with C, Java and Haskell when I was a student. So I had seen a lot of for-loops and object-oriented code, before I saw how nice functional programming is when I had the luck to work with a professor that was incredibly smart with Haskell.
17:48
@halirutan How does your workflow look like using Java and Mathematica? For example, do you use Mathematica as the main language and Java as a supplement though JLink, or do you use them separately in different projects? When I write python or C++, I have to try very hard to suppress my temptations to switch back to Mathematica, because the implementations of in Mathematica would have been so much easier.
@halirutan I'm currently looking for job in software development in deep learning / autonomous driving. But all the jobs I interviewed so far requires the coding test in either python or c++. These coding test are problems like here leetcode.com/problemset/algorithms
18:05
@xslittlegrass How it works is that there's a C++ class for wrapping each LibraryLink type, such as MTensor, MSparseArray, etc. If you want a function that can receive a real vector from Mathematica, its argument must be of type
RealTensorRef
, which is a wrapper for (a pointer to) an MTensor.
And I want to add template support. Right now you must specify the element types of LibraryFunction arguments. You can have a real vector or an integer vector, but not an arbitrary vector that might be either.
I plan to allow specifying a list of element types (real, integer, complex) which are accepted, and have them call a template function with the corresponding type, e.g.
f<double>
, f<mint>
, etc. 18:45
@halirutan To rewrite LTemplate to work with both C++ and Julia would be a lot of work. But something analogous to LTemplate should be very feasible. LTemplate simply generates the glue code between plain LibraryLink and a C++ class. It could instead generate Julia code.
I think trying to learn Julia/other well first before attempting a Mathematica link would be more beneficial as otherwise there is always the temptation to only do the bare minimum (which might be inefficient) and fall back to Mathematica. Not that there is anything inherently wrong with that approach but you probably might be missing out on developing skills in a new language.
20:00
The LibraryLink interface approach is different. It's for connecting systems which are good at different things, like Mathematica and C++.
I do like C++ (despite everything). It is flexible enough that it has libraries that make certain scientific computing tasks very easy.
It can integrate with LTemplate quite well. E.g. Armadillo errors usually result in an exception being thrown, which LTemplate will catch and print the message in a user friendly way. Here's a very small demo I made last year: dropbox.com/s/kbxx5gtqevfbb7m/Arma.zip?dl=0
20:18
@xslittlegrass Sorry for the delay. 3 of 4 kids wanted to look Arielle and I took the time to give my eldest a hair-cut :)
I work in 2 major modes: 1. official work and 2. fun projects. For my official research, I didn't really needed more than Mathematica and Java for writing algorithms. Some years ago, I started to write an image processing library in highly parallel C++. Nowadays, I can usual work with the stuff that comes with Mathematica since speed often doesn't really matter in my experiments.
For fun projects, I look at everything that sounds sort of interesting and I take a much broader view. For instance, I dive quite regularly into website development and changed my site from Joomla, to Pelican to Jekyll, just to understand the workflow and how things are done.
Another thing are the JavaScript snippets I wrote for SE (the highlighter, the editor-additions). I don't really like JS, but I did it anyway, just for the fun of it and just because it was the right language to use in this context.
Quite recently, I got interested in Swift and Kotlin. Initially, I looked into Swift but since this particularly targets the Mac OS platform, I wouldn't have any real use for it. Kotlin is different. It's completely transparent with Java and you can mix the two languages like you want. I showed a few days ago how easy it is to call Kotlin from Mathematica just because it compiles down to JVM byte code. This is something I definitely keep in mind because the language is well designed and supports
20:49
@xslittlegrass As for your interview problem, there isn't really a solution. Knowing C++ takes years, especially if you haven't any chance to use it before. And "just learning it" won't help. You need a real project to work on. I haven't met anyone yet who was good in a language and learned it purely from tutorials.
@Szabolcs Maybe there is a middle way. What I'm thinking about is to use Julia's introspection to access the types of the functions that are exported. Knowing the C-type would reduce the problem to creating the glue between the Julia types and LibraryLink.
@Szabolcs At the moment, I don't see any use-case of "creating Julia code" from within Mathematica. There is one exception: If much of the core part of Mathematica can be translated to Julia, then we could write a better
Compile
that just uses Julias features to create fast code. But this is definitely much work. 21:16
@halirutan What I meant was that that code would be the glue between the LibraryLink API and something more convenient. LTemplate now generates C++ code which does the same, i.e. do all the
MArgument_getInteger
, etc. I think Julia is flexible enough that it can handle this without needing any extra C glue code.
1 hour later…
23:26
@Szabolcs Yes, this is my point. We got two options: we create a library function that calls Julia, passes the arguments and takes care of the necessary type-work. For this, we need the Julia engine which in itself needs some time to start up. Additionally, the Julia script that is our function needs to be compiled.
The other option that I'm more interested in doesn't need Julia at all in the end. We take a Julia script, compile it in a special way with julia and get an .o file that contains everything. This .o file needs to be linked with the LibraryLink wrapper and then you have a pure native library. No Julia required for the end-user.
« first day (2061 days earlier) ← previous day next day → last day (2724 days later) »