Why are more and more scientists using python, ruby rather than Fortran?

Source: Internet
Author: User
Tags lapack lua

Reply content:

It is important to emphasize that language is just a tool, a tool that satisfies a particular need in a particular application scenario, and that it is not only meaningless but also friendly to get out of the application scenario. The following experience (spit Groove) are aimed at large-scale scientific computing, the PC to write an afternoon code, and then run 10 minutes of code to use Python/r/matlab/ruby, easy to get started, powerful, rich online resources, is absolutely no regrets for your choice.

Everyone's hard to use from fortran77 there, see the 80 's Fortran77 code, Chaos is simply a table. Then look at the Fortran95 code of about 2000 years, so-so, is a very structured language. Recently saw the FORTRAN2003 code (Fortran LUA interface) for about 2010 years. Abstract class, the constructor is flying everywhere, I wipe a lot of feature do not know.

So you are not criticizing Fortran, but the wayward, unstructured coding style. This is just a scientific vote. Coding standard and coding style, so the code written in Fortran is mostly chaotic, this is the user's own need to learn a, and the language itself is not very related to it. I have seen the C code written by the younger brothers and sisters, which is more magical than the Fortran version.

and C and C + + also have Goto, also have extern can not do function parameter parameter check, but did not see how you spray. Fortran also has a interface to declare the function prototype, but also did not see how you use.

For example, elemental, pure, function overloading, forall, where, Fortran95 a large part of the new function is designed for parallelism, and its syntax is also very biased toward high-dimensional large array operations, automatic parallelization (OpenMP workshare) is more than C + + Cool don't know how many times. In the case of Openmp+mpi, plus the degree of parallelism of the scale, there are advantages. There is also a thing called CAF, Coarray Fortran, specifically for the large degree of parallelism supercomputer added a lot of new syntax, it is estimated that not many people.

Not to mention that fortran2003/2008 supports object-oriented. Of course, the virtual function seems to be more than C + + missing a function, the others are complete re-engraved.

So really want to criticize, please first see fortran95/2003/2008 to criticize, even if only look at the directory or feature list. Really worth spraying is Fortran95 inside the module of the MoD file dependency problem, write Makefile is very troublesome, there is the input and output function is too weak, must rely on LUA,HDF5,NETCDF, JSON these third-party tools to support.

At the very least, you can tell you exactly what the problem is if you don't have to compile Implicit,fortran. (yes, I mean to the C + + party, the recent exercise is abused to do not want to)

If you want to do a good job of code, the degree of parallelism in the thousands of CPU core level, there is a core maintenance team, the user in hundreds of thousands of people in magnitude, the correct posture is, Fortran is responsible for the operation of dense parts, c++/c responsible for common logic and interface, Python/ruby/lua is responsible for making glue, Responsible for exposing end users who are less concerned with details. This set of things 199几 years of people are doing, the result is now people are still arguing about which a better question.

-----2016-02-07 Supplement-------
learned that Fortran2008 finally fixed the variable declaration pit, in the version prior to 2008, the variable can only be declared at the beginning of the function, the actual declaration statement may be far away from the use of the statement, and may cause a temporary variable modification of the situation, The block structure is added to the Fortran2008, the temporary variables can be generated locally, and the lifetime is explicitly indicated, and the compiler releases the temporary variable even if it is forced out using goto inside the block.
Modulemimplicit Nonecontainssubroutinetest1(a, b)integer,Intent(inch) :: ainteger, Intent( out) :: b....(EXECUTE statement)TMP1 : BLOCKinteger :: Temp_varTemp_var = a*ba = Temp_varEND BLOCKTMP1....(EXECUTE statement)End subroutinetest1End Modulem
The field of scientific computing requires a large number of matrix operations, and Fortran has natural advantages. has rewritten C + + as FORTRAN, that feeling is really sour, that piece of cycle, all into a row, not too good readability. You have class, I have module, and scientific computing doesn't need much advanced object-oriented technology, unless your goal is to write a computing library like OpenFOAM.
Take a look at the latest FORTRAN syntax, goto,do while and the like are already obsolete. Familiarity with the C-Series programming language makes it difficult to accept Fortran's grammatical habits, such as function parameter type declarations, which are as complex as the earlier C language and somewhat anti-human

Fortran hard to say and which language grammar most like, that is (Visual) basic, however, as to VB some favor of the person, I still think that the Fortran egg pain, after learning function on hold.

Another point, I did not look down on FORTRAN, there is no meaning, can not deny it in the scientific calculation of the great, and according to my preference for long key words of urine (such as VB), with Fortran to calculate the C is also a long-term plan, but to spit trough the difficulties encountered in this process

With Fortran, days in the look, implicit left hidden trouble. A goto friends scattered, unstructured world chaos. Sincerity read Java good, C and c+ Ping Bao. All sentient beings are pylab, and Fortran is a sinister frontier. Python disciple Tao Truth, remove the Fortran Mo refused.

Online Search Nine reviews Fortran has the truth this is a pseudo proposition. The existing underlying tools are already relatively complete, blas,lapack these high-performance numerical computing libraries have no need to re-write. Nonetheless, open source Blas,lapack are also written in Fortran and are being updated every year.
Each person's code for handling the data needs to be written on its own, and Python's scripting language is easy to develop and can be accepted through NumPy scipy calling Blas library performance. How many groups are full-time updates Blas and lapack, or do you need to write Fortran to develop the appropriate computing suite?
But there are many people who do the text processing in Python, which does not mean that Python writes a matrix multiplication to be more than Blas.
Finally, in the field of analog computing, Danale finally has to make a new model of the new algorithm, and integrate into the existing package. To do so would not open the Fortran and his historical legacy. Python even if, in scientific calculations, Ruby really not many people used as a Fortran Pgplot library as a dead drawing of human expression;

To make Fortran so difficult to use is beyond the imagination of systems engineering, such as the MoD compilation pit, variable declaration pit, reliance on the chain pit in fact, the academic circle is a market, the use of people less natural is a better product.
The biggest problem: Fortran poor maintenance, poor readability
-Code Style Strange
-For process language
-Goto

And do not say that the performance is increasingly not a problem, even in the pursuit of performance, C + + is no worse than Fotran.
Why are you still using FORTRAN?
-Numerical calculation of many mature Fortran libraries, we do not bother to change
-Project group legacy Code Lazy rewrite
-Commercial software two times development most only the Fortran interface General Computational physics doctoral student, spends three weeks to study Fortran language, three months development procedure, three years carries on the scientific computation. Do you need to compare the computational efficiency with the development difficulty?
I think the landlord said more and more scientists use python, ruby, rather than Fortran, may be just the personal experience of the landlord. The status of Fortran in the field of high-performance computing is currently irreplaceable.
Not to mention a lot of answers to the main FORTRAN shortcomings some one-sided:
1, Code style and maintenance: Implici rules, Goto,common variables and other syntax has long been not recommended to use, just for compatibility also support. There are always people who like to take things from the previous grammar. This is like taking out a iphone1 today, and then criticize that this cell phone is not a good use, small screen speed and slow, how people say that the Apple mobile phone is useful. In fact, the code written with Fortran90 above is better maintained.
2, development and computational efficiency: this is undoubtedly the advantage of FORTRAN, Fortran learning difficulty than c lower a grade, and strict syntax, the support of the array operation is very strong, write numerical calculation program is very cool. Some people say that the efficiency of c,matlab is not low. I think that only for the repeatedly optimized code, in the use of C and Matlab, a little careless efficiency down, and the efficiency of the FORTRAN code basically depends on your algorithm, completely for the code of the optimization is very few.
3, does not support object-oriented: Fortran currently supports some object-oriented features, said that the multi-half is not supported by the use of Fortran is not much. In addition, the object-oriented function in the field of scientific computing is really not much, generally the same object of information encapsulation is enough, do not need much advanced grammar. Look at the needs of the scientists for programming. The rise of data science has made it more and more demanding for data mining and visualization, Python is easy to use, LIB, but in its core there is no control over memory, more in-depth is not a special understanding.
For the numerical simulation, it pays more attention to the calculation efficiency and feasibility, and the allocation of memory and even acccess are strictly controlled and relatively lower. Fortran is largely preceded by a large number of numerical simulations of code left behind, but the good multi-function is indeed not too uptodate,function call on the number of argument is not controlled. The sense is now that analog C + + is the main force, strongly typed to help calculate the rigorous specifications, the Lawrence Berkeley National Laboratory LBNL Computing Group Code is C + +. Just to say, the performance of the Base Value library (Blas, LAPACK, etc.) doesn't matter with Fortran ... Fortran is just their interface language. All performance-justified implementations should be compiled by sinks.

What's more, C is also their interface language, and since C is, all normal languages can get the benefits of performance by invoking the C interface.

Since everyone's performance is good, why should we eat the FORTRAN excrement?
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.