Grid icon indicating copy to clipboard operation
Grid copied to clipboard

Certain operations involving SitePropagator::scalar_object won't compile with CUDA for Nc > 3

Open edbennett opened this issue 3 years ago • 0 comments

In trying to understand aportelli/Hadrons#94, it transpires that certain arithmetic operations in Grid will not compile for SU(4).

For example, the following test program gives two build errors, one caused by line 6 and one by line 15:

#include <Grid/Grid.h>

using namespace Grid;

void test(WilsonImplR::PropagatorField &out, WilsonImplR::ComplexField in, const WilsonImplR::SitePropagator::scalar_object idMat) {
  out = in * idMat;
}

void test2(WilsonImplR::SitePropagator::scalar_object sp1,
	   WilsonImplR::PropagatorField pf1,
	   WilsonImplR::PropagatorField pf2,
	   Gamma g1,
	   Gamma g2)
{
  LatticeComplex out = trace(g1 * sp1 * adj(pf1) * (g1 * g2) * pf2);
}

In both cases, using an auto declaration works, but then assigning back to the desired type re-triggers the error, so the cast appears to be at least part of the problem.

I compiled with:

nvcc -x cu -I${HOME}/prefix_su4test/include -ccbin mpicxx -I${HOME}/prefix/include --expt-extended-lambda -c -o test.o test.cpp

These examples compile fine for SU(3), and also work fine with SU(4) compiled for CPU.

Is this something that it would be possible to fix, please?

edbennett avatar Oct 05 '22 23:10 edbennett