[QE-developers] Code divergence

Ye Luo xw111luoye at gmail.com
Mon Aug 6 20:27:56 CEST 2018


Hi Paolo,

In the code QMCPACK I work on, we typedef float/double as RealType and use
RealType in places switching precision is desired (performance matters in
particle and wavefunction data). This avoids putting ifdef everywhere. In
places where high precision is needed, just define another type
EstimatorRealType and stick to it. For QE, BP(base precision) can be
defined next to DP and ifdef its definition.
For library calls, every BLAS calls used in the code needs to be wrapped
with an interface (GEMM) so the right one can be picked based on the
arguments(S/C/D/Zgemm).
Then we just build a mixed precision and a full precision binaries. This
also desires better out-of-source build capability. In places precision
selection at runtime is desired, we use C++ template which is hard for
fortran.

OpenMP 4.5 or 5.0 (upcoming) offload may also have a chance for single
source on multiple architectures (CPU/GPU). The multi-core+simd and
SMX+cuda-cores have some similarity. Unfortunately, current fortran
compilers are still at an early stage.
I will try it with another fortran code and see how that goes and then give
updates to the QE community.

Best,
Ye

===================
Ye Luo, Ph.D.
Leadership Computing Facility
Argonne National Laboratory

2018-08-06 12:46 GMT-05:00 Paolo Giannozzi <p.giannozzi at gmail.com>:

> Hi Ye, we know quite well the "divergence" problem you mention, much less
> about the solutions. If you have good ideas, or just ideas, feel free to
> propose them. For GPU's, we are trying to isolate strongly GPU-specific
> parts. For mixed precision, we are at preliminary tests.
>
> I perfectly agree about unit testing, at least for those parts of QE for
> which it is suitable. For instance: FFTXlib has already some unit tests;
> LAXlib could have some; for KS_Solvers, it's not going to be easy. It
> should also be easy to set up unit tests for exchange-correlation
> functionals and for symmetry-related stuff.
>
> Paolo
>
> On Sun, Jul 29, 2018 at 4:06 AM, Ye Luo <xw111luoye at gmail.com> wrote:
>
>> Hi developers,
>>
>> Many features currently under development are getting QE ready for the
>> future. This is very encouraging.
>> However, I feel the code is diverging and needs attention.
>> The upcoming GPU code is basically an internal fork with large amount of
>> lines duplicated.The mixed precision attempt also duplicates functions.
>> QE already has gamma/k or complex/real forks inside the code. The more
>> forks added to the code, the more needed maintenance and potential bugs.
>>
>> Although fortran has its language limitation, some design choices may
>> help reducing the complexity. Having one binary is appealing but allowing
>> building multiple binaries and fixing precision at compile time to minimize
>> the lines of duplicated code is more beneficial long term.
>> The CPU/GPU gap may have a chance to get closed by performance portable
>> solutions although the software stack is not matured especially on the
>> fortran side at the moment.
>>
>> It is very challenging and the manpower is often limited. Although the
>> reality is often a compromise, I believe QE developers figure out the best
>> way.
>>
>> One more thing, testing is very important. Although there are some tests
>> but more tests are needed not only integration tests but also unit tests.
>>
>> Best,
>> Ye
>> ===================
>> Ye Luo, Ph.D.
>> Leadership Computing Facility
>> Argonne National Laboratory
>>
>> _______________________________________________
>> developers mailing list
>> developers at lists.quantum-espresso.org
>> https://lists.quantum-espresso.org/mailman/listinfo/developers
>>
>>
>
>
> --
> Paolo Giannozzi, Dip. Scienze Matematiche Informatiche e Fisiche,
> Univ. Udine, via delle Scienze 208, 33100 Udine, Italy
> <https://maps.google.com/?q=Udine,+via+delle+Scienze+208,+33100+Udine,+Italy&entry=gmail&source=g>
> Phone +39-0432-558216, fax +39-0432-558222
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/developers/attachments/20180806/068f0ea2/attachment.html>


More information about the developers mailing list