PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Specifying size of data structures in inlined code

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
ashay



Joined: 15 Mar 2012
Posts: 3

PostPosted: Wed Mar 28, 2012 1:41 pm    Post subject: Specifying size of data structures in inlined code Reply with quote

Here is a small example on which I can reproduce the problem:

Code:

#include <stdio.h>
#include <stdlib.h>

void foo(char* buffer, int count)
{
        int i;
        for(i=0; i<count; i++)
                buffer[i]++;
}

int main(int argc, char* argv[])
{
        char* buffer = NULL;
        int i, count=atoi(argv[1]);
        buffer = (char*) malloc (sizeof(char) * count);

        if (!buffer)
                return 1;

        #pragma acc region copy(buffer[:count])
        foo(buffer, count);

        free(buffer);
        return 0;
}


Here's the compiler message:
Quote:

$ pgcc -ta=nvidia -Minfo source.c -c -Minline
PGC-W-0155-Accelerator region ignored; see -Minfo messages (source.c: 21)
main:
21, Accelerator restriction: size of the GPU copy of an array depends on values computed in this loop
Accelerator region ignored
22, foo inlined, size=5, file source.c (6)
8, Accelerator restriction: size of the GPU copy of '..inline' is unknown
Accelerator restriction: one or more arrays have unknown size

$


I believe the error is from the compiler not being able to determine the size of buffer/loop inside function foo(). It looks like the compiler renames the symbols from the function (..inline) when the '-Minline' flag is used. Is it possible to indicate the size of the buffer in the pragma statement for the arrays used in the inlined loop?

Thanks!
Ashay
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6134
Location: The Portland Group Inc.

PostPosted: Wed Mar 28, 2012 2:03 pm    Post subject: Reply with quote

Hi Ashay,

This is a known limitation with inlining and the PGI Accelerator model. We are working to address the issue but given the complexity of the problem, it has not be solved as of yet. While we have other similar examples, I added TPR#18588 to track the progress of your particular example.

The only work around in this case is to manually inline the function.

Thanks,
Mat
Back to top
View user's profile
ashay



Joined: 15 Mar 2012
Posts: 3

PostPosted: Wed Mar 28, 2012 2:56 pm    Post subject: Reply with quote

Thanks Mat!
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group