Intel® oneAPI Base Toolkit
Support for the core tools and libraries within the base toolkit that are used to build and deploy high-performance data-centric applications.
419 Discussions

DPC++ compilation error in the DPCT migrated code

Onswar
Beginner
976 Views

I am examining the DPCT migration using a simple "CUDA 10.2 Runtime" project template.

When compiling the migrated DPC++ codes, it occurs the following compilation error.

1>In file included from kernel.dp.cpp:3:
1>In file included from C:\Program Files (x86)\Intel\oneAPI\dpcpp-ct\2021.1-beta09\include\dpct/dpct.hpp:27:
1>C:\Program Files (x86)\Intel\oneAPI\dpcpp-ct\2021.1-beta09\include\dpct/device.hpp(218,16): : error : no member named 'max_element' in namespace 'std'
1> std::max_element(sub_group_sizes.begin(), sub_group_sizes.end());

 

I think that it is same the previous post.

https://community.intel.com/t5/Intel-oneAPI-Base-Toolkit/dpct-dpct-hpp-device-hpp-requires-c-17-feature/td-p/1211562/jump-to/first-unread-message 

 

I confirmed occurring the compilation error in my migrated code after change to the project property

[DPC++]->[Language]->[C++ Language Standard]

/std:c++14, /std:c++17, /std:c++20

 respectively.

error log is same above.

 

std::max_element is defined at <algorithm> header, but it is not included in <dpct/dpct.hpp>

I tried the following modification, so compilation was succeeded.

before

#include <CL/sycl.hpp>
#include <dpct/dpct.hpp>

after

#include <CL/sycl.hpp>
#include <algorithm> /* INSERTED */
#include <dpct/dpct.hpp>

kernel.dp.cpp

 

It may be need #include <algorithm> in device.hpp, I think.

 

  • Windows10 pro / Visual Studio Community 2019 (Version 16.7.3)
  • Intel Celeron (Skylake)
  • GPU: Gen9
  • 27.20.100.8681 DCH
  • Intel® DPC++ Compatibility Tool – toolkit version: 2021.1-beta09, extension version 2021.1.0.16, Package ID: w_oneAPI_2021.1.662
  • Intel® oneAPI DPC++ Compiler – toolkit version: 2021.1-beta09, extension version 2021.1.0.16, Package ID: w_oneAPI_2021.1.2115
  • CUDA 10.2

 

Thanks,

On

0 Kudos
1 Solution
AbhishekD_Intel
Moderator
953 Views

Hi On,

 

Thanks for reaching out to us.

The link to the post that you have mentioned is related to the Linux environment and that error is due to c++11 and c++14 standards.

 

The error you are getting is related to Windows System, though by default the compiler uses c++17 it will show this error in some environments. We have already reported this error to the concerned team.

 

As of now for a workaround, you can add #include <algorithm> in device.hpp file, so that you can compile all of your migrated codes without getting such error.

 

 

Warm Regards,

Abhishek

 

View solution in original post

0 Kudos
3 Replies
AbhishekD_Intel
Moderator
954 Views

Hi On,

 

Thanks for reaching out to us.

The link to the post that you have mentioned is related to the Linux environment and that error is due to c++11 and c++14 standards.

 

The error you are getting is related to Windows System, though by default the compiler uses c++17 it will show this error in some environments. We have already reported this error to the concerned team.

 

As of now for a workaround, you can add #include <algorithm> in device.hpp file, so that you can compile all of your migrated codes without getting such error.

 

 

Warm Regards,

Abhishek

 

0 Kudos
Onswar
Beginner
944 Views

Thanks, response.

To use the suggested workaround is no problem, I can advance my experiments.

 

Regards,

On

0 Kudos
AbhishekD_Intel
Moderator
928 Views

Hi On,


Thanks for the confirmation, please feel free to post a new thread if you have any other issues.



Warm Regards,

Abhishek


0 Kudos
Reply