Dear Maxim,
Very happy to receive your response. Of course, I am entirely ready to continue the discussion. As with many software programs available on GitHub, the authors often use Linux and GNU tools along with command-line compilations. Some authors, whom you know well, go further and only code in Fortran under Linux and refuse to do anything under Windows.
As a user, the Linux command-line approach is inconvenient. Everything is based on a script that is completely incomprehensible except to the person who wrote it. If everything works, that's fine, but the novice that I am learns nothing and therefore doesn't understand why it worked. But very often, a detail causes the project construction to fail, and since the novice has learned nothing, he doesn't know how to fix it. Moreover, as an occasional programmer, I use Visual Studio with a Microsoft compiler which, for me, is by far the most powerful tool. That's why I found it simpler, more reliable, and especially more instructive to compile ADDA from scratch with Visual Studio. With the help of ChatGPT doing that is now possible.
Having code in an IDE like Visual Studio 2019 allows you to execute the code step by step, examine the variables, and thus understand how the software works and what it does. If it’s simply about creating a functional executable, it’s easier to get the program in executable form. It's simpler.
During my initial attempts with the Microsoft MSVC compiler, I encountered a multitude of errors because the C99 option is not available in MSVC. Upon closer inspection, the problem seems to stem from the handling of complex operators (+, -, *, /) which is not supported with the complex type defined in <complex.h>. However, the type complex<Type> or double complex <type> defined in <complex> should be usable. Fortunately, the documentation indicates that the Intel C compiler with C99 can work. The Intel compiler works but the Visual Studio tool is then much less powerful.
To illustrate the power of Visual Studio 2019, let's take the example of the problem posed by "_isatty". In which header is "_isatty" found? Impossible to know if the documentation is not up to date. To find out, I selected the MSVC compiler in Visual Studio 2019 (even if it generates multiple errors), I right-clicked on the "_isatty" identifier and in the drop-down menu that appeared, I asked to display the declaration of the "_isatty" function. Visual Studio 2019 opened the "corecrt_io.h" file and displayed the function declaration "_isatty". Thus, I knew that "_isatty" was declared in the <corecrt_io.h> header.
I did the same to find the header where UINT32_MAX was declared.
Regarding the export of functions in a DLL, I asked ChatGPT how to export subroutine BJNDD (n, x, bj, dj, fj) and subroutine propaespacelibreintadda(Rij, k0a,). ChatGPT indicated that I needed to add !DEC$ ATTRIBUTES DLLEXPORT :: BJNDD and !DEC$ ATTRIBUTES DLLEXPORT :: propaespacelibreintadda.
There is a very useful tool under Windows: dllexp.exe "https://www.nirsoft.net/utils/dll_export_viewer.html". This tool provides the list of functions exported in a Windows DLL. This tool shows that a DLL created by IFORT or IFX exports only a very small number of functions, and that these functions are capitalized, whereas mingw64 with gfortran exports all functions, leaves lowercase letters, and adds an underscore.
Regarding oclkernels.cl, I saw the error but didn’t understand it. I asked ChatGPT for help. ChatGPT wrote the "readKernelSource" function and modified the code. I saw that it worked, and I didn't investigate further.
Finally, putting code on GitHub is good, but offering codes with project files for IDEs like Visual Studio would be very useful to users. Only step-by-step execution in an IDE allows for understanding.
Look at what Micromanager does.
Best regards,
Michel GROSS
--
You received this message because you are subscribed to the Google Groups "ADDA questions and answers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adda-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/adda-discuss/db66f723-5801-4ab9-816a-d1f12bc1e719n%40googlegroups.com.
Dear Maxim,
The choice of ADDA12 is not important, because my goal was simply to work with appropriate tools without wasting time on technical details. Once the ADDA12 version is stable, it will be possible to adapt the latest version of ADDA in the same way. I believe everything should be compiled in C++, without relying on C99 complex types. C++ is essential for working safely, and it provides alternative complex number types that make the equations much easier to read. CUDA, in any case, uses its own complex types such as cufftComplex or cuDoubleComplex. But these are minor details.
Now that everything is working on my side, I am beginning to better understand the internal logic of ADDA. I think it is possible to significantly accelerate GPU computation (typically by a factor of 10). For FFTs of size 256³, the transposition step takes about 20 ms, whereas a single FFT along x, y, or z takes only 1 ms, and a full 3D FFT takes 3 ms. So the transposition is extremely expensive. The other very costly operation, probably as expensive as the transposition, is slicing along the fast axis x. This choice was dictated by MPI constraints, but it makes GPU computation very inefficient.
It is possible to go much faster either by performing full 3D FFTs (which requires more GPU memory), or by choosing other axes for zero-padding and slicing, thereby eliminating all transpositions. The z-axis is the least expensive (zero-padding on z, FFT on z, trivial slicing on z, then 2D FFT on yz), and the y-axis is almost as good while remaining compatible with MPI.
This is where I currently stand. I now want to be able to change the choice of FFT axes by modifying Matvec and the Green function computation, and verify that the results remain identical. Only after that will I introduce CUDA and measure performance.
Michel
To view this discussion visit https://groups.google.com/d/msgid/adda-discuss/58176e0d-3f6d-4d72-838b-038a719ee86a%40gmail.com.