<font size=2 face="sans-serif">Oops, sorry.  It should be</font><br><br><font size=2 face="sans-serif">$ gcc --version</font><br><font size=2 face="sans-serif">gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)</font><br><font size=2 face="sans-serif"><br><br>Kelvin<br></font><br><br><br><br><font size=1 color=#5f5f5f face="sans-serif">From:      
 </font><font size=1 face="sans-serif">Kelvin Li/Toronto/IBM</font><br><font size=1 color=#5f5f5f face="sans-serif">To:      
 </font><font size=1 face="sans-serif">Talita Perciano <TPerciano@lbl.gov></font><br><font size=1 color=#5f5f5f face="sans-serif">Cc:      
 </font><font size=1 face="sans-serif">Alexey Bataev <a.bataev@outlook.com>,
"openmp-dev@lists.llvm.org" <openmp-dev@lists.llvm.org>,
Openmp-dev <openmp-dev-bounces@lists.llvm.org></font><br><font size=1 color=#5f5f5f face="sans-serif">Date:      
 </font><font size=1 face="sans-serif">2019/02/13 05:12 PM</font><br><font size=1 color=#5f5f5f face="sans-serif">Subject:    
   </font><font size=1 face="sans-serif">Re: [Openmp-dev]
Segmentation fault libomptarget.so</font><br><hr noshade><br><br><font size=2 face="sans-serif">It is GCC 5.4.</font><br><br><font size=2 face="sans-serif">$ gcc --version</font><br><font size=2 face="sans-serif">gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.11)
5.4.0 20160609</font><br><font size=2 face="sans-serif"><br>Kelvin<br></font><br><br><br><br><br><font size=1 color=#5f5f5f face="sans-serif">From:      
 </font><font size=1 face="sans-serif">Talita Perciano <TPerciano@lbl.gov></font><br><font size=1 color=#5f5f5f face="sans-serif">To:      
 </font><font size=1 face="sans-serif">Kelvin Li <kli@ca.ibm.com></font><br><font size=1 color=#5f5f5f face="sans-serif">Cc:      
 </font><font size=1 face="sans-serif">Alexey Bataev <a.bataev@outlook.com>,
"openmp-dev@lists.llvm.org" <openmp-dev@lists.llvm.org>,
Openmp-dev <openmp-dev-bounces@lists.llvm.org></font><br><font size=1 color=#5f5f5f face="sans-serif">Date:      
 </font><font size=1 face="sans-serif">2019/02/13 05:10 PM</font><br><font size=1 color=#5f5f5f face="sans-serif">Subject:    
   </font><font size=1 face="sans-serif">Re: [Openmp-dev]
Segmentation fault libomptarget.so</font><br><hr noshade><br><br><br><font size=3>Hi Kelvin,</font><br><br><font size=3>I see... in my case I used the clang 7 I compiled to build
the openmp runtime. OS info:</font><br><br><font size=3>Ubuntu</font><br><font size=3>VERSION="16.04.5 LTS (Xenial Xerus)"</font><br><font size=3>Kernel: 4.4.0-141-generic</font><br><br><font size=3>I could try rebuilding the openmp runtime with gcc instead.
Which gcc version did you use?</font><br><br><font size=3>Thanks,</font><br><font size=3>Talita</font><br><br><font size=3>On Wed, Feb 13, 2019 at 2:02 PM Kelvin Li <</font><a href="mailto:kli@ca.ibm.com"><font size=3 color=blue><u>kli@ca.ibm.com</u></font></a><font size=3>>
wrote:</font><br><font size=2 face="sans-serif">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?</font><font size=3><br></font><font size=2 face="sans-serif"><br>I assume that you updated the example program based on Alexey's suggestion
and still get the seg fault.<br><br>Kelvin</font><font size=3><br><br><br><br></font><font size=1 color=#5f5f5f face="sans-serif"><br>From:        </font><font size=1 face="sans-serif">Talita
Perciano via Openmp-dev <</font><a href="mailto:openmp-dev@lists.llvm.org" target="_blank"><font size=1 color=blue face="sans-serif"><u>openmp-dev@lists.llvm.org</u></font></a><font size=1 face="sans-serif">></font><font size=1 color=#5f5f5f face="sans-serif"><br>To:        </font><font size=1 face="sans-serif">Alexey
Bataev <</font><a href="mailto:a.bataev@outlook.com" target="_blank"><font size=1 color=blue face="sans-serif"><u>a.bataev@outlook.com</u></font></a><font size=1 face="sans-serif">></font><font size=1 color=#5f5f5f face="sans-serif"><br>Cc:        </font><font size=1 face="sans-serif">Openmp-dev
<</font><a href="mailto:openmp-dev-bounces@lists.llvm.org" target="_blank"><font size=1 color=blue face="sans-serif"><u>openmp-dev-bounces@lists.llvm.org</u></font></a><font size=1 face="sans-serif">>,
"</font><a href="mailto:openmp-dev@lists.llvm.org" target="_blank"><font size=1 color=blue face="sans-serif"><u>openmp-dev@lists.llvm.org</u></font></a><font size=1 face="sans-serif">"
<</font><a href="mailto:openmp-dev@lists.llvm.org" target="_blank"><font size=1 color=blue face="sans-serif"><u>openmp-dev@lists.llvm.org</u></font></a><font size=1 face="sans-serif">></font><font size=1 color=#5f5f5f face="sans-serif"><br>Date:        </font><font size=1 face="sans-serif">2019/02/13
04:53 PM</font><font size=1 color=#5f5f5f face="sans-serif"><br>Subject:        </font><font size=1 face="sans-serif">Re:
[Openmp-dev] Segmentation fault libomptarget.so</font><font size=1 color=#5f5f5f face="sans-serif"><br>Sent by:        </font><font size=1 face="sans-serif">"Openmp-dev"
<</font><a href="mailto:openmp-dev-bounces@lists.llvm.org" target="_blank"><font size=1 color=blue face="sans-serif"><u>openmp-dev-bounces@lists.llvm.org</u></font></a><font size=1 face="sans-serif">></font><font size=3><br></font><hr noshade><font size=3><br><br><br>No worries! Thanks so much!<br><br>Talita<br><br>On Wed, Feb 13, 2019 at 1:51 PM Alexey Bataev <</font><a href="mailto:a.bataev@outlook.com" target="_blank"><font size=3 color=blue><u>a.bataev@outlook.com</u></font></a><font size=3>>
wrote:<br>Hi Talita, had no time today, will look at it tomorrow,  sorry.<br><br>Best regards, <br>Alexey Bataev<br><br>13 февр. 2019 г., в 16:50, Talita Perciano <</font><a href="mailto:TPerciano@lbl.gov" target="_blank"><font size=3 color=blue><u>TPerciano@lbl.gov</u></font></a><font size=3>>
написал(а):<br><br>Hi, <br><br>Did any of you guys have the chance to take a look at this?<br><br>Thanks!<br>Talita<br><br>On Tue, Feb 12, 2019 at 2:18 PM Talita Perciano <</font><a href="mailto:TPerciano@lbl.gov" target="_blank"><font size=3 color=blue><u>TPerciano@lbl.gov</u></font></a><font size=3>>
wrote:<br>Hi, <br><br>I'm attaching the cmake logs for both llvm and openmp.<br><br>Thanks,<br>Talita<br><br>On Tue, Feb 12, 2019 at 2:00 PM Alexey Bataev <</font><a href="mailto:a.bataev@outlook.com" target="_blank"><font size=3 color=blue><u>a.bataev@outlook.com</u></font></a><font size=3>>
wrote:<br>Yes, seems to me something wrong either with the compiler, or the way it
is used. Need the compilation line, logs, error report.<br><br>Best regards, <br>Alexey Bataev<br><br>12 февр. 2019 г., в 16:58, Gheorghe-Teod Bercea <</font><a href="mailto:Gheorghe-Teod.Bercea@ibm.com" target="_blank"><font size=3 color=blue><u>Gheorghe-Teod.Bercea@ibm.com</u></font></a><font size=3>>
написал(а):<br></font><font size=2 face="sans-serif"><br>This fixed it for me:<br><br>    #pragma omp target map(tofrom: y[:n]) map(to:x[:n])<br>    #pragma omp parallel for<br>    for (int i = 0; i < n; i++)<br>      y[i] += a * x[i];<br><br>--Doru</font><font size=3><br><br><br></font><font size=1 color=#5f5f5f face="sans-serif"><br><br>From:        </font><font size=1 face="sans-serif">Talita
Perciano via Openmp-dev <</font><a href="mailto:openmp-dev@lists.llvm.org" target="_blank"><font size=1 color=blue face="sans-serif"><u>openmp-dev@lists.llvm.org</u></font></a><font size=1 face="sans-serif">></font><font size=1 color=#5f5f5f face="sans-serif"><br>To:        </font><font size=1 face="sans-serif">Alexey
Bataev <</font><a href="mailto:a.bataev@outlook.com" target="_blank"><font size=1 color=blue face="sans-serif"><u>a.bataev@outlook.com</u></font></a><font size=1 face="sans-serif">></font><font size=1 color=#5f5f5f face="sans-serif"><br>Cc:        </font><font size=1 face="sans-serif">"</font><a href="mailto:openmp-dev@lists.llvm.org" target="_blank"><font size=1 color=blue face="sans-serif"><u>openmp-dev@lists.llvm.org</u></font></a><font size=1 face="sans-serif">"
<</font><a href="mailto:openmp-dev@lists.llvm.org" target="_blank"><font size=1 color=blue face="sans-serif"><u>openmp-dev@lists.llvm.org</u></font></a><font size=1 face="sans-serif">></font><font size=1 color=#5f5f5f face="sans-serif"><br>Date:        </font><font size=1 face="sans-serif">02/12/2019
04:45 PM</font><font size=1 color=#5f5f5f face="sans-serif"><br>Subject:        </font><font size=1 face="sans-serif">Re:
[Openmp-dev] Segmentation fault libomptarget.so</font><font size=1 color=#5f5f5f face="sans-serif"><br>Sent by:        </font><font size=1 face="sans-serif">"Openmp-dev"
<</font><a href="mailto:openmp-dev-bounces@lists.llvm.org" target="_blank"><font size=1 color=blue face="sans-serif"><u>openmp-dev-bounces@lists.llvm.org</u></font></a><font size=1 face="sans-serif">></font><font size=3><br></font><hr noshade><font size=3><br><br><br>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.<br><br>On Tue, Feb 12, 2019 at 1:42 PM Alexey Bataev <</font><a href="mailto:a.bataev@outlook.com" target="_blank"><font size=3 color=blue><u>a.bataev@outlook.com</u></font></a><font size=3>>
wrote:<br>Tried your example with my correction,</font><br><font size=3>$./a.out 1000<br>Here<br><br>min = 0.000047, max = 0.999994, avg = 0.504811</font><p><font size=3>$</font><p><tt><font size=3>-------------<br>Best regards,<br>Alexey Bataev</font></tt><font size=3><br>12.02.2019 16:38, Talita Perciano пишет:<br>Thanks for your quick response Alexey. I've just tried what you suggested
and I'm still getting the same error. <br><br>Best,<br>Talita<br><br>On Tue, Feb 12, 2019 at 1:36 PM Alexey Bataev <</font><a href="mailto:a.bataev@outlook.com" target="_blank"><font size=3 color=blue><u>a.bataev@outlook.com</u></font></a><font size=3>>
wrote:<br>Try to modify target pragma this way</font><p><font size=3>#pragma omp target map(from: x[:n]) map(tofrom:y[:n])</font><p><tt><font size=3>-------------<br>Best regards,<br>Alexey Bataev</font></tt><font size=3><br>12.02.2019 16:33, Talita Perciano via Openmp-dev пишет:<br>Hi, <br><br>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</font><a href="https://www.hahnjo.de/blog/2018/10/08/clang-7.0-openmp-offloading-nvidia.html" target="_blank"><font size=3 color=blue><u>https://www.hahnjo.de/blog/2018/10/08/clang-7.0-openmp-offloading-nvidia.html</u></font></a><font size=3>.<br><br>Here is the piece of code I'm trying to run:<br><br>#include <malloc.h><br>#include <stdio.h><br>#include <stdlib.h><br> <br>int main(int argc, char* argv[])<br>{<br>    if (argc != 2)<br>    {<br>        printf("Usage: %s \n", argv[0]);<br>        return 0;<br>    }<br>     <br>    int n = atoi(argv[1]);<br>     <br>    double* x = (double*)malloc(sizeof(double) * n);<br>    double* y = (double*)malloc(sizeof(double) * n);<br> <br>    double idrandmax = 1.0 / RAND_MAX;<br>    double a = idrandmax * rand();<br>    for (int i = 0; i < n; i++)<br>    {<br>        x[i] = idrandmax * rand();<br>        y[i] = idrandmax * rand();<br>    }<br>    printf("Here\n\n");<br>    #pragma omp target<br>    #pragma omp parallel for<br>    {<br>        for (int i = 0; i < n; i++)<br>            y[i] += a * x[i];<br>    }<br>     <br>    double avg = 0.0, min = y[0], max = y[0];<br>    for (int i = 0; i < n; i++)<br>    {<br>        avg += y[i];<br>        if (y[i] > max) max = y[i];<br>        if (y[i] < min) min = y[i];<br>    }<br>     <br>    printf("min = %f, max = %f, avg = %f\n", min, max,
avg / n);<br>     <br>    free(x);<br>    free(y);<br> <br>    return 0;<br>}<br><br>I'm compiling the code like this: clang -fopenmp -fopenmp-targets=nvptx64
-O2 example.c<br>When I run I get a Segmentation fault immediately.<br><br>Any thoughts?<br><br>Thanks!<br>Talita<br></font><tt><font size=3><br><br>_______________________________________________<br>Openmp-dev mailing list</font></tt><font size=3 color=blue><u><br></u></font><a href="mailto:Openmp-dev@lists.llvm.org" target="_blank"><tt><font size=3 color=blue><u>Openmp-dev@lists.llvm.org</u></font></tt></a><font size=3 color=blue><u><br></u></font><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev" target="_blank"><tt><font size=3 color=blue><u>https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</u></font></tt></a><font size=3><br><br><br><br>-- <br>Dr. Talita Perciano<br>Research Scientist - CRD, Lawrence Berkeley National Laboratory<br>Data Analytics & Visualization Group</font><font size=2><br>Center for Advanced Mathematics for Energy Research Applications<br>One Cyclotron Road<br>Berkeley, CA 94720<br>059-3034B  </font><font size=3>M/S 59R3103<br>Work: (510) 486-5060</font><font size=3 color=blue><u><br></u></font><a href="mailto:tperciano@lbl.gov" target="_blank"><font size=3 color=blue><u>tperciano@lbl.gov</u></font></a><font size=3 color=blue><u><br></u></font><a href="http://tperciano.wixsite.com/home" target="_blank"><font size=3 color=blue><u>http://tperciano.wixsite.com/home</u></font></a><font size=3><br><br><br>-- <br>Dr. Talita Perciano<br>Research Scientist - CRD, Lawrence Berkeley National Laboratory<br>Data Analytics & Visualization Group</font><font size=2><br>Center for Advanced Mathematics for Energy Research Applications<br>One Cyclotron Road<br>Berkeley, CA 94720<br>059-3034B  </font><font size=2 color=#2f2f2f face="sans-serif">M/S
59R3103</font><font size=3><br>Work: (510) 486-5060</font><font size=3 color=blue><u><br></u></font><a href="mailto:tperciano@lbl.gov" target="_blank"><font size=3 color=blue><u>tperciano@lbl.gov</u></font></a><font size=3 color=blue><u><br></u></font><a href="http://tperciano.wixsite.com/home" target="_blank"><font size=3 color=blue><u>http://tperciano.wixsite.com/home</u></font></a><tt><font size=2>_______________________________________________<br>Openmp-dev mailing list</font></tt><font size=3 color=blue><u><br></u></font><a href="mailto:Openmp-dev@lists.llvm.org" target="_blank"><tt><font size=2 color=blue><u>Openmp-dev@lists.llvm.org</u></font></tt></a><font size=3 color=blue><u><br></u></font><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev" target="_blank"><tt><font size=2 color=blue><u>https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</u></font></tt></a><font size=3><br><br></font><p><font size=3><br><br>-- <br>Dr. Talita Perciano<br>Research Scientist - CRD, Lawrence Berkeley National Laboratory<br>Data Analytics & Visualization Group</font><font size=2><br>Center for Advanced Mathematics for Energy Research Applications<br>One Cyclotron Road<br>Berkeley, CA 94720<br>059-3034B  </font><font size=2 color=#2f2f2f face="sans-serif">M/S
59R3103</font><font size=3><br>Work: (510) 486-5060</font><font size=3 color=blue><u><br></u></font><a href="mailto:tperciano@lbl.gov" target="_blank"><font size=3 color=blue><u>tperciano@lbl.gov</u></font></a><font size=3 color=blue><u><br></u></font><a href="http://tperciano.wixsite.com/home" target="_blank"><font size=3 color=blue><u>http://tperciano.wixsite.com/home</u></font></a><font size=3><br><br><br><br>-- <br>Dr. Talita Perciano<br>Research Scientist - CRD, Lawrence Berkeley National Laboratory<br>Data Analytics & Visualization Group</font><font size=2><br>Center for Advanced Mathematics for Energy Research Applications<br>One Cyclotron Road<br>Berkeley, CA 94720<br>059-3034B  </font><font size=2 color=#2f2f2f face="sans-serif">M/S
59R3103</font><font size=3><br>Work: (510) 486-5060</font><font size=3 color=blue><u><br></u></font><a href="mailto:tperciano@lbl.gov" target="_blank"><font size=3 color=blue><u>tperciano@lbl.gov</u></font></a><font size=3 color=blue><u><br></u></font><a href="http://tperciano.wixsite.com/home" target="_blank"><font size=3 color=blue><u>http://tperciano.wixsite.com/home</u></font></a><tt><font size=2>_______________________________________________<br>Openmp-dev mailing list</font></tt><tt><font size=2 color=blue><u><br></u></font></tt><a href="mailto:Openmp-dev@lists.llvm.org" target="_blank"><tt><font size=2 color=blue><u>Openmp-dev@lists.llvm.org</u></font></tt></a><font size=3 color=blue><u><br></u></font><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev" target="_blank"><tt><font size=2 color=blue><u>https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</u></font></tt></a><font size=3><br><br><br></font><p><br><br><font size=3>-- </font><br><font size=3>Dr. Talita Perciano</font><br><font size=3>Research Scientist - CRD, Lawrence Berkeley National Laboratory<br>Data Analytics & Visualization Group</font><br><font size=2>Center for Advanced Mathematics for Energy Research Applications</font><br><font size=2>One Cyclotron Road<br>Berkeley, CA 94720</font><br><font size=2>059-3034B  </font><font size=2 color=#2f2f2f face="sans-serif">M/S
59R3103</font><br><font size=3>Work: (510) 486-5060</font><br><a href="mailto:tperciano@lbl.gov" target="_blank"><font size=3 color=blue><u>tperciano@lbl.gov</u></font></a><br><a href="http://tperciano.wixsite.com/home" target="_blank"><font size=3 color=blue><u>http://tperciano.wixsite.com/home</u></font></a><br><br><br><BR>