WRITE in CUDA Fortran device code


I am trying to convert a bunch of legacy Fortran codes to CUDA Fortran. One of difficulties on the conversion is to handle WRITE statements in legacy codes. CUDA Fortran 12.10, which I can use, only allow PRINT * or WRITE(,), but there are many cases that I have to support WRITE(unit#, format) var1, var2, … I wonder that anyone has already encountered this situation and found a proper solution?


I’m assuming that you’re writing from within a kernel? No, there isn’t yet the facilities to perform formatted I/O from the device nor attach to a specific unit.

Note that printing from a kernel will severely limit your performance.

  • Mat

Actually, computation speed in kernel is not a matter in this case because it is a part of research regarding the micro-architecture of GPU and accuracy of computation. Thanks for the quick reply, though.