There are ways you can use GPU's to do mathematical calculations that the CPU normally does, but GPU's are designed to read vertices. In order to render the kind of things that Terragen does you'd have to create a library similar to DirectX, you wouldn't necessarily have to rewrite the entire program as the graphics library could be used externally and linked in, that's how graphics and physics engines work for games.
The main problem in doing what TG2 does on a GPU is a technical exercise. Ray tracing is often just as slow on the GPU as it is on the CPU, and things like cloud samples wouldn't be efficiently calculated if done on the GPU, you'd have to use CUDA to alter how the shader core was used, I say the shader core because it wouldn't be doing anything so could render all the samples you'd want