Slashdot Mirror


Julia Language Seeks To Be the C For Numerical Computing

concealment writes in with an interview with a creator of the (fairly) new language Julia designed for number crunching. Quoting Infoworld: "InfoWorld: When you say technical computing, to what type of applications are you specifically referring? Karpinski: It's a broad category, but it's pretty much anything that involves a lot of number-crunching. In my own background, I've done a lot of linear algebra but a fair amount of statistics as well. The tool of choice for linear algebra tends to be Matlab. The tool of choice for statistics tends to be R, and I've used both of those a great deal. But they're not really interchangeable. If you want to do statistics in Matlab, it's frustrating. If you want to do linear algebra in R, it's frustrating. InfoWorld: So you developed Julia with the intent to make it easier to build technical applications? Karpinski: Yes. The idea is that it should be extremely high productivity. To that end, it's a dynamic language, so it's relatively easy to program, and it's got a very simple programming model. But it has extremely high performance, which cuts out [the need for] a third language [C], which is often [used] to get performance in any of these other languages. I should also mention NumPy, which is a contender for these areas. For Matlab, R, and NumPy, for all of these options, you need to at some point drop down into C to get performance. One of our goals explicitly is to have sufficiently good performance in Julia that you'd never have to drop down into C." The language implementation is licensed under the GPL. Lambda the Ultimate has a bit of commentary on the language, and an R programmer gives his two cents on the language.

47 of 204 comments (clear)

  1. The "C" for some field? by Anonymous Coward · · Score: 2, Funny

    You mean, ignored by almost every developer in the field in lieu of more "business-friendly" languages that add bloat and inefficiency?

    1. Re:The "C" for some field? by Anonymous Coward · · Score: 2, Insightful

      You mean, ignored by almost every developer in the field in lieu of more "business-friendly" languages that add bloat and inefficiency?

      As well as maintainability, readability, etc.

    2. Re:The "C" for some field? by BenoitRen · · Score: 3, Insightful

      As well as maintainability, readability, etc.

      You're funny. Both of these depend largely on the programmer writing the code.

    3. Re:The "C" for some field? by Lunix+Nutcase · · Score: 4, Insightful

      If you aren't writing readable and maintainable code in C that's the programmer's fault. You aren't forced to use obscure abbreviations, bizarre inline hacks, etc. There is plenty of readable and well-maintained code that has been running non-stop longer than your modern langauges have existed.

    4. Re:The "C" for some field? by arth1 · · Score: 3, Informative

      Never seen a successful language named after a person. Probably never will.

      There aren't that many, and the few there are seems to have been fairly successful. At the top of my head, I can think of Pascal, Ada Eiffel, Haskell and Ruby.

      At least Pascal had a huge impact. p-code was the frontrunner for bytecode. I'd say it dwindled because of Borland who played fast and loose with the standards, reducing its main strength of being incredibly strict and compatible for a visual IDE and proprietary extensions (Delphi). This gave it a short term flare, but probably helped kill it in the long run.

    5. Re:The "C" for some field? by jythie · · Score: 3, Interesting

      It could be argued that Ada not only had a huge effect (many language features we now thing of as standard came from Ada), but is still in use in many places, so I would call it pretty successful.

    6. Re:The "C" for some field? by swan5566 · · Score: 5, Insightful

      The problem is that a lot of researchers and scientists who write these things aren't trained in good programming practices, and most of the good programmers don't have the background to do a lot of the advanced math stuff properly.

      --
      In debates about Christianity, there are two groups: those looking for answers, and those looking to just ask questions.
    7. Re:The "C" for some field? by arth1 · · Score: 2

      Yes, all those businesses are choosing their languages in order to be uncompetitive with those that choose to implement their projects in C. And they are being run out of the market by their swifter competitors!

      Or in other words: contrary to your opinion, the facts are in, and those other languages are proving superior to C.

      Ah, the bandwagon fallacy. I wondered when it would come up.

      The problem is the definition of "superior". Most businesses are interested in getting the job done, and will use whatever is readily and cheaply available. What's superior has little or nothing to do with it, and in most cases isn't even known to those buying the work.

    8. Re:The "C" for some field? by Vegemeister · · Score: 3, Insightful

      The problem with C++ is that it has too many features, and too many ways to do the same thing. You can write complex application programs in C++ while only knowing a small subset of the language. The problem ocurs when someone comes along to maintain your code and knows a completely different subset.

    9. Re:The "C" for some field? by Raenex · · Score: 2

      Most businesses are interested in getting the job done, and will use whatever is readily and cheaply available.

      You can't argue that C isn't readily or cheaply available -- it is. Businesses switched away from C and C++ because they are too error prone and low-level, meaning programmers aren't as productive.

      Now what usually happens is to blame the programmers, or not hiring smart enough programmers, as if the programmers are there to serve the language rather than the other way around.

    10. Re:The "C" for some field? by Surt · · Score: 2

      My definition for success is success. C projects are getting beaten by other languages in the marketplace .

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    11. Re:The "C" for some field? by CSMoran · · Score: 2

      You're funny. Maintainable, readable, etc. code is mutually exclusive with numerical computing.

      Not necessarily.

      In serious number-crunching the bottlenecks tend to be localized and the 'typical' paths through the code are easier to establish. Profiling is used routinely in the field to identify hot spots. These hot spots are usually algebra, which can be offloaded to BLAS, LAPACK, FFTW and the like, or something that is easily vectorizable, where things like VML are of help. In any case, one can mostly avoid making a mess of the code with loop unrolling and trying to be more clever than an optimizing compiler. The vast majority of the code can then be written in a readable and maintaintable fashion. The programmers must be competent enough not to pass by value, ensure cache-friendliness and so on.

      The only readability nightmare is that the code is peppered with #ifdef VENDOR, #pragma omp, !$acc and the like. I prefer to turn the contrast down in the editor for these, almost to the level of comments.

      --
      Every end has half a stick.
    12. Re:The "C" for some field? by jedwidz · · Score: 5, Funny

      Then again, most of it is written by biologists.

      You mean 'evolved by biologists'. They aren't strong believers in intelligent design.

  2. Sage by donaggie03 · · Score: 5, Informative

    I use Sage quite a bit. It's basically a wrapper for almost all the mathematics software available. http://www.sagemath.org/ While you still need to drop down to C for great performance, it solves a lot of the interoperability issues discussed. In other words, take the example from the summary: from Sage, you can call Matlab commands and then immediately use the results with R commands. Sage works through a web browser, and it's based on Python, which is a plus.

    --
    Three days from now?? Thats tomorrow!! ~Peter Griffin
  3. Not This Again by eldavojohn · · Score: 3, Informative
    You know, I bet that if you spent as much time learning new languages as you did bitching about duplication in Dart, Julia, $NEW_LANGUAGE then you'd have a pretty powerful array of tools to use in programming. From one of the authors of Machine Learning for Hackers' blog:

    In my opinion, the new code in Julia is easier to read than the R code because Julia has fewer syntactic quirks than R. More importantly, the Julia code runs much faster than the R code without any real effort put into speed optimization. For the sample text I tried to decipher, the Julia code completes 50,000 iterations of the sampler in 51 seconds, while the R code completes the same 50,000 iterations in 67 minutes — making the R code more than 75 slower than the Julia code.

    That certainly caught my attention!

    The XKCD comic you cite is correct for some standards but software languages are much more complex than standards and, in fact, many of them implement common sets of core standards. Once you get specific enough, you're not talking about a standard but rather a specific implementation of how to accomplish something.

    --
    My work here is dung.
    1. Re:Not This Again by gbjbaanb · · Score: 2

      of course, if I spent as much time learning all the new languages that I am informed I should be learning, then I'd have no time left to actually use them for real work.

      I guess, for some people, that is a result.

      (or in other words, I think it's often better to write libraries for existing languages)

    2. Re:Not This Again by AchilleTalon · · Score: 3, Insightful

      Anyway, this language isn't for you. That's a specialized language for numerically intensive applications and if you have a clue about what it is, you would found this language very easy to learn. It is almost the same as all the tools (Matlab/Octave) currently used in these fields and for teaching. You aren't expected to write a Web browser in Julia.

      The performance/ease of use is the appropriate balance in this field. Usable in almost no time.

      --
      Achille Talon
      Hop!
  4. FORTRAN? by TWX · · Score: 5, Interesting

    From wikipedia: "FORTRAN is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing." Sounds to me like unless there's a particular weakness in FORTRAN that doesn't lend itself to workarounds or repair in newer versions of the language, there's already a numeric computation and scientific programming language that's well documented, mature, and widely distributed.

    --
    Do not look into laser with remaining eye.
    1. Re:FORTRAN? by Anonymous Coward · · Score: 5, Interesting

      Second that. Modern FORTRAN kicks some serious butt and has a huge user and support base. Language snobs dismiss it as antiquated but they're usually referring to versions of the language that haven't been used since the 1980's. There are good reasons that current HPC developers use mostly FORTRAN and C, like good support for parallalization, global memory functions for clustering, and efficient compilers.

      It's great that people make new tools and share them with others, but many times that effort could be put into making existing good tools even better.

    2. Re:FORTRAN? by Anonymous Coward · · Score: 3, Insightful

      From wikipedia: "FORTRAN is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing."

      Sounds to me like unless there's a particular weakness in FORTRAN that doesn't lend itself to workarounds or repair in newer versions of the language, there's already a numeric computation and scientific programming language that's well documented, mature, and widely distributed.

      Yes, you have to be concerned when someone talks about numerical computing and mentions C but skips FORTRAN.

      The GNU FORTRAN compiler is quite good (and free), but the $$$ compilers (such as the Intel FORTRAN compiler) are needed to get the speed you need to outperform other languages. Simply put, it costs serious money to do high-end professional FORTRAN development - something that is hard to take if you are coming from a background where compilers are free.

    3. Re:FORTRAN? by Anonymous Coward · · Score: 3, Insightful

      People use FORTRAN largely because it's tried and tested. We know how to code it, we know the quirks, we know how to cope with rounding issues and so forth. Similarly C is a powerhouse because fundamentally it's a simple language and it's very, very well understood. That counts a lot more for speed, in many cases. Nowadays with vast parallelisation becoming cheap, it is generally better to stick with code that you know works and trade off individual thread efficiency for strength in numbers.

      Note there's a subtle difference between people using legacy code because they're lazy and the infrastructure is there and people using legacy code because they know it works, even if there is a potentially better alternative.

      Air traffic control in the UK still runs on computers using Pentium hardware and probably won't change for at least another 10 years because when you're developing critical systems you need to know that what you're doing is robust.

    4. Re:FORTRAN? by Bill_the_Engineer · · Score: 3, Informative

      Yes and is used extensively. There are even C libraries that include FORTRAN code to numerical work quickly.

      --
      These comments are my own and do not necessarily reflect the views or opinions of my employer or colleagues...
    5. Re:FORTRAN? by Bill_the_Engineer · · Score: 2

      I work with people who use FORTAN because it's not only tried and tested but also the fastest for numerical computing.

      --
      These comments are my own and do not necessarily reflect the views or opinions of my employer or colleagues...
    6. Re:FORTRAN? by ahoffer0 · · Score: 4, Interesting

      I attended SC11 (sc11.supercomputing.org) last year. FORTRAN is still the work horse of (large-scale) numerical computing. C/C++ are popular. So are MATLAB and R. They was even a NumPy tutorial and some sessions on emerging languages like Chapel. But FORTRAN was king.

      I thought this was an interesting thread about FORTRAN v. C -- http://www.physicsforums.com/showthread.php?t=169974

      Off-topic:When it came to programming, the general drift of the conference was not toward new languages, but toward adding meta-information, vis-a-vi compiler directives.

    7. Re:FORTRAN? by gl4ss · · Score: 4, Informative

      well.. apparently this "language" has modern fortran built in.

      just open the link. there's some stats there. I don't envision huge popularity for this though.. unless he integrates/develops it into a fullblown mathlab competitor(that javascript does mandelbrot almost as fast is kind if peculiar though..). not as peculiar as "pi sum" bench being faster on javascript and julia than c++.

      "The library, mostly written in Julia itself, also integrates mature, best-of-breed C and Fortran libraries for linear algebra, random number generation, FFTs, and string processing. "

      --
      world was created 5 seconds before this post as it is.
    8. Re:FORTRAN? by plopez · · Score: 4, Informative

      Ummmm..... Fortran has supported free form format since ummmm..... 1993. All modern Fortran compilers I know of support both the old and the new formats. Cast off your old prejudices and learn what a modern programming language Fortran '08 really is.

      BTW, I believe using the "FORTRAN" has been deprecated since the 70's. It is now "Fortran".

      --
      putting the 'B' in LGBTQ+
    9. Re:FORTRAN? by MeanGene · · Score: 3, Informative

      Hey - at least Fortran does not rely on whitespace!

    10. Re:FORTRAN? by Tassach · · Score: 2

      The problem is that "modern computer langauges" are designed by PhD's in computer science who know what they learned in grad school, which is heavy on the "delegates? Anonymous functions? Closures? Reflection" axis of desiderata and pffs away questions of fast numerical support with "link to C"---mostly because something like that wouldn't be seen as New And Cool by tenure committees.

      Citation needed. Looking at the modern language landscape, what I see is are languages that were:
      a) created by lone hackers looking to scratch a personal itch (EG: Perl, Ruby)
      b) created internally by a corporation to solve an otherwise intractable engineering problem (EG: C, Erlang)
      c) created by corporations looking to sell developer seats and/or create vendor lock-in (EG: Java, Visual *, *.net)

      Languages designed primarily as academic exercises / thesis projects have historically had very small user bases outside of academia, with a few exceptions.

      Anonymous functions, closures, reflection, etc are not esoteric Ivory Tower language features that are important because they're "cool" -- they're important because they're essential for efficient metaprogramming and higher order programming.

      --
      Why is it that the proponents of "one nation under God" are so eager to get rid of "liberty and justice for all"?
    11. Re:FORTRAN? by RightwingNutjob · · Score: 2

      The main complaint against FORTRAN and C and even C++ is that because they're compiled languages, debugging is more of an effort than it is in a MATLAB script, where individual lines of code can be executed with a single mouse click. For Big Data number crunching, it actually doesn't make a bit of difference, because your program isn't going to change in the middle of a dataset, the way it might when you're just debugging or dabbling.

      I should also say that MATLAB, R, and all the rest are real programming languages, and can generally be used for all parts of a project. The complaint that statistics is painful in MATLAB is a symptom of not knowing MATLAB. I haven't used R, but I'm willing to bet the complaint that R isn't good for linear algebra is about just as credible.

      Speed for both of them is another issue altogether.

  5. It's the packages stupid! by Hatta · · Score: 4, Interesting

    What will make or break this language is the availability of addon packages for it. A lot of people who use R don't do much coding themselves. They read in data, preprocess it a little bit, and then apply one of the packages found in CRAN.

    CRAN is like CPAN, but for R instead of Perl. And we can expect similar behavior from them. Perl probably wouldn't be anyone's first choice for a project these days, but the size and scope of CPAN makes it really really easy to benefit from the work of others. This is a lot of inertia, and a big reason why Perl is still used when newer languages have significant advantages.

    There's so much software, particularly academic software, implemented in R that I just don't see it going away. e.g. the entire Bioconductor suite is implemented in R. Just about any bioinformatics paper you pick at random will refer to, if not contain R code.

    How much work are we going to have to reimplement if we want everyone to use the one true numerical programming language? And if we don't want that, isn't it just contributing to fragmentation?

    --
    Give me Classic Slashdot or give me death!
    1. Re:It's the packages stupid! by danfromsb · · Score: 3, Insightful

      Absolutely right. It is important to recognize that both Matlab and R are much more than just languages. I would also throw Mathematica into the mix too, while it is a bit slower than Matlab, its numerical capabilities have continued to grow and it incorporates a fine statistics package alongside a quality plotting and graphics package (not to mention its symbolic roots and recent introduction of dynamic gui manipulation).

      For julia to be successful it needs robust integration with quality addon packages, starting with graphics and plotting. It also needs good documentation. One thing that annoys me to no end with Python (and numpy, scipy, pylab, matplotlib) is that you have to look at 3 or 4 different websites to look up API and examples. In my mind Mathematica does this right: a single documentation library which incorporates API reference, tutorials, and common functions grouped together. At the bottom of every page it lists related functions and tutorials so it is easy to discover new API calls in the language.

  6. Numerical Python by Dr.+Tom · · Score: 5, Informative

    Robust, mature, fast, easy to use, side-by-side with .m it wins hands down, really no comparison, use Python.
    Cython if you need to make it faster for the %5 of code that is too slow.

    import numpy
    import pylab

    1. Re:Numerical Python by spike+hay · · Score: 2

      I mostly use python these days, mainly to work with FEniCS. I really don't like the syntax, though. Matlab's syntax is just so slick by comparison:

      Matlab: foo = [1 2;3 4] Python: foo= array([[1,2],[3,4]]) R: foo - matrix(c(1,2,3,4),2,2)

        A numerical language should be able to do simple tasks like this with as few keystrokes as possible.

      --
      If you don't understand any of my sayings, come to me in private and I shall take you in my German mouth.
    2. Re:Numerical Python by waives · · Score: 2

      Two words: list comprehensions. Suck it matlab.

    3. Re:Numerical Python by aisaac · · Score: 2

      I mostly use python these days [snip] Matlab's syntax is just so slick by comparison:

      Matlab: foo = [1 2;3 4] Python: foo= array([[1,2],[3,4]]) R: foo - matrix(c(1,2,3,4),2,2)

      NumPy includes a matrix library: foo=mat('1 2;3 4'). In general, Python's syntax beats Matlab's syntax
      hands down. (In this particular case there is almost a tie, but a trivial advantage for Matlab. I spend apporximately 0% of my time typing in data for array construction, and I suppose that is true of most users.) For help transitioning, see http://www.scipy.org/NumPy_for_Matlab_Users.

  7. Re:Version 3f670da0 by ifrag · · Score: 4, Funny

    What is that a hash of the source code?

    Careful... wouldn't want to give the Mozilla devs any ideas.

    --
    Fear is the mind killer.
  8. I already dislike it by GlobalEcho · · Score: 2

    This may seem petty, but one of the biggest sources of relief to me in changing from Matlab to R and Numpy was finally leaving behind that damned operator syntax where element-wise operations need to have an extra dot prepended. That is to say, if I have an array t of times and an array x of distances, I want to be able to get the corresponding array of speeds using x / t. In Matlab and Julia I must instead use x ./ t.

    It seems like no big deal, but it is unbelievable how many Matlab bugs I wrote due to that little difference. True linear algebraic operations are so rare, at least to me, that I am far happier giving them the special operators and reserving the usual operators to work element-wise.

    I also must have named arguments and default values. It's a pity, because otherwise it looks to have decent syntax, good speed and nice parallelization. For now, I'm sticking with R, numpy and C.

  9. APL? by crow · · Score: 3, Insightful

    The other obvious language to come to mind is APL. Anyone looking to write a numerical processing language should have some APL experience.

    Yes, it is a pain to learn all the symbols. Programs are incredibly dense, making them difficult to understand and debug, but there are also a lot of cool things you can do with the language. In building a new language, there's a lot of good stuff there to incorporate.

  10. Re:Why? by Entrope · · Score: 2

    Once certainly does choose MATLAB over C -- one chooses the MATLAB language over C because the former makes it much easier to represent many mathematical operations; one chooses the MATLAB libraries and execution environment because they are richer than C in mathematics building blocks. When a particular numerical analysis needs to be performed at most a few times, development time becomes a major factor in the cost, which is why people would prefer MATLAB over C -- but the MATLAB execution time might be so long that alternatives become interesting.

    (I suspect that Julia and R do not have code generation for signal processors, but Mathworks and its partner companies will gladly sell you tools that will convert a subset of MATLAB code to C or an HDL to run on an embedded system or FPGA. They will even give away free stories about how awesome those tools are, while glossing over their limitations, but hey -- they are sales pitches..)

  11. Re:Fortress by dougmc · · Score: 4, Informative

    The weakness of FORTRAN is that it entirely misses out of 50+ years of research and innovation in programming languages.

    OK, maybe the original version of Fortran, the one made 50+ years ago, missed out on "50+ years of research and innovation in programming languages", but you are aware that Fortran has been updated since then, right?

    Fortran now includes a great number of the improvements to programming languages made since then. But don't take my word for it -- check out Wikipedia's page on it. I picked Fortran 90 as a starting point, but there's been many versions of Fortran made since the first, with new features (often coming from other languages) being added all the time.

    And not only is Fortran still being actively developed, but the library of well tested and optimized numerical computing code already written it it is massive.

    I'm not saying that there's not room for a new language, and certainly, Fortran doesn't have all the features of some new languages, but your claim that Fortran "entirely misses out of 50+ years of research and innovation in programming languages" is completely and utterly wrong.

    I should also mention that they stopped calling it FORTRAN in all caps back in 1990 or so when Fortran 90 came out. Now it's just Fortran. But even the venerable FORTRAN 77 benefited greatly from programing language developments available at the time.

  12. Re:Oblig. xkcd by Noughmad · · Score: 2

    Why does the Oblig always misses the <a> tag? Even in Chrome, select + goto takes more time than a simple click.

    Because if don't know the xkcd strips by number, there's a card you might be expected to hand in as you leave.

    --
    PlusFive Slashdot reader for Android. Can post comments.
  13. Re:Version 3f670da0 by TheRaven64 · · Score: 2

    No, all distributed versioning systems use hashes for changesets. Fossil and Mercurial - distributed system systems designed by and for humans - use a monotonic counter for version numbers.

    --
    I am TheRaven on Soylent News
  14. surely when talking about speed they mean by mjwalshe · · Score: 2

    "(Did we mention it should be as fast as FORTRAN?)"

  15. Not fast at all by loufoque · · Score: 3, Informative

    They want to design a language for speed, but they already made choices in the language that hamper speed dramatically, like dynamic typing. Dynamic typing adds overhead to every function call; it's fine if your functions do a lot of work, not so much if they do relatively little and are called very often.
    It looks like if you want to write fairly low-level code, you'll still need to write it in C there...

    It also looks like their approach to parallelization is very heavy-weight and, albeit usable in clusters, it will yield both poor scalability on large systems and poor performance on simple multi-core systems.

    There is already a high-level, dynamic and accessible language for numerical computing, it's MATLAB. It wraps a lot of high-performance libraries, using them without the user even noticing it. Code in MATLAB can easily be faster than in C for some constructs because C compilers, unlike MATLAB, do not recognize some patterns and replace them by optimized library calls. For this reason, MATLAB is great when you're coding with high-level constructs, but suffers from poor performance when using low-level constructs (such as accessing data element by element) for the same reasons as pointed out above.

    A new language for high-performance numerical computing should allow both the high-level programming of MATLAB and the possibilities of a low-level statically compiled language like C. The best contender for this is C++, which has tons of high-level and fast libraries for transcendental functions, linear algebra, statistics, image processing, signal processing, etc.

    As for FORTRAN, it's great for writing one thing well and fast, but it doesn't have any mechanisms for more high-level programming or code re-use, which means it is annoying to maintain, extend, or to even guarantee consistencies between the different subroutines of a large application. It also relies a lot more on what the compiler will do, while with C/C++ there is more control on what happens with regards to vectorization, parallelization or data transfers, which can be critical for heterogeneous systems.

    1. Re:Not fast at all by Baron+von+Leezard · · Score: 3, Insightful

      Dynamic typing doesn't add any overhead when you can determine which specific method you need when generating code — which, in a dynamic language with a JIT, is very late, meaning that you can most of the time. Julia uses tons of small method definitions that call other small methods and so on, even for basic things like adding two integers, but the compiler is smart enough to compile addition into a single machine instruction. The notion that dynamic languages are slow because of their dynamism is very outdated in light of modern compiler techniques.

    2. Re:Not fast at all by loufoque · · Score: 2

      Fortran has had modularity since Fortran 90, and modern Fortran has object orientation, inheritance and polymorphism.

      First, no one is using these.
      Second, they can't compare with what other languages offer and they make no sense, which is why no one is using these.

      In terms of numerical performance the Fortran compiler will still leave the C++ compiler laying on the ground, weeping.

      Where did I say otherwise? I talked about *control* of performance, not performance that is obtained with default, automatic and built-in processes.

      So what exactly is the high-level programming feature that C++ has that Fortran doesn't?

      FORTRAN is not really low-level, but it's not really high-level either. For example, unlike a language like MATLAB, you still write loop nests, and you rely on the compiler to detect that some loop nests can be parallelized and to parallelize them (and even if it can do a bit better than in C, the compiler still can't guess everything for you). The highest level languages or library frameworks allow you to define several components that are then combined to parallelize a given computation element in a given fashion. FORTRAN typically lacks both the high-level (generic combination) and the low-level (explicit memory and parallelization management) facilities to achieve such things. It is a simple, single-purpose, non-extensible language, where you need to keep code simple and rely on compiler optimization magic.

      C++, on top of very low-level, has very high-level constructs. For example it has facilities (templates, overloading, specialization) that allow to define an domain-specific language embedded within the language itself, that can be analyzed and for which C++ code can be generated as the C++ code is compiled.
      Generative and generic programming techniques enable no-cost definition of high-level constructs with very rich semantics to which you can attach generic primitives to build the patterns and algorithmic skeletons which can be used to generate many applications within a specific domain, domain for which it is humanly known how optimization or parallelization should be done, allowing you to engineer it into the system.

      The fact that the language itself allows the compiler to be programmed enables to enrich the language with more knowledge of a particular domain and how to best deal with it. General-purpose approaches only go so far; domain-specific libraries is where most of the value is.
      Obviously, this is only really useful if you have value to add on top of the generic approaches that your compiler has built-in, or if you wish to have control over how your application makes use of the hardware.

  16. Why don't scientists use functional languages? by mbkennel · · Score: 2

    The physical world, and the hardware in the computer, is stateful, not-stateless. There is a finite amount of storage, which can be overwritten.

    The idiomatic programming model for functional language isn't like this.

    In a functional language to ensure you get fast code, you have to both have a mental model of the program, and a much more complex mental model of the transformations that your functional compiler might (or might not!) apply. This is often exceptionally hard.

    A human, like a numerical programmer, has some clever knowledge about how best to order and arrange things to map to an efficient implementation in a stateful world.

    Take, for example, a production-level SVD algorithm. You could probably express a SVD method in a functional way. Would it be fast, and have low memory usage, no needless temporaries? (in high performance computing these always go together) Well maybe but you'd have to really massage things in light of a particular implementation's optimizer & quirks. That isn't something scientists have the desire to do.

    In practice, the capability of imperative, but data-parallel languages best map to their user's knowledge and capabilities and existing technology for quality execution.