<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Alexey,<div><br></div><div>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:</div><div><br></div><div>Ubuntu 16.04, kernel 4.4.0-142-generic</div><div>gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0<br></div><div>CUDA 10, driver 410.93</div><div><br></div><div>Compiled codes:</div><div><a href="https://github.com/llvm-mirror/compiler-rt/tree/release_80">https://github.com/llvm-mirror/compiler-rt/tree/release_80</a><br></div><div><a href="https://github.com/llvm-mirror/clang/tree/release_80">https://github.com/llvm-mirror/clang/tree/release_80</a><br></div><div><a href="https://github.com/llvm-mirror/openmp/tree/release_80">https://github.com/llvm-mirror/openmp/tree/release_80</a><br></div><div><a href="https://github.com/llvm-mirror/llvm/tree/release_80">https://github.com/llvm-mirror/llvm/tree/release_80</a><br></div><div><br></div><div>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!</div><div><br></div><div>Best,</div><div>Talita</div><div><br></div><div><br></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 14, 2019 at 9:36 AM Alexey Bataev <<a href="mailto:a.bataev@outlook.com">a.bataev@outlook.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <p>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?<br>
    </p>
    <pre class="gmail-m_-8483655630743397270moz-signature" cols="72">-------------
Best regards,
Alexey Bataev</pre>
    <div class="gmail-m_-8483655630743397270moz-cite-prefix">13.02.2019 17:09, Talita Perciano
      пишет:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">Hi Kelvin,
            <div><br>
            </div>
            <div>I see... in my case I used the clang 7 I compiled to
              build the openmp runtime. OS info:</div>
            <div><br>
            </div>
            <div>
              <div>Ubuntu</div>
              <div>VERSION="16.04.5 LTS (Xenial Xerus)"</div>
              <div>Kernel: 4.4.0-141-generic</div>
            </div>
            <div><br>
            </div>
          </div>
          <div>I could try rebuilding the openmp runtime with
            gcc instead. Which gcc version did you use?</div>
          <div><br>
          </div>
          <div>Thanks,</div>
          <div>Talita</div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Wed, Feb 13, 2019 at
              2:02 PM Kelvin Li <<a href="mailto:kli@ca.ibm.com" target="_blank">kli@ca.ibm.com</a>> wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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?<br>
              </font><br>
              <font size="2" face="sans-serif">I assume that you updated
                the example program based on Alexey's suggestion and
                still get the seg fault.</font><br>
              <font size="2" face="sans-serif"><br>
                Kelvin<br>
              </font><br>
              <br>
              <br>
              <br>
              <font size="1" face="sans-serif" color="#5f5f5f">From:    
                   </font><font size="1" face="sans-serif">Talita
                Perciano via Openmp-dev <<a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a>></font><br>
              <font size="1" face="sans-serif" color="#5f5f5f">To:      
                 </font><font size="1" face="sans-serif">Alexey Bataev
                <<a href="mailto:a.bataev@outlook.com" target="_blank">a.bataev@outlook.com</a>></font><br>
              <font size="1" face="sans-serif" color="#5f5f5f">Cc:      
                 </font><font size="1" face="sans-serif">Openmp-dev <<a href="mailto:openmp-dev-bounces@lists.llvm.org" target="_blank">openmp-dev-bounces@lists.llvm.org</a>>,
                "<a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a>"
                <<a href="mailto:openmp-dev@lists.llvm.org" target="_blank">openmp-dev@lists.llvm.org</a>></font><br>
              <font size="1" face="sans-serif" color="#5f5f5f">Date:    
                   </font><font size="1" face="sans-serif">2019/02/13
                04:53 PM</font><br>
              <font size="1" face="sans-serif" color="#5f5f5f">Subject:
                       </font><font size="1" face="sans-serif">Re:
                [Openmp-dev] Segmentation fault libomptarget.so</font><br>
              <font size="1" face="sans-serif" color="#5f5f5f">Sent by:
                       </font><font size="1" face="sans-serif">"Openmp-dev"
                <<a href="mailto:openmp-dev-bounces@lists.llvm.org" target="_blank">openmp-dev-bounces@lists.llvm.org</a>></font><br>
              <hr noshade><br>
              <br>
              <br>
              <font size="3">No worries! Thanks so much!</font><br>
              <br>
              <font size="3">Talita</font><br>
              <br>
              <font size="3">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:</font><br>
              <font size="3">Hi Talita, had no time today, will look at
                it tomorrow,  sorry.<br>
              </font><br>
              <font size="3">Best regards, </font><br>
              <font size="3">Alexey Bataev</font><br>
              <font size="3"><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>
              </font><br>
              <font size="3">Hi, </font><br>
              <br>
              <font size="3">Did any of you guys have the chance to take
                a look at this?</font><br>
              <br>
              <font size="3">Thanks!</font><br>
              <font size="3">Talita</font><br>
              <br>
              <font size="3">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:</font><br>
              <font size="3">Hi, </font><br>
              <br>
              <font size="3">I'm attaching the cmake logs for both llvm
                and openmp.</font><br>
              <br>
              <font size="3">Thanks,</font><br>
              <font size="3">Talita</font><br>
              <br>
              <font size="3">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:</font><br>
              <font size="3">Yes, seems to me something wrong either
                with the compiler, or the way it is used. Need the
                compilation line, logs, error report.<br>
              </font><br>
              <font size="3">Best regards, </font><br>
              <font size="3">Alexey Bataev</font><br>
              <font size="3"><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><br>
              <font size="2" face="sans-serif">This fixed it for me:</font><font size="3"><br>
              </font><font size="2" face="sans-serif"><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];</font><font size="3"><br>
              </font><font size="2" face="sans-serif"><br>
                --Doru</font><font size="3"><br>
                <br>
                <br>
                <br>
              </font><font size="1" face="sans-serif" color="#5f5f5f"><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" face="sans-serif" color="blue"><u>openmp-dev@lists.llvm.org</u></font></a><font size="1" face="sans-serif">></font><font size="1" face="sans-serif" color="#5f5f5f"><br>
                To:        </font><font size="1" face="sans-serif">Alexey
                Bataev <</font><a href="mailto:a.bataev@outlook.com" target="_blank"><font size="1" face="sans-serif" color="blue"><u>a.bataev@outlook.com</u></font></a><font size="1" face="sans-serif">></font><font size="1" face="sans-serif" color="#5f5f5f"><br>
                Cc:        </font><font size="1" face="sans-serif">"</font><a href="mailto:openmp-dev@lists.llvm.org" target="_blank"><font size="1" face="sans-serif" color="blue"><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" face="sans-serif" color="blue"><u>openmp-dev@lists.llvm.org</u></font></a><font size="1" face="sans-serif">></font><font size="1" face="sans-serif" color="#5f5f5f"><br>
                Date:        </font><font size="1" face="sans-serif">02/12/2019
                04:45 PM</font><font size="1" face="sans-serif" color="#5f5f5f"><br>
                Subject:        </font><font size="1" face="sans-serif">Re:
                [Openmp-dev] Segmentation fault libomptarget.so</font><font size="1" face="sans-serif" color="#5f5f5f"><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" face="sans-serif" color="blue"><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>
              <p><font size="3">$./a.out 1000<br>
                  Here<br>
                  <br>
                  min = 0.000047, max = 0.999994, avg = 0.504811</font></p>
              <p><font size="3">$</font></p>
              <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>
              <p><font size="3">#pragma omp target map(from: x[:n])
                  map(tofrom:y[:n])</font></p>
              <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>
                  <br>
                </font><tt><font size="3"><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" face="sans-serif" color="#2f2f2f">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>
              <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" face="sans-serif" color="#2f2f2f">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>
                <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" face="sans-serif" color="#2f2f2f">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><tt><font size="2">_______________________________________________<br>
                    Openmp-dev mailing list<br>
                    <a href="mailto:Openmp-dev@lists.llvm.org" target="_blank">Openmp-dev@lists.llvm.org</a><br>
                  </font></tt><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev" target="_blank"><tt><font size="2">https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev</font></tt></a><tt><font size="2"><br>
                  </font></tt><br>
                <br>
                <br>
              </p>
            </blockquote>
          </div>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div dir="ltr" class="gmail-m_-8483655630743397270gmail_signature">
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div>
                    <div dir="ltr">
                      <div>
                        <div dir="ltr">
                          <div dir="ltr">Dr. Talita Perciano</div>
                          <div dir="ltr">Research Scientist - CRD,
                            Lawrence Berkeley National Laboratory<br>
                            Data Analytics & Visualization Group<br>
                            <div><font size="2">Center for Advanced
                                Mathematics for Energy Research
                                Applications</font></div>
                            <div><span style="font-size:12.8px">One
                                Cyclotron Road</span><br style="font-size:12.8px">
                              <span style="font-size:12.8px">Berkeley,
                                CA 94720</span><span style="font-size:small"><br>
                              </span></div>
                            <div><span style="font-size:small">059-3034B
                                 </span><span>M/S 59R3103</span><font size="2"><br>
                              </font></div>
                          </div>
                          <div dir="ltr">Work: (510) 486-5060<br>
                          </div>
                          <div><a href="mailto:tperciano@lbl.gov" target="_blank">tperciano@lbl.gov</a></div>
                          <div><a href="http://tperciano.wixsite.com/home" target="_blank">http://tperciano.wixsite.com/home</a><br>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </div>

</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Dr. Talita Perciano</div><div dir="ltr">Research Scientist - CRD, Lawrence Berkeley National Laboratory<br>Data Analytics & Visualization Group<br><div><font size="2">Center for Advanced Mathematics for Energy Research Applications</font></div><div><span style="font-size:12.8px">One Cyclotron Road</span><br style="font-size:12.8px"><span style="font-size:12.8px">Berkeley, CA 94720</span><span style="font-size:small"><br></span></div><div><span style="font-size:small">059-3034B  </span><span style="font-size:13px;color:rgb(30,30,30);font-family:"Open Sans",sans-serif">M/S 59R3103</span><font size="2"><br></font></div></div><div dir="ltr">Work: (510) 486-5060<br></div><div><a href="mailto:tperciano@lbl.gov" target="_blank">tperciano@lbl.gov</a></div><div><a href="http://tperciano.wixsite.com/home" target="_blank">http://tperciano.wixsite.com/home</a><br></div></div></div></div></div></div></div></div></div>