[Openmp-dev] Test with clang offloading to GPU

Doerfert, Johannes via Openmp-dev openmp-dev at lists.llvm.org
Sun Oct 20 17:26:33 PDT 2019


Hi Talita,

In your example, "int* start[3] " is no different from other pointers. Think of it as "int** start".
If you want to map nested pointer structures, you can (and for now have to) deconstruct them:

map(start[0:3])                   // map outer layer
for ( i = 0 ... 3)
   map(start[i][0:size(i)])       // map inner layer

Is that what you were looking for?

Cheers,
  Johannes

________________________________________
From: Openmp-dev <openmp-dev-bounces at lists.llvm.org> on behalf of Talita Perciano via Openmp-dev <openmp-dev at lists.llvm.org>
Sent: Thursday, October 17, 2019 09:29
To: Alexey Bataev
Cc: openmp-dev at lists.llvm.org
Subject: Re: [Openmp-dev] Test with clang offloading to GPU

Hi Alexey,

Thanks for the reply. I was wondering, what if I have something like this:

void doWork(const double *inputData, // the input data
                     double *outputData,
                     int *start[3])
...

How would I map start? Is there a way?

Thanks,
Talita

On Wed, Oct 16, 2019 at 3:31 PM Alexey Bataev <a.bataev at hotmail.com<mailto:a.bataev at hotmail.com>> wrote:
Seems to me, you want to map arrays but instead you're mapping pointers. Try something like this:

map(to:inputData[0:10]) map(from:outputData[0:10])



Best regards,
Alexey Bataev

> 16 окт. 2019 г., в 18:24, Talita Perciano via Openmp-dev <openmp-dev at lists.llvm.org<mailto:openmp-dev at lists.llvm.org>> написал(а):
>
> 
> Hi,
>
> I'm trying to run some examples using OpenMP offloading to GPU, and I'm having some issues. See this function below:
>
> void doWork(const double *inputData, // the input data
>                      double *outputData) //  where computation goes
> {
> #pragma omp target data map(inputData) map(outputData)
> {
> #pragma omp target teams distribute parallel for
>     for (int j=0; j<10; j++)
>     {
>         for (int i=0; i< 10; i++)
>         {
>            outputData[indx] = inputData[indx];
>         }
>     }
> }
> }
>
> When I try to run this code, I get something like this:
>
> Libomptarget fatal error 1: failure of target construct while offloading is mandatory
>
> This is probably something stupid, sorry about that. It seems that the problem is that the data from inputData is not mapped to the device. Could you please help me with that?
>
> Thanks,
> Talita
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org<mailto:Openmp-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev


--
Dr. Talita Perciano
Research Scientist - CRD, Lawrence Berkeley National Laboratory
Data Analytics & Visualization Group
Computational Biosciences Group
Center for Advanced Mathematics for Energy Research Applications
One Cyclotron Road
Berkeley, CA 94720
059-3034B  M/S 59R3103
Work: (510) 486-5060
tperciano at lbl.gov<mailto:tperciano at lbl.gov>
http://tperciano.wixsite.com/home


More information about the Openmp-dev mailing list