3 ms·
I don't know what the state of things is right now, but if Fortran is the language of choice for HPC, then explain to me why it's so hard to write portable code
by stabbles 3y ago
I don't know what the state of things is right now, but if Fortran is the language of choice for HPC, then explain to me why it's so hard to write portable code that targets accelerators.
Some folks have attempted to port Fortran projects to CUDA fortran, but that only targets Nvidia GPUs. Then there was openmp 5, but barely any compiler to target AMD gpus.
New HPC projects are written in C++ exactly because it's much easier to target various GPUs in the same code base.
Happy to be convinced otherwise, but this is what I've observed
- ivanpribec 3y agoHistorically, it has been easier for vendors to work in their own walled gardens, and get customers locked in, than it is to collaborate on open standards and APIs.
- jokteur 3y agoI agree with you. The thing is, compared to some of the scientific codes out there, GPU are quite recent. Sometimes, slapping OpenMP pragma on the code is not sufficient to take advantage of accelerators, and thus you would need a significant rewrite. But rewriting a scientific code is a daunting task. Often you have a code where there have been two decades of PhD and Postdocs fine tuning the scientific code, and the numerical schemes in the code do not correspond to the original article anymore. Nobody knows anymore exactly how the code works, and rewriting the code would require that the rewrite matches all the features of the original code (and reproduces the same results). It is basically an impossible task, especially when the labs don't have the resources to hire software engineers. In practice, nobody wants to rewrite scientific codes for GPU (and sometimes, the problem is fundamentally incompatible with GPU architecture). So as a compensation, they slap some OpenMP pragmas on some parts of the code, hope for the best, and anyways Nvidia clusters are more common than AMD (at least in the scientific world), so OpenMP barely compiling for AMD is not a problem. This means that legacy scientific codes are pretty much stuck with the CPUs. And in the scientific world, Fortran for HPC CPUs is still the language of choice.
- ivanpribec 3y agoOpenMP support in Fortran will improve as flang matures. In OpenMP 5.0 "#pragma omp requires unified_shared_memory" was introduced. At LLNL, they are are currently building El Capitan (https://www.datacenterknowledge.com/supercomputers/lawrence-livermore-national-lab-begins-building-el-capitan-supercomputer https://www.datacenterknowledge.com/supercomputers/lawrence-...), a supercomputer using AMD MI300A accelerators which support this concept. LLNL is also one of the OpenMP ARB members (https://www.openmp.org/about/members/ https://www.openmp.org/about/members/).
- wiz21c 3y agoAnd some phd's don't write unit tests... So you're completely blind in case you want to refactor/rewrite code.
- d3w4s9 3y agoCorrection: most PhDs in scientific fields don't know what unit tests are. Nobody ever taught/told them to write unit tests, and they have never heard of them, have never seen one, let alone written one. (Someone with a PhD degree here.)
- wiz21c 3y agoI only know the PhD's students in my lab and they don't write unit tests. But now I'm there, I do my best to explain them why they should :-)
- pjmlp 3y agoHistorically only NVidia cared to support Fortran, Khronos folks never understood why it should matter. Yet another reason why CUDA is winning.