News for hackers. Stuff that matters.
Re:Switching from Common Lisp to Julia by reikonomusha on Sunday October 15, 2017 @04:16PM (#15479058)
1. The standard doesn’t guarantee double float arrays will be efficient.

Most implementations do it (CCL SBCL CMUCL ECL LW ACL SCL ...), except for a few unpopular implementations. Seven do what you want, but a couple don’t. What gives? Julia has neither a standard nor more than one implementation.

2. No efficient parametric/ad hoc polymorphism.

You can get far with inlining. You can also use libraries specifically built with this in mind. But you’re right, it’s not a built-in feature. But scientific codes are generally not super polymorphic anyway. Look at all the FORTRAN.

But besides that, Lisp let’s you build the language you want to use, and have it interoperate for the rest of the ecosystem. If you are surprised that building a language is work, then Lisp may not be the choice for you. If you’re willing to design the language you want for numerical computing, Lisp has the essential data types and primitives to allow you to do that, even portably.

If you want off-the-shelf features of Julia, then using Julia is more optimal than Lisp. If you want a language that will readily adapt without changing under your feet, without risking your programs not working 2, 10, or 25 years from now, then Lisp might be a good choice.

Re:Switching from Common Lisp to Julia by shiro on Monday October 16, 2017 @05:30AM (#15481930)
> Lisp let’s you build the language you want to use, and have it interoperate for the rest of the ecosystem.

I suspect this strength of Lisp could have undermined improvement of Lisp compilers in long term. That is, the fact that programmers can customize the language to run efficiently for their applications put less pressure to make the existing compiler better, compared to the languages that don't give programmers such flexibility.

I've worked on performance-sensitive commercial Common Lisp applications. We employed heavy macrology so that optimal instructions were generated in the performance critical regions. Effectively, it was reimplementing part of the compiler to deal with out domain-specific meta information such as parameterized types. It worked, but came with the cost of maintenance--as if we were maintaining another layer of the compiler. It was a burden. I'm sure there have been such effort spent in many other places and eventually abandoned.

Meanwhile, languages that give less power to the programmers, put lots of efforts to improving the compiler and/or the language that work more effectively with the improved compiler, and over a few decades, they have quite sophisticated compilers.

I still mostly use Lisp-family languages at work, but sometimes wonder if the power could have adverse effect in long term.

Re:Switching from Common Lisp to Julia by flavio81 on Monday October 16, 2017 @12:12PM (#15484295)
This is an excellent reply and I think it goes to the crux of the problem you were facing.

Perhaps, then, Julia makes sense in those cases.

Or, it's time for an enhanced Common Lisp implementation targeted specifically for scientific computing. I agree that one thing is "extending the language" and other is "implementing things that the compiler should have given me. "

Re:Switching from Common Lisp to Julia by reikonomusha on Monday October 16, 2017 @07:29PM (#15487493)
SBCL is already suitable for scientific computing. All that's needed are good engineers who can write good libraries.
Re:Switching from Common Lisp to Julia by lispm on Monday October 16, 2017 @03:32PM (#15486011)
'Scientific computing' is a wide area. One recent shot at is CLASP, especially to reuse scientific computing tools from the C++ world:

https://github.com/drmeister/clasp

Re:Switching from Common Lisp to Julia by baldfat on Sunday October 15, 2017 @07:28PM (#15479939)
For DSL (DOmain Specific Languages) I use R for my data work. For general computing I use to be a Python and Lua person but now I use Racket, because I can create my own DSL for what I am doing. https://beautifulracket.com/

I totally get the reason why he would go to Julia for doing data jobs. Data structures and already done libraries are very valuable.

Re:Switching from Common Lisp to Julia by lucozade on Monday October 16, 2017 @03:02AM (#15481386)
Scientific programming is heavily polymorphic. You just need to look at the interface to most well used libraries like BLAS.

Fortran and C conventionally deal with this by adding the relevant type signature to the function name.

Scientific programming is also, regularly, polymorphic in 2, (often parametric) types. This heavily motivated the design choices in Julia esp the multiple dispatch infrastructure that is descended from Dylan.

Re:Switching from Common Lisp to Julia by reikonomusha on Monday October 16, 2017 @03:41AM (#15481508)
Most scientific codes are in the end working on large arrays of floats. There are exceptions, but many scientific codes don’t at all resemble, say, general purpose template libraries.

You can make them generic, but it’s not often you gain anything at all.

Re:Switching from Common Lisp to Julia by lucozade on Monday October 16, 2017 @05:41AM (#15481977)
That's not true. At all. Almost all scientific libraries resemble template libraries but with bespoke, exposed name mangling and significant portions of the internal data structures specified in comments.

They do this, not because it's inherently a good thing, but because the advantages of using Fortran or C have outweighed the disadvantages. But where that's not true, for example in end user computing, Fortran has not been popular for decades.

What the Julia devs are attempting to do is to design a language that has the ergonomics of a Matlab or R to make scientific programmers productive whilst having the performance of a Fortran or C. They have a sophisticated type and dispatch system to help bring these goals together.

Now, their current focus appears to be more on the R/Matlab replacement than on becoming the language of choice for HPC, say. So the steady state performance is unlikely to be competitive at scale as yet.

Maybe they won't get there. Maybe the decisions they've made mean that it's effectively impossible to eek out those last few percent so we'll still have a 2 language model. I don't know but I applaud them for trying.

More, I applaud the way they have gone about their development: focus on usage, actively learning from other languages, very little linguistic dogma. I hope they succeed.

Re:Switching from Common Lisp to Julia by one-more-minute on Monday October 16, 2017 @05:50AM (#15482019)
You should check out the Celeste project [1]. Julia is a more than viable option for HPC.

https://juliacomputing.com/case-studies/celeste.html

Re:Switching from Common Lisp to Julia by lucozade on Monday October 16, 2017 @07:15AM (#15482396)
I was aware, but thank you for the link.

The fact that it can be used in an important use case is a necessary but not sufficient condition that it can replace the incumbents. Same goes for end user computing.

Now, it gives me great confidence that, without the apparent short term focus of the core devs in this field, there has been such progress as Celeste. This is a good sign that the fundamentals are right.

But I'm probably more encouraged that the community are focused on user experience and delivering an environment that scientists want to use. This is essential, IMO, and appears to be working well.

Re:Switching from Common Lisp to Julia by tavert on Thursday October 19, 2017 @05:50PM (#15511836)
Short term focused work on Celeste, by at least one of the core devs, came at a very significant opportunity cost of not having an up-to-date, usable Julia debugger.
Re:Switching from Common Lisp to Julia by chappi42 on Monday October 23, 2017 @01:02PM (#15534691)
The Julia v0.5 debugger works. Why upgrade to v0.6 when the debugger is important? I'm sure the debugger will target v1.0. And maybe it was more fun (read interesting)to work on Celeste than to support short-lived intermediary versions?
Re:Switching from Common Lisp to Julia by ChrisRackauckas on Monday October 16, 2017 @12:36PM (#15484500)
While I agree that things like arbitrary precision are niche, there's lots to gain in standard uses. Let me point out a few areas where that's already very clear:

1. Allowing arbitrary array types means your algorithm can already work on the GPU via GPUArrays.jl (https://github.com/JuliaGPU/GPUArrays.jl). This means that all differential equation, optimization, numerical linear algebra, etc. routines which internally utilize the functions which GPUArrays implements will automatically compile a special version when encountering a GPUArray that will do all computations on the GPU without any data transfer back and forth.

2. Matrix types allow the user to specify algorithms for linear solving. Numerical linear algebra is an entire field based around coming up with good algorithms for solving linear systems (\), and the whole point of the field is to specialize on the type of matrix you have. With Julia, you can set it up so that way the user passes what type of matrix they have (Tridiagonal, sparse, PETSc for multi-node parallelism, or a special matrix type with \ overloaded to do multigrid) and the optimization, differential equation, etc. routine will use the fast linear solver routine specific to the problem. This makes it easy to expose very large amounts of performance gains and specialization opportunities to the user in ways that are usually automatic (i.e. sometimes that user doesn't even have to know!).

3. Complex numbers. Large fields of scientific computing (physicists and engineers) use complex numbers. Many libraries have pitiful support for complex numbers. Generic typing helps a lot here.

Those are 3 off the top of my head, and there are many more diffeq-specific examples that have come up as users have asked to have resizing control models with discrete variables mixed in with continuous variables, etc., and this can all be handled efficiently via the type system without having to restructure the core algorithms to handle these extra features.

The key thing here is that users can add new features specific to their problem into your algorithm as they need to, without having to modify your code, just by smart uses of the type system.

Re:Switching from Common Lisp to Julia by shele on Monday October 16, 2017 @05:41AM (#15481978)
A lot of Julia code is not only generic in the element type, but also with respect to the array type: a linear solver written in Julia works on classical matrices, but also on banded real matrices or sparse arrays of BigFloats.
Re:Switching from Common Lisp to Julia by flavio81 on Monday October 16, 2017 @12:24PM (#15484379)
After reading shiro's comment below and a the comments made by Tamas (the article author), i think i understand in more depth the essence of the problem, and there's a pointed criticism made by the author: Due to performance considerations, they have a necessity for having the compiler deeply understand parametric types and apply the code optimizations accordingly.

Thus in this case Julia is a sane choice, unless some valiant, progressive Lispers want to fork one of the implementations and create a new Common Lisp implementation focused on high performance scientific computing...

Re:Switching from Common Lisp to Julia by flavio81 on Monday October 16, 2017 @03:31PM (#15486000)
>You can get far with inlining. You can also use libraries specifically built with this in mind.

This implementation of parametric types for Common Lisp looks nice:

https://github.com/cosmos72/cl-parametric-types

It allows you to do templating which additionally declares the (parametrized) types, so the compiler can optimize accordingly.

Worth a look.