I was testing out nvfortran 22.2 and seeing the new array reduction features. It seems to be detecting the array reduction, but still throwing an error. I am not sure if this is a bug:
The code section is:
if (tb0) then
do concurrent (i=1:nr)
do concurrent (k=2:npm1, i=1:nr) reduce(+:sum0)
It seems to be detecting the atomic reduction, but an error seems to be thrown. The code works if I do:
do concurrent (k=2:npm1, i=1:nr)
So I know all my variables are correctly defined.
I have a note in to engineering for advice, but I don’t think we support partial array reductions. While the “unknown variable reference” is most likely due to how the compiler is attempting to create the partial reduction when the loop variables, npm1 in particular, are module variables, even if I correct for that, the results are invalid. Granted, the reproducer I wrote may not be exactly capturing your actual code.
Once I get more feedback, we’ll see if it’s something we think we can support, or if it’s illegal per the proposed standard for “reduce”. If it is illegal, I’ll ask that we give a more informative message.
The actual code is Pot3D: POT3D/pot3d.f at main · predsci/POT3D · GitHub . We are trying out specifically: " Support for array reductions has been significantly improved for directives-based programming models." We are testing out both OpenACC and DO CONCURRENT. Since DO CONCURRENT relies on OpenACC under the hood, we wanted to see if the DO CONCURRENT reduce clause would work with the array reduction.
Array reduction support was improved for the directive based models, i.e. OpenACC and OpenMP. While DO CONCURRENT does use much of the same runtime library, the compilation side is different and I don’t think array reductions was added to standard language parallelism.