In the early '80s, my first job, my first project, I joined a team who had been writing an interpreter for a home-grown Expert System language, in C for the IBM PC. > his only major sin was a function which was 4000 lines long. For example, recklessly including spaces in a credit card number because that's how they are presented on the physical card and it makes it easier to type them out more accurately. That's not useful for anyone, is often not logged or just discarded (after all, the application executes faster if nothing is ever logged) and why users get frustrated where rather than a clear, definitive reason why something isn't working they might, if they are lucky get a message popping up saying "an error has happened" and have to work out themselves what may possibly have happened wrong. Moronic developers who do no error handling and instead rely on exceptions are why scenarios such as a user input of "X" into a field expecting a number (0-9) causes an exception and therefore a debug screen for the end user. Regular failures are to be expected, and handled gracefully, irregular failures are exceptions to this and can legitimately be cascaded up the call stack. There are quasi-religious wars about this, but exceptions were never designed to just kick unhandled nonsense up the call stack, they were to handle exceptions. brainlessly refactoring code so it no longer handles expected errors and instead just kicks exceptions up the exception handler tree is one of the most useless "modern" implementations that failing/failed developers make. On a side note: my own overall impression so far is that CUDA Fortran is very nice in case one programmed in Fortran before - CUDA runtime functions integrated within native Fortran syntax, so host code is much nicer than in C, and also writing device functions seems as natural as writing any other kind of Fortran code.To add. Finally, you run the compiled program just like any other executable on your machine: you type in the executable name in the command line, and that’s it. There exist several compiler switches that are CUDA related, but you could learn about these from the compiler user guide (also available in the installation tree), and everything else that you’d need to get started with CUDA Fortran you could learn from CUDA Fortran user guide, that is available here (the guide is rather short and readable, but knowledge of C CUDA is assumed). You build the code in command line, practically just like you build your C CUDA code with nvcc, but only you’re using PGI compiler instead of nvcc. You’ll need to use PGI compiler, as this is the only compiler available supporting CUDA Fortran you can find it for download here, and after creating an account at PGI site you should be able to generate 15-day trial license (PGI compiler is not freely available, moreover it’s a bit on the pricey side - see here, but still IMO it is well worth its money).Īfter installing the compiler, you should be able to find two sample programs under the installation tree only one is “real” code (SGEMM routine), but it should be enough for you to get a feeling on CUDA Fortran programming.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |