OpenACC autocompare doesn't work for customized data structure

OpenACC and CUDA Fortran
Post Reply
SanhuLi
Posts: 11
Joined: Jan 10 2016

OpenACC autocompare doesn't work for customized data structure

Post by SanhuLi » Mon Nov 04, 2019 1:30 pm

Dear everyone,

I'm trying to run my code on GPU and evaluate its correctness using the autocompare feature.
However, I've seen output about

Code: Select all

variable 'dp' in PCAST compare has no type information and cannot be compared
.
And it seems to be endless ( maybe I'm too impatient to wait for it's done outputing? )
The data type for dp is:

Code: Select all

typedef struct GACT_Cell {
    uint32_t op: 2;
    uint32_t E: 10;
    uint32_t F: 10;
    uint32_t H: 10;
} GACT_Cell;
The code I'm talking about:

Code: Select all

	GACT_Cell(*dp)[qlen + 1] = (GACT_Cell(*)[qlen + 1]) dp_table;
#pragma acc data copyin(ref, qry, ref.data[rlen], qry.data[qlen], mat[N][N]) \
        copy(dp[rlen + 1][qlen + 1])
    {
#pragma acc parallel loop independent present(mat, ref.data, qry.data)
        for (int wf = 0; wf < num_wavefronts; ++wf) {
#pragma acc loop independent vector
            for (int x = 1; x <= wf + 1 && x <= qlen; ++x) {
                int y = wf + 2 - x;
                if (y >= 1 && y <= wf + 1 && y <= rlen) {
                    GACT_Cell c = dp[y][x];
                    
                    GACT_Cell t = dp[y][x - 1];
                    int to = (int)t.H - go;
                    int te = (int)t.E - ge;
                    int E = to > te ? to : te;
                    E = E > 0 ? E : 0;

                    t = dp[y - 1][x];
                    to = (int)t.H - go;
                    te = (int)t.F - ge;
                    int F = to > te ? to : te;
                    F = F > 0 ? F : 0;

                    int qc = qry.data[x - 1];
                    int rc = ref.data[y - 1];
                    t = dp[y - 1][x - 1];
                    int H = (int)t.H + mat[rc][qc];

                    int v;

                    int op = maxi(0, E, F, H, &v);
                    if (qc == rc && op == 3) {
                        op = 0;
                    }
                    c.op = op;
                    c.H = v;

                    dp[y][x] = c;
                }
            }
        }
Is there any solution that I can use autocompare for customized types? Thank you so much for your help!

aglobus
Posts: 152
Joined: Jun 11 2018

Re: OpenACC autocompare doesn't work for customized data structure

Post by aglobus » Tue Nov 05, 2019 2:28 pm

Hi,

That is expected. Aggregate types like structs don't work yet with PCAST. There's long term plans to support them, but I don't think there is a workaround or solution for something like this in the interim.

EDIT: Mat's suggestion below will work, though it is a little more verbose to explicitly reference each structure. TPR#27817 is opened to address the issue.

mkcolg
Posts: 8107
Joined: Jun 30 2004

Re: OpenACC autocompare doesn't work for customized data structure

Post by mkcolg » Tue Nov 05, 2019 2:29 pm

Hi SanhuLi,

Currently PCAST only supports fundamental data types. From: https://www.pgroup.com/blogs/posts/pcast.htm
The data types supported by PCAST include the basic numeric types for C, C++, and Fortran:

float, real, real(4)
double, double precision, real(8)
complex, float _Complex
double _Complex, complex(8)
short
int, integer, integer(4)
long, integer(8)
unsigned short
unsigned int
unsigned long
Long term, we would like to extend PCAST to allow for aggregate types but it may be some time before we add it. I've let the OpenACC team know that it would be a useful feature for you.

In the meantime, you might try using the "pgi_compare" calls for each individual member of the struct.

Best Regards,
Mat

Post Reply