<div dir="ltr"><div>Alexey,</div><div>Thanks! It builds without the -fno-rtti.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 17, 2020 at 8:19 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>
    <p>Hi Itaru, update the compiler and try to compile your example
      without -fno-rtti. It should compile fine.<br>
    </p>
    <pre cols="72">-------------
Best regards,
Alexey Bataev</pre>
    <div>15.01.2020 3:36 PM, Itaru Kitayama
      пишет:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Yes, with -fno-rtti it does.</div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Thu, Jan 16, 2020 at 10:34
          AM Doerfert, Johannes <<a href="mailto:jdoerfert@anl.gov" target="_blank">jdoerfert@anl.gov</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">This
          works with -fno-rtti, correct? It should work either way but I
          am<br>
          just curious.<br>
          <br>
          On 01/16, Itaru Kitayama wrote:<br>
          > Today's Trunk can not build below code:<br>
          > <br>
          >  #include <stdio.h><br>
          > <br>
          > class AbsBase {<br>
          > public:<br>
          > virtual int f(int&) = 0;<br>
          > };<br>
          > <br>
          > class Derived : public AbsBase {<br>
          > private:<br>
          > int d_;<br>
          > public:<br>
          > int f(int &x) { return d_ = x; }<br>
          > <br>
          > };<br>
          > <br>
          > int main() {<br>
          > #pragma omp target parallel for<br>
          > for (int i=0;i<10;i++) {<br>
          > int x=123;<br>
          > Derived d;<br>
          > printf("%d\n",d.f(x));<br>
          > }<br>
          > }<br>
          > <br>
          > [kitayama1@juronc12 pcp0151]$ clang++ -g -fopenmp
          -fopenmp-targets=nvptx64<br>
          > test2.cpp<br>
          > nvlink error   : Undefined reference to<br>
          > '_ZTVN10__cxxabiv117__class_type_infoE' in
          '/tmp/test2-515e4a.cubin'<br>
          > nvlink error   : Undefined reference to<br>
          > '_ZTVN10__cxxabiv120__si_class_type_infoE' in
          '/tmp/test2-515e4a.cubin'<br>
          > clang-11: error: nvlink command failed with exit code 255
          (use -v to see<br>
          > invocation)<br>
          > <br>
          > On Wed, Jan 15, 2020 at 11:31 PM Alexey Bataev <<a href="mailto:a.bataev@hotmail.com" target="_blank">a.bataev@hotmail.com</a>> wrote:<br>
          > <br>
          > > Yes, it works, since you're actually don't use
          mapped data. Instead you<br>
          > > create the local one, which can be used directly
          without any issues. Local<br>
          > > objects should work fine,but not the mapped ones.<br>
          > ><br>
          > > Best regards,<br>
          > > Alexey Bataev<br>
          > ><br>
          > > 14 янв. 2020 г., в 23:17, Itaru Kitayama <<a href="mailto:itaru.kitayama@gmail.com" target="_blank">itaru.kitayama@gmail.com</a>><br>
          > > написал(а):<br>
          > ><br>
          > > <br>
          > > #include <stdio.h><br>
          > ><br>
          > > class Base {<br>
          > > public:<br>
          > >         virtual int f() { return 2;}<br>
          > > };<br>
          > > class D : public Base {<br>
          > > public:<br>
          > >         int f() { return 1234; }<br>
          > > };<br>
          > ><br>
          > > int main() {<br>
          > >         D *d = new D();<br>
          > > #pragma omp target parallel for map(to: d[0:1])<br>
          > >         for (int i=0;i<10;i++) {<br>
          > >                 D d1(*d);<br>
          > >                 printf("arr[0] is %d\n", d1.f());<br>
          > >         }<br>
          > > }<br>
          > ><br>
          > > The above works even though an instance of class D
          is not a trivially<br>
          > > mappable type.<br>
          > ><br>
          > > On Wed, Jan 15, 2020 at 2:32 PM Alexey Bataev <<a href="mailto:a.bataev@hotmail.com" target="_blank">a.bataev@hotmail.com</a>><br>
          > > wrote:<br>
          > ><br>
          > >> And it should fail since you're mapping non
          trivially copyable type.<br>
          > >><br>
          > >> Best regards,<br>
          > >> Alexey Bataev<br>
          > >><br>
          > >> 14 янв. 2020 г., в 19:14, Itaru Kitayama <<a href="mailto:itaru.kitayama@gmail.com" target="_blank">itaru.kitayama@gmail.com</a>><br>
          > >> написал(а):<br>
          > >><br>
          > >> <br>
          > >> This piece of C++ program execution fails at run
          time.<br>
          > >><br>
          > >> #include <stdio.h><br>
          > >><br>
          > >> class AbsBase {<br>
          > >> public:<br>
          > >>         virtual int f() = 0;<br>
          > >> };<br>
          > >><br>
          > >> class Derived : public AbsBase {<br>
          > >> private:<br>
          > >>         int *arr = new int[100];<br>
          > >> public:<br>
          > >>         int f() { return arr[0]; }<br>
          > >>         void fillarray() {<br>
          > >>                 arr[0] = 1234;<br>
          > >>         }<br>
          > >> };<br>
          > >><br>
          > >> int main() {<br>
          > >>         AbsBase *absBase = new Derived();<br>
          > >>       
           static_cast<Derived*>(absBase)->fillarray();<br>
          > >> #pragma omp target parallel for map(to:
          absBase[0:1])<br>
          > >>         for (int i=0;i<10;i++) {<br>
          > >>                 Derived
          d1(*static_cast<Derived*>(absBase));<br>
          > >>                 printf("arr[0] is %d\n",
          d1.f());<br>
          > >>         }<br>
          > >> }<br>
          > >><br>
          > >> On Sun, Jan 12, 2020 at 1:45 PM Doerfert,
          Johannes <<a href="mailto:jdoerfert@anl.gov" target="_blank">jdoerfert@anl.gov</a>><br>
          > >> wrote:<br>
          > >><br>
          > >>> On 01/12, Itaru Kitayama wrote:<br>
          > >>> > Do you guys have a timeframe for that
          feature<br>
          > >>> > Implemented?<br>
          > >>><br>
          > >>> I do not and I don't know anyone who will
          drive this right now.<br>
          > >>><br>
          > >>> As mentioned before, you should be able to
          "move/copy-create" the<br>
          > >>> elements on the device in order to use
          virtual functions.<br>
          > >>><br>
          > >>><br>
          > >>> > On Sun, Jan 12, 2020 at 12:51 Doerfert,
          Johannes <<a href="mailto:jdoerfert@anl.gov" target="_blank">jdoerfert@anl.gov</a>><br>
          > >>> wrote:<br>
          > >>> ><br>
          > >>> > > On 01/11, Alexey Bataev via
          Openmp-dev wrote:<br>
          > >>> > > > Virtual functions are not
          supported.<br>
          > >>> > ><br>
          > >>> > > Not yet ;).<br>
          > >>> > ><br>
          > >>> > > We'll get it with 5.1 so we might
          actually implement it soon. Till<br>
          > >>> then,<br>
          > >>> > > you have to create the object on
          the device you call the virtual<br>
          > >>> > > function.<br>
          > >>> > ><br>
          > >>><br>
          > >>> --<br>
          > >>><br>
          > >>> Johannes Doerfert<br>
          > >>> Researcher<br>
          > >>><br>
          > >>> Argonne National Laboratory<br>
          > >>> Lemont, IL 60439, USA<br>
          > >>><br>
          > >>> <a href="mailto:jdoerfert@anl.gov" target="_blank">jdoerfert@anl.gov</a><br>
          > >>><br>
          > >><br>
          <br>
          -- <br>
          <br>
          Johannes Doerfert<br>
          Researcher<br>
          <br>
          Argonne National Laboratory<br>
          Lemont, IL 60439, USA<br>
          <br>
          <a href="mailto:jdoerfert@anl.gov" target="_blank">jdoerfert@anl.gov</a><br>
        </blockquote>
      </div>
    </blockquote>
  </div>

</blockquote></div></div>