Community
cancel
Showing results for 
Search instead for 
Did you mean: 
yhmtsai
Beginner
452 Views

dpct/dpct.hpp (device.hpp) requires c++17 feature

Jump to solution

Hi,

Is C++17 in the dpct requirement?

If I compile the following codes with -std=c++14 or -std=c++17 on devcloud, compilation will fail.

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

int main() {
    std::cout << "Hello Devcloud" << std::endl;
    return 0;
}


The compile command:

dpcpp hello.dp.cpp -std=c++11
dpcpp hello.dp.cpp -std=c++14
dpcpp hello.dp.cpp -std=c++17



dpct/device.hpp uses std::max_element which is introduced in C++17.

The error message:

In file included from hello.dp.cpp:2:
In file included from /glob/development-tools/versions/oneapi/beta09/inteloneapi/dpcpp-ct/2021.1-beta09/include/dpct/dpct.hpp:27:
/glob/development-tools/versions/oneapi/beta09/inteloneapi/dpcpp-ct/2021.1-beta09/include/dpct/device.hpp:218:16: error: no member named 'max_element' in namespace 'std'
          std::max_element(sub_group_sizes.begin(), sub_group_sizes.end());
          ~~~~~^
1 error generated.

 

Thanks,
Mike

0 Kudos
1 Solution
GouthamK_Intel
Moderator
431 Views

Hi Mike,

Yes, dpct headers require C++17, as some of the std algorithms in those dpct header files are based on C++17 standard.


And regarding "If I compile the following codes with -std=c++14 or -std=c++17 on devcloud, compilation will fail."

we assume that you meant -std=c++11 and -std=c++14 gives compilation error.

We have compiled your code on devcloud with c++11, c++14, c++17 and we observed that c++11 and c++14 gives errors. Whereas, code compiles, and executes successfully with -std=c++17.

Also, by default devcloud uses c++17 standard, so there is no need to use --std flag.


If you are facing this issue with -std=c++17 itself then please provide the error logs.


Have a Good day!


Regards

Goutham


View solution in original post

5 Replies
GouthamK_Intel
Moderator
432 Views

Hi Mike,

Yes, dpct headers require C++17, as some of the std algorithms in those dpct header files are based on C++17 standard.


And regarding "If I compile the following codes with -std=c++14 or -std=c++17 on devcloud, compilation will fail."

we assume that you meant -std=c++11 and -std=c++14 gives compilation error.

We have compiled your code on devcloud with c++11, c++14, c++17 and we observed that c++11 and c++14 gives errors. Whereas, code compiles, and executes successfully with -std=c++17.

Also, by default devcloud uses c++17 standard, so there is no need to use --std flag.


If you are facing this issue with -std=c++17 itself then please provide the error logs.


Have a Good day!


Regards

Goutham


View solution in original post

yhmtsai
Beginner
421 Views

Hi Goutham,

"
If I compile the following codes with -std=c++14 or -std=c++17 on devcloud, compilation will fail."
Yes, I wrote wrong statement here, sorry. it is failed with -std=c++11 and -std=c++14.

I see.
The reason behind this problem is that our project currently is on -std=c++14.
We would like to keep same requirement among different module.
If the requirement is c++17, we probably need to compile whole project with c++17 when enabling intel.
or, compile intel with c++17 and others with c++14. I am not sure whether it work or not.

Thanks,
Mike

GouthamK_Intel
Moderator
383 Views

Hi Mike,

As dpct requires std=C++17, you can try either one of the mentioned methods by you as per your project requirement/ flexibility.

If you face any further challenges or errors, please feel free to raise a new thread.


Could please confirm If we have answered all your queries in the current thread and lets us know if we can close this thread from our side.


Have a Good day!


Thanks & Regards

Goutham


yhmtsai
Beginner
376 Views

Hi Goutham,

Yes, you have answered my questions in this current thread.
Thanks a lot!

Regards,
Mike

GouthamK_Intel
Moderator
367 Views

Hi Mike,

Thanks for the confirmation!

As this issue has been resolved, we will no longer respond to this thread. 

If you require any additional assistance from Intel, please start a new thread. 

Any further interaction in this thread will be considered community only. 


Have a Good day!


Thanks & Regards

Goutham


Reply