I am trying to accelerate a program that renders Mandelbrot fractals, and while searching how to work with complex numbers inside the kernel, I coincidentally found this document, which has an example section, where a fractal is rendered with complex numbers, in the exact same way I want to do it.
https://developer.download.nvidia.com/books/cuda-by-example/cuda-by-example-sample.pdf under section 4.2.2
There, this code snippet is provided:
Here, a strcuture called “cuComplex” is used, however, it isn’t mentioned, which header was used for it or which version the snippet featured. I also can’t find any official documentation for this structure when searching for it online or in the CUDA toolkit documentation. There is a “cuComplex.h” inside my environment (I use CUDA with Visual Studio 2022 on Windows 10), but it doesn’t seem to work the way it is shown in the snippet. To init a cuComplex, for example I have to do this:
cuComplex c(make_float2(0.0f, 0.0f));
And I can’t even write
a = a * a + c;
because, apparently, there is no operation defined for “*”
I looked at the file, where cuComplex is defined, and there are some functions that seem to multiply complex numbers, but the code and comments inside that file aren’t really readable for me. Also, I am confused why I can’t use this structure the way it is shown in the example snippet to begin with.
Is there an official documentation for this?