Using Eigen3 in device code under OpenACC

Does anyone have a good example where they use Eigen3 in device code offloaded to the device via OpenACC?

Seems another Eigen user had some of the same issues. No issues with PGI in this case.

For the record.
First issue.
PGC+±W-0155-External and Static variables are not supported in acc routine - _ZTVSt9exception (/nobackupp16/swbuild/dkokron/NFLOW-CHEM/nflow-chem/test/source_miniapp/mainOpenACC.cpp: 63)
std::exception::exception():
3, include “exception”
32, include “exception”
6, include “exception.h”
63, Generating implicit acc routine seq
PGC+±W-0155-External and Static variables are not supported in acc routine - _ZTVSt9exception (/nobackupp16/swbuild/dkokron/NFLOW-CHEM/nflow-chem/test/source_miniapp/mainOpenACC.cpp: 63)
std::exception::exception() [subobject]:
0, Generating implicit acc routine seq
PGC+±W-0155-External and Static variables are not supported in acc routine - _ZTVSt9exception (/nobackupp16/swbuild/dkokron/NFLOW-CHEM/nflow-chem/test/source_miniapp/mainOpenACC.cpp: 57)
std::bad_alloc::bad_alloc():

c++filt _ZTVSt9exception
vtable for std::exception

Their solution was to hack on the Eigen code. Commenting line 70 in Eigen/src/Core/util/Memory.h also got rid of some of the errors
https://github.com/BlueBrain/nmodl/issues/311

Second issue.
PGC+±W-0155-Compiler failed to translate accelerator region (see -Minfo messages) (/nobackupp16/swbuild/xxxNFLOW-CHEM/nflow-chem/test/source_miniapp/mainOpenACC.cpp: 234)
T2 Eigen::internal::evaluator<Eigen::PlainObjectBase<Eigen::Array<double, (int)11, (int)1, (int)0, (int)11, (int)1>>>::packet<(int)0, double __attribute((vector_size(2*sizeof(double)))) >(long, long) const:
7, include “kinetics.hpp”
25, include “nflow.hpp”
16, include “Core”
260, include “CoreEvaluators.h”
234, Generating implicit acc routine seq
Generating acc routine seq
Generating Tesla code
609, Accelerator restriction: unsupported operation: VLD
234, Accelerator restriction: an unsupported operation was found

I’m compiling with PGI 20.4 with -fast -O3 -DNDEBUG -acc -ta=tesla:cc70 -Minfo=accel
Figuring VLD meant VectorLoad, I disabled vectorization in the Eignen code via -DEIGEN_DONT_VECTORIZE=1 compilation flag.

Both of these ‘fixes’ allowed the compile to complete without errors.