[Openmp-dev] Segmentation fault libomptarget.so

Talita Perciano via Openmp-dev openmp-dev at lists.llvm.org
Wed Feb 13 13:52:59 PST 2019


No worries! Thanks so much!

Talita

On Wed, Feb 13, 2019 at 1:51 PM Alexey Bataev <a.bataev at outlook.com> wrote:

> Hi Talita, had no time today, will look at it tomorrow,  sorry.
>
> Best regards,
> Alexey Bataev
>
> 13 февр. 2019 г., в 16:50, Talita Perciano <TPerciano at lbl.gov> написал(а):
>
> Hi,
>
> Did any of you guys have the chance to take a look at this?
>
> Thanks!
> Talita
>
> On Tue, Feb 12, 2019 at 2:18 PM Talita Perciano <TPerciano at lbl.gov> wrote:
>
>> Hi,
>>
>> I'm attaching the cmake logs for both llvm and openmp.
>>
>> Thanks,
>> Talita
>>
>> On Tue, Feb 12, 2019 at 2:00 PM Alexey Bataev <a.bataev at outlook.com>
>> wrote:
>>
>>> Yes, seems to me something wrong either with the compiler, or the way it
>>> is used. Need the compilation line, logs, error report.
>>>
>>> Best regards,
>>> Alexey Bataev
>>>
>>> 12 февр. 2019 г., в 16:58, Gheorghe-Teod Bercea <
>>> Gheorghe-Teod.Bercea at ibm.com> написал(а):
>>>
>>> This fixed it for me:
>>>
>>>     #pragma omp target map(tofrom: y[:n]) map(to:x[:n])
>>>     #pragma omp parallel for
>>>     for (int i = 0; i < n; i++)
>>>       y[i] += a * x[i];
>>>
>>> --Doru
>>>
>>>
>>>
>>>
>>> From:        Talita Perciano via Openmp-dev <openmp-dev at lists.llvm.org>
>>> To:        Alexey Bataev <a.bataev at outlook.com>
>>> Cc:        "openmp-dev at lists.llvm.org" <openmp-dev at lists.llvm.org>
>>> Date:        02/12/2019 04:45 PM
>>> Subject:        Re: [Openmp-dev] Segmentation fault libomptarget.so
>>> Sent by:        "Openmp-dev" <openmp-dev-bounces at lists.llvm.org>
>>> ------------------------------
>>>
>>>
>>>
>>> Tried all the above... still segfault on my end. BTW, I don't know if
>>> that's relevant but I'm using cuda 9.2.
>>>
>>> On Tue, Feb 12, 2019 at 1:42 PM Alexey Bataev <*a.bataev at outlook.com*
>>> <a.bataev at outlook.com>> wrote:
>>> Tried your example with my correction,
>>>
>>> $./a.out 1000
>>> Here
>>>
>>> min = 0.000047, max = 0.999994, avg = 0.504811
>>>
>>> $
>>>
>>> -------------
>>> Best regards,
>>> Alexey Bataev
>>> 12.02.2019 16:38, Talita Perciano пишет:
>>> Thanks for your quick response Alexey. I've just tried what you
>>> suggested and I'm still getting the same error.
>>>
>>> Best,
>>> Talita
>>>
>>> On Tue, Feb 12, 2019 at 1:36 PM Alexey Bataev <*a.bataev at outlook.com*
>>> <a.bataev at outlook.com>> wrote:
>>> Try to modify target pragma this way
>>>
>>> #pragma omp target map(from: x[:n]) map(tofrom:y[:n])
>>>
>>> -------------
>>> Best regards,
>>> Alexey Bataev
>>> 12.02.2019 16:33, Talita Perciano via Openmp-dev пишет:
>>> Hi,
>>>
>>> I'm trying openmp offloading to gpu and I'm getting a segfault when
>>> trying to run a test code. I followed the instructions explained here
>>> *https://www.hahnjo.de/blog/2018/10/08/clang-7.0-openmp-offloading-nvidia.html*
>>> <https://www.hahnjo.de/blog/2018/10/08/clang-7.0-openmp-offloading-nvidia.html>
>>> .
>>>
>>> Here is the piece of code I'm trying to run:
>>>
>>> #include <malloc.h>
>>> #include <stdio.h>
>>> #include <stdlib.h>
>>>
>>> int main(int argc, char* argv[])
>>> {
>>>     if (argc != 2)
>>>     {
>>>         printf("Usage: %s \n", argv[0]);
>>>         return 0;
>>>     }
>>>
>>>     int n = atoi(argv[1]);
>>>
>>>     double* x = (double*)malloc(sizeof(double) * n);
>>>     double* y = (double*)malloc(sizeof(double) * n);
>>>
>>>     double idrandmax = 1.0 / RAND_MAX;
>>>     double a = idrandmax * rand();
>>>     for (int i = 0; i < n; i++)
>>>     {
>>>         x[i] = idrandmax * rand();
>>>         y[i] = idrandmax * rand();
>>>     }
>>>     printf("Here\n\n");
>>>     #pragma omp target
>>>     #pragma omp parallel for
>>>     {
>>>         for (int i = 0; i < n; i++)
>>>             y[i] += a * x[i];
>>>     }
>>>
>>>     double avg = 0.0, min = y[0], max = y[0];
>>>     for (int i = 0; i < n; i++)
>>>     {
>>>         avg += y[i];
>>>         if (y[i] > max) max = y[i];
>>>         if (y[i] < min) min = y[i];
>>>     }
>>>
>>>     printf("min = %f, max = %f, avg = %f\n", min, max, avg / n);
>>>
>>>     free(x);
>>>     free(y);
>>>
>>>     return 0;
>>> }
>>>
>>> I'm compiling the code like this: clang -fopenmp
>>> -fopenmp-targets=nvptx64 -O2 example.c
>>> When I run I get a Segmentation fault immediately.
>>>
>>> Any thoughts?
>>>
>>> Thanks!
>>> Talita
>>>
>>>
>>> _______________________________________________
>>> Openmp-dev mailing list
>>> *Openmp-dev at lists.llvm.org* <Openmp-dev at lists.llvm.org>
>>> *https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev*
>>> <https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev>
>>>
>>>
>>>
>>> --
>>> Dr. Talita Perciano
>>> Research Scientist - CRD, Lawrence Berkeley National Laboratory
>>> Data Analytics & Visualization 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* <tperciano at lbl.gov>
>>> *http://tperciano.wixsite.com/home* <http://tperciano.wixsite.com/home>
>>>
>>>
>>> --
>>> Dr. Talita Perciano
>>> Research Scientist - CRD, Lawrence Berkeley National Laboratory
>>> Data Analytics & Visualization 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* <tperciano at lbl.gov>
>>> *http://tperciano.wixsite.com/home* <http://tperciano.wixsite.com/home>
>>> _______________________________________________
>>> Openmp-dev mailing list
>>> 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
>> 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
>> http://tperciano.wixsite.com/home
>>
>
>

-- 
Dr. Talita Perciano
Research Scientist - CRD, Lawrence Berkeley National Laboratory
Data Analytics & Visualization 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
http://tperciano.wixsite.com/home
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20190213/d4608be3/attachment-0001.html>


More information about the Openmp-dev mailing list