4 ms·
As someone who likes Fortran90+ for numerics in HPC, I'd put it this way: * Pointers are required mainly so you can do pointer swaps and be sure there is no un
by m_mueller 8y ago
As someone who likes Fortran90+ for numerics in HPC, I'd put it this way:
* Pointers are required mainly so you can do pointer swaps and be sure there is no unnecessary allocation (in simulations this often means being sure there's no 10-100GB allocation each timestep, which is where it really matters).
* Pointer math is unnecessary and only there because C has no/poor support of multidimensional arrays. Use a reasonable language like Julia or Fortran instead. In fact, the potential for pointer math has a big negative impact on performance since compilers have to assume aliasing. The __restrict solution is clunky in C and completely non-standard in C++, Fortran does not require this at all (no aliasing allowed except where explicitly stated).
* For almost all usecases (except swaps) a semi-managed approach like Fortran's allocatables or Objective-C's ARC or even retain/release seems to me the most straight-forward.
- saagarjha 8y ago> Pointers are required mainly so you can do pointer swaps and be sure there is no unnecessary allocation Many languages are getting around this issue by hiding pointers in their type system, performing copy-on-write, and taking the decision of whether allocations are performed on the stack or heap out of the hands of the programmer.
- m_mueller 8y ago> out of the hands of the programmer see, and that's where these languages become really clunky for HPC purposes. A compiler/runtime with HPC support (and I think also systems programming) should provide (a) performant defaults with safety as a second (but still high) priority and (b) the ability for programmers to go and set things a certain way when it is clear to them how things should be implemented on the machine. Otherwise, in large applications, there's just too many moving parts that the compiler (optimization) can mess up. As long as we have no AGI baked into compilers it's an illusion to think that compilers will do the job of HPC engineers, so if you take away these tools we just have to look elsewhere.
- pjmlp 8y agoHave you looked at Chapel?
- m_mueller 8y agoNot yet, thanks. How does it compare to Julia?
- pjmlp 8y agoDifferent goals. Chapel is a strongly typed language designed from the ground up to replace C++ and Fortran for HPC programming in cluster environments, while removing the typical unsafe features from C and C++. Initially designed by Cray, Intel has also given an helping hand. My experience is only from language geek point of view, reading the papers. Chapel Implementers and Users Workshop 2018 papers https://chapel-lang.org/CHIUW2018.html https://chapel-lang.org/CHIUW2018.html
- m_mueller 8y ago> strongly typed language designed from the ground up to replace C++ and Fortran for HPC programming ... sounds like Julia to me ... > ... in cluster environments this is where it may be differentiating itself, AFAIK Julia has not been very focused on clustering from start, but I'm assuming it's now getting better.
- pjmlp 8y agoHasn't Julia focus been MATLAB folks mostly? In any case, the more the merrier. :)
- m_mueller 8y agoI think the idea is for it to be both machine friendly and MATLAB/python users friendly, by bringing the best of Fortran into the modern world and with a good type system. The types are very machine oriented but with nice abstractions to easily allow polymorphism.