[Openmp-dev] Segmentation fault libomptarget.so

Talita Perciano via Openmp-dev openmp-dev at lists.llvm.org
Wed Feb 20 09:18:57 PST 2019


Hi Alexey,

I apologize I didn't reply before, it was a busy week. I do have good news
though! I've just replaced my workstation, and in doing so, I had to
recompile everything from scratch. I now have CUDA 10 and I basically went
through the same procedure as before, but I now used clang 8. Everything
worked just fine. Just for the record, I'll put my system details and the
software versions I'm using here:

Ubuntu 16.04, kernel 4.4.0-142-generic
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0
CUDA 10, driver 410.93

Compiled codes:
https://github.com/llvm-mirror/compiler-rt/tree/release_80
https://github.com/llvm-mirror/clang/tree/release_80
https://github.com/llvm-mirror/openmp/tree/release_80
https://github.com/llvm-mirror/llvm/tree/release_80

At some point, I should try to rebuild the compiler in the system I was
using before to maybe figure out whatever problem I was having. But for
now, I'm happy this is working. Thank you for all the help!

Best,
Talita



On Thu, Feb 14, 2019 at 9:36 AM Alexey Bataev <a.bataev at outlook.com> wrote:

> Hi Talita, any news about your problem? Did you try to rebuild the
> compiler? What exactly do you see when you try to run the compiled code?
> Could you also try to run int under cuda-gdb and send me what it says?
>
> -------------
> Best regards,
> Alexey Bataev
>
> 13.02.2019 17:09, Talita Perciano пишет:
>
> Hi Kelvin,
>
> I see... in my case I used the clang 7 I compiled to build the openmp
> runtime. OS info:
>
> Ubuntu
> VERSION="16.04.5 LTS (Xenial Xerus)"
> Kernel: 4.4.0-141-generic
>
> I could try rebuilding the openmp runtime with gcc instead. Which gcc
> version did you use?
>
> Thanks,
> Talita
>
> On Wed, Feb 13, 2019 at 2:02 PM Kelvin Li <kli at ca.ibm.com> wrote:
>
>> I tried it with the 7.0 source as your described in the attachment.  I
>> did not encounter the problem.  The only difference in my openmp runtime
>> build is to use gcc on the system instead of clang.  Which version of clang
>> did you use to build openmp runtime?  Which OS is the build on?
>>
>> I assume that you updated the example program based on Alexey's
>> suggestion and still get the seg fault.
>>
>> Kelvin
>>
>>
>>
>>
>> From:        Talita Perciano via Openmp-dev <openmp-dev at lists.llvm.org>
>> To:        Alexey Bataev <a.bataev at outlook.com>
>> Cc:        Openmp-dev <openmp-dev-bounces at lists.llvm.org>, "
>> openmp-dev at lists.llvm.org" <openmp-dev at lists.llvm.org>
>> Date:        2019/02/13 04:53 PM
>> Subject:        Re: [Openmp-dev] Segmentation fault libomptarget.so
>> Sent by:        "Openmp-dev" <openmp-dev-bounces at lists.llvm.org>
>> ------------------------------
>>
>>
>>
>> No worries! Thanks so much!
>>
>> Talita
>>
>> On Wed, Feb 13, 2019 at 1:51 PM Alexey Bataev <*a.bataev at outlook.com*
>> <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*
>> <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*
>> <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*
>> <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* <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*
>> <openmp-dev at lists.llvm.org>>
>> To:        Alexey Bataev <*a.bataev at outlook.com* <a.bataev at outlook.com>>
>> Cc:        "*openmp-dev at lists.llvm.org* <openmp-dev at lists.llvm.org>" <
>> *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*
>> <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* <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/20190220/20b9d1c1/attachment-0001.html>


More information about the Openmp-dev mailing list