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

Issues compiling ShivaniK_Intel's hello_world.cpp.

Zippy_Pinhead
Beginner
1,439 Views

I am trying to build the hello_world.cpp ShivaniK_Intel suggested in this problem solution: community.intel.com/t5/Intel-oneAPI-Base-Toolkit/DPC-setup-question/m-p/1317438#M1823

I got past the fact that installing the intel-basekit did not include intel-oneapi-compiler-dpcpp-cpp-common as a prerequisite by installing it by hand. Now I am dealing with this issue:

toddb@zippy $ dpcpp hello_world.cpp
In file included from hello_world.cpp:1:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl.hpp:11:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/accessor.hpp:13:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/buffer.hpp:11:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/detail/buffer_impl.hpp:19:
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2336:48: error: 'T' does not refer to a value
using FieldT = decltype(__builtin_field_type(T, NumFieldsToCheck - 1));
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2333:20: note: declared here
template <typename T, unsigned NumFieldsToCheck>
^
...
13 errors generated.

To make this more complete, here is the program I am trying to compile:

#include <CL/sycl.hpp>
#include <iostream>
using namespace sycl;
const std::string secret {
"Ifmmp-!xpsme\"\012J(n!tpssz-!Ebwf/!"
"J(n!bgsbje!J!dbo(u!ep!uibu/!.!IBM\01"};
const auto sz = secret.size();
int main() {
queue Q;
char*result = malloc_shared<char>(sz, Q);
std::memcpy(result,secret.data(),sz);
Q.parallel_for(sz,[=](auto&i) {
result[i] -= 1;
}).wait();
std::cout << result << "\n";
return 0;
}

I do not know why ShivaniK_Intel chose such an unreadable example, but that is one of life's great mysteries. (smiley face)

Any help in getting this hello_world.cpp to compile is appreciated.

This is a fresh install of intel-basekit with the additional install mentioned above to fix the problem with the basekit prerequisites.

The install is on Ubuntu Linux Kernel version 18.04.6.

 

Thank you,

Zippy

0 Kudos
1 Solution
ShivaniK_Intel
Moderator
1,335 Views

Hi,

 

Could you please follow the steps in the below link and try re-installing the latest version of Intel oneAPI toolkits.

 

https://software.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/apt.html#apt

 

To check whether the installation is successful, first do run setvars.sh script as follows:

 

source <install-dir>/setvars.sh

 

Now, try checking any compiler version.

 

dpcpp --verion

 

Expected Output:

ShivaniK_Intel_0-1633516202679.png

After successful installation, try running the hello_world.cpp program.

Compilation command: dpcpp hello_world.cpp -o hello_world

Execution command:./hello_world

Expected output:

ShivaniK_Intel_1-1633516391593.png

 

Thanks & Regards

Shivani

 

View solution in original post

0 Kudos
5 Replies
ShivaniK_Intel
Moderator
1,391 Views

Hi,

 

Thanks for reaching out to us.

 

Could you please confirm whether you are able to compile and execute a sample simple-add program?

 

>>>I do not know why ShivaniK_Intel chose such an unreadable example, but that is one of life's great mysteries. (smiley face)

 

As the user from your referred thread is working on hello_world.cpp program from the Data-Parallel C++ book (https://link.springer.com/content/pdf/10.1007%2F978-1-4842-5574-2.pdf), so we have chosen the same source code.

 

Could you also confirm the version of dpcpp compiler you have been using?

 

Please refer to the attachment for the sample simple-add program.

 

Thanks & Regards

Shivani

 

0 Kudos
Zippy_Pinhead
Beginner
1,371 Views
toddb@zippy $ dpcpp simple-add.cpp
In file included from simple-add.cpp:22:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl.hpp:11:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/accessor.hpp:13:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/buffer.hpp:11:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/detail/buffer_impl.hpp:19:
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2336:48: error: 'T' does not refer to a value
using FieldT = decltype(__builtin_field_type(T, NumFieldsToCheck - 1));
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2333:20: note: declared here
template <typename T, unsigned NumFieldsToCheck>
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2337:36: error: use of undeclared identifier 'FieldT'
static_assert(is_device_copyable<FieldT>::value ||
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2338:56: error: use of undeclared identifier 'FieldT'
detail::IsDeprecatedDeviceCopyable<FieldT>::value,
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2349:46: error: 'T' does not refer to a value
using BaseT = decltype(__builtin_base_type(T, NumBasesToCheck - 1));
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2346:20: note: declared here
template <typename T, unsigned NumBasesToCheck>
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2350:36: error: use of undeclared identifier 'BaseT'
static_assert(is_device_copyable<BaseT>::value ||
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2351:56: error: use of undeclared identifier 'BaseT'
detail::IsDeprecatedDeviceCopyable<BaseT>::value,
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2370:64: error: 'FuncT' does not refer to a value
: CheckFieldsAreDeviceCopyable<FuncT, __builtin_num_fields(FuncT)>,
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2368:20: note: declared here
template <typename FuncT>
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2371:62: error: 'FuncT' does not refer to a value
CheckBasesAreDeviceCopyable<FuncT, __builtin_num_bases(FuncT)> {};
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/types.hpp:2368:20: note: declared here
template <typename FuncT>
^
In file included from simple-add.cpp:22:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl.hpp:15:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/backend.hpp:23:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/kernel_bundle.hpp:13:
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/detail/kernel_desc.hpp:104:63: error: 'T' does not refer to a value
static constexpr auto n = __builtin_sycl_unique_stable_name(T);
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/detail/kernel_desc.hpp:102:20: note: declared here
template <typename T> struct KernelInfoImpl {
^
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/detail/kernel_desc.hpp:106:26: error: subscripted value is not an array, pointer, or vector
static KernelInfoData<n[I]...> impl(index_sequence<I...>) {
~^~
/opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/detail/kernel_desc.hpp:111:67: error: cannot initialize a parameter of type 'const char *' with an lvalue of type 'const auto'
using type = decltype(impl(make_index_sequence<__builtin_strlen(n)>{}));
^
In file included from simple-add.cpp:22:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl.hpp:42:
In file included from /opt/intel/oneapi/compiler/latest/linux/include/sycl/CL/sycl/program.hpp:19:
/opt/intel/oneapi/compiler/2021.4.0/linux/include/sycl/ext/oneapi/experimental/spec_constant.hpp:54:59: error: 'ID' does not refer to a value
const char *TName = __builtin_sycl_unique_stable_name(ID);
^
/opt/intel/oneapi/compiler/2021.4.0/linux/include/sycl/ext/oneapi/experimental/spec_constant.hpp:34:32: note: declared here
template <typename T, typename ID = T> class spec_constant {
^
/opt/intel/oneapi/compiler/2021.4.0/linux/include/sycl/ext/oneapi/experimental/spec_constant.hpp:67:59: error: 'ID' does not refer to a value
const char *TName = __builtin_sycl_unique_stable_name(ID);
^
/opt/intel/oneapi/compiler/2021.4.0/linux/include/sycl/ext/oneapi/experimental/spec_constant.hpp:34:32: note: declared here
template <typename T, typename ID = T> class spec_constant {
^
13 errors generated

 

Above, you can see the same 13 errors when compiling simple_add.cpp.

 

Here is my version of dpcpp:

toddb@zippy $ dpcpp --version
Intel(R) oneAPI DPC++ Compiler 2021.1 (2020.8.0.0827)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/intel/compilers_and_libraries_2020.4.304/linux/bin

 

Please let me know if there is anything else.

 

-Todd

 

p.s. Let me remind anyone reading that when I did the initial install, the CL (sycl) includes were not installed because of a broken dependency in intel-basekit. Here is what I have for intel-basekit and the item which failed to install properly:

 

toddb@zippy $ s apt install intel-basekit
Reading package lists... Done
Building dependency tree
Reading state information... Done
intel-basekit is already the newest version (2021.4.0-3422).
0 upgraded, 0 newly installed, 0 to remove and 20 not upgraded.
Mon Oct 04 13:27:15 ~/Work/oneAPI/Hello_world
toddb@zippy $ s apt install intel-oneapi-compiler-dpcpp-cpp-common-2021.4.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
intel-oneapi-compiler-dpcpp-cpp-common-2021.4.0 is already the newest version (2021.4.0-3561).
0 upgraded, 0 newly installed, 0 to remove and 20 not upgraded.
Mon Oct 04 13:27:19 ~/Work/oneAPI/Hello_world

 

0 Kudos
ShivaniK_Intel
Moderator
1,336 Views

Hi,

 

Could you please follow the steps in the below link and try re-installing the latest version of Intel oneAPI toolkits.

 

https://software.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/apt.html#apt

 

To check whether the installation is successful, first do run setvars.sh script as follows:

 

source <install-dir>/setvars.sh

 

Now, try checking any compiler version.

 

dpcpp --verion

 

Expected Output:

ShivaniK_Intel_0-1633516202679.png

After successful installation, try running the hello_world.cpp program.

Compilation command: dpcpp hello_world.cpp -o hello_world

Execution command:./hello_world

Expected output:

ShivaniK_Intel_1-1633516391593.png

 

Thanks & Regards

Shivani

 

0 Kudos
Zippy_Pinhead
Beginner
1,322 Views

Shivani,

This worked! Thank you very much. I thought I had already "cycled the power" on the install once, but perhaps I missed something.

For anyone else trying this fix, I added this to your instructions:

After doing the autoremove, I checked to see if any components were still installed:

toddb@zippy $ s apt list --installed | grep intel-oneapi

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

intel-oneapi-common-licensing-2021.4.0/all,all,all,now 2021.4.0-327 all [installed,automatic]
intel-oneapi-common-vars/all,all,all,now 2021.4.0-327 all [installed,automatic]
intel-oneapi-compiler-cpp-eclipse-cfg/all,all,all,now 2021.4.0-3561 all [installed,automatic]
intel-oneapi-compiler-dpcpp-cpp-common-2021.4.0/all,all,all,now 2021.4.0-3561 all [installed]
intel-oneapi-compiler-dpcpp-eclipse-cfg/all,all,all,now 2021.4.0-3561 all [installed,automatic]
intel-oneapi-dpcpp-debugger/all,now 10.2.4-56 amd64 [installed]
intel-oneapi-dpcpp-debugger-10.2.4/all,now 10.2.4-56 amd64 [installed,automatic]
intel-oneapi-dpcpp-debugger-eclipse-cfg/all,all,all,now 10.2.4-56 all [installed,automatic]
intel-oneapi-runtime-dpcpp-cpp-common/all,all,all,now 2021.4.0-3561 all [installed]

I then was able to uninstall the rest by doing an "autoremove" on the licensing package, to which everything else appeared to be a dependent. You can see now there is nothing installed:

toddb@zippy $ s apt list --installed | grep intel-oneapi

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

The output from the compiler version check and hello_world.cpp is the same as what you posted. Thank you once again for taking the time to help.

I will now install the debugger and a couple of other things and move forward!

 

-Zippy

 

0 Kudos
ShivaniK_Intel
Moderator
1,262 Views

Hi,


Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will be no longer monitored by Intel.


Thanks & Regards

Shivani



0 Kudos
Reply