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.
417 Discussions

Cannot build Vector Add sample project

ivpran521
Beginner
2,889 Views

Eclipse cannot recognize buffer and accessor after installing oneAPI toolkits. Project building failed with errors.

Configuration:

Eclipse IDE for Scientific Computing (includes Incubating components)
Version: 2021-06 (4.20.0)
Build id: 20210612-2011
OS: Linux, v.4.15.3-3-generic, x86_64 / gtk 3.22.30
Java vendor: Oracle Corporation
Java runtime version: 16.0.2+7-67
Java version: 16.0.2

Attachments contain IDE screenshots with related problems.

0 Kudos
1 Solution
Khalik_K_Intel
Moderator
2,447 Views

Hello,

More information on this issue.

This is a known issue in Eclipse CDT indexer. Eclipse CDT indexer does not support Class template argument deduction (CTAD).

vector-add sample code uses the CTAD C++17 language feature, but Eclipse CDT indexer can not support CTAD in code below:


buffer a_buf(a_vector);

buffer b_buf(b_vector);

buffer sum_buf(sum_parallel.data(), num_items);


accessor a(a_buf, h, read_only);

accessor b(b_buf, h, read_only);

accessor sum(sum_buf, h, write_only, no_init);


The bug/feature in Eclipse CDT indexer is at link https://bugs.eclipse.org/bugs/show_bug.cgi?id=567764.

It's still not implemented in Eclipse 2021-06 yet.

 The workaround is to specify explicit arguments to class template 'buffer' and 'accessor'. For example,

 

buffer<int> a_buf(a_vector);

buffer<int> b_buf(b_vector);

buffer<int> sum_buf(sum_parallel.data(), num_items);


accessor<int, 1, access::mode::read> a(a_buf, h, read_only);

accessor<int, 1, access::mode::read> b(b_buf, h, read_only);

accessor<int, 1, access::mode::write> sum(sum_buf, h, write_only, no_init);


As, there is been no communication from thread originator for a long time and several workarounds has been provided we are closing this thread. We will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread.

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


View solution in original post

0 Kudos
13 Replies
ivpran521
Beginner
2,877 Views

After installing newer version of gcc (7.3.0 instead of 6.3.0) it became possible to build project. But i can't run project.

root@Eklenov:~/eclipse-workspace/Base__Vector_Add# make clean         
rm -f vector-add-buffers vector-add-usm
root@Eklenov:~/eclipse-workspace/Base__Vector_Add# make build_buffers
dpcpp -O2 -g -std=c++17 -o vector-add-buffers src/vector-add-buffers.cpp
root@Eklenov:~/eclipse-workspace/Base__Vector_Add# make build_usm     
dpcpp -O2 -g -std=c++17 -o vector-add-usm src/vector-add-usm.cpp
root@Eklenov:~/eclipse-workspace/Base__Vector_Add# make run_usm       
./vector-add-usm
An exception is caught while adding two vectors.
terminate called after throwing an instance of 'cl::sycl::runtime_error'
 what():  No device of requested type available. Please check https://software.intel.com/c
ontent/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html -1 (CL_DEVICE
_NOT_FOUND)
Makefile:22: ошибка выполнения рецепта для цели «run_usm»
make: *** [run_usm] Аварийный останов

And Eclipse still don't resolve accessor and buffer.

0 Kudos
ArpitaP_Intel
Moderator
2,861 Views

Hi Vitaly,


Thanks for reaching out to us.


Please provide us with the output for "sycl-ls --verbose" command. Also, please check if you are able to run the below commands successfully


export SYCL_DEVICE_FILTER=cpu(if running code on CPU)

export SYCL_DEVICE_FILTER=opencl:gpu(if running code on GPU)


Thanks!



0 Kudos
ivpran521
Beginner
2,854 Views

root@Eklenov:~# sycl-ls --verbose
Platforms: 1
Platform [#1]:
   Version  : 1.2
   Name     : SYCL host platform
   Vendor   :  
   Devices  : 1
       Device [#0]:
       Type       : HOST
       Version    : 1.2
       Name       : SYCL host device
       Vendor     :  
       Driver     : 1.2
default_selector()      : No device of requested type available. Please chec...
host_selector()         : No device of requested type available. Please chec...
accelerator_selector()  : No device of requested type available. Please chec...
cpu_selector()          : No device of requested type available. Please chec...
gpu_selector()          : No device of requested type available. Please chec...
custom_selector(gpu)    : No device of requested type available. Please chec...
custom_selector(cpu)    : No device of requested type available. Please chec...
custom_selector(acc)    : No device of requested type available. Please chec...
root@Eklenov:~# export SYCL_DEVICE_FILTER=cpu
root@Eklenov:~# sycl-ls --verbose             
Platforms: 1
Platform [#1]:
   Version  : 1.2
   Name     : SYCL host platform
   Vendor   :  
   Devices  : 1
       Device [#0]:
       Type       : HOST
       Version    : 1.2
       Name       : SYCL host device
       Vendor     :  
       Driver     : 1.2
default_selector()      : No device of requested type available. Please chec...
host_selector()         : No device of requested type available. Please chec...
accelerator_selector()  : No device of requested type available. Please chec...
cpu_selector()          : No device of requested type available. Please chec...
gpu_selector()          : No device of requested type available. Please chec...
custom_selector(gpu)    : No device of requested type available. Please chec...
custom_selector(cpu)    : No device of requested type available. Please chec...
custom_selector(acc)    : No device of requested type available. Please chec...
root@Eklenov:~# cd eclipse-workspace/Base__Vector_Add/
root@Eklenov:~/eclipse-workspace/Base__Vector_Add# make clean                             
rm -f vector-add-buffers vector-add-usm
root@Eklenov:~/eclipse-workspace/Base__Vector_Add# make build_buffers                     
dpcpp -O2 -g -std=c++17 -o vector-add-buffers src/vector-add-buffers.cpp
root@Eklenov:~/eclipse-workspace/Base__Vector_Add# make build_usm                         
dpcpp -O2 -g -std=c++17 -o vector-add-usm src/vector-add-usm.cpp
root@Eklenov:~/eclipse-workspace/Base__Vector_Add# make run_usm                           
./vector-add-usm
An exception is caught while adding two vectors.
terminate called after throwing an instance of 'cl::sycl::runtime_error'
 what():  No device of requested type available. Please check https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html -1 (CL_DEVICE_NOT_F
OUND)
Makefile:22: ошибка выполнения рецепта для цели «run_usm»
make: *** [run_usm] Аварийный останов
root@Eklenov:~/eclipse-workspace/Base__Vector_Add#

0 Kudos
ivpran521
Beginner
2,809 Views

All problems solved, except Eclipse cannot resolve types. I upgraded glibc and installed Intel Compute Runtime by this instruction:

https://github.com/intel/compute-runtime/releases

0 Kudos
Khalik_K_Intel
Moderator
2,796 Views

Hello Vitaly,


Thank you for contacting Intel Support.


I am glad that you have made the progress on this already.

I would like to know if you still have any issue with the sample.

If yes, then please provide the details on your current environment, current output of "sycl-ls" and "dpcpp --version" commands as a first step.

Thanks.


Kind regards,

Khalik.


0 Kudos
Khalik_K_Intel
Moderator
2,786 Views

Please also see the following page to ensure you have followed all the steps necessary to build and run the sample:

https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-base-linux/top/run-a-sample-project-using-an-ide.html


Regards,

Khalik.


0 Kudos
ivpran521
Beginner
2,764 Views

Eclipse still cannot resolve buffer and accessor.

Eclipse_issue.png

 

root@Eklenov:~# cd eclipse/parallel-2021-06/eclipse/
root@Eklenov:~/eclipse/parallel-2021-06/eclipse# . /opt/intel/oneapi/setvars.sh

:: initializing oneAPI environment ...
bash: BASH_VERSION = 4.4.12(1)-release
:: advisor -- latest
:: ccl -- latest
:: clck -- latest
:: compiler -- latest
:: dal -- latest
:: debugger -- latest
:: dev-utilities -- latest
:: dnnl -- latest
:: dpcpp-ct -- latest
:: dpl -- latest
:: inspector -- latest
:: intelpython -- latest
:: ipp -- latest
:: ippcp -- latest
:: ipp -- latest
:: itac -- latest
:: mkl -- latest
:: mpi -- latest
:: tbb -- latest
:: vpl -- latest
:: vtune -- latest
:: oneAPI environment initialized ::

root@Eklenov:~/eclipse/parallel-2021-06/eclipse# sycl-ls
0. CPU : Intel(R) OpenCL 2.1 [2021.12.6.0.19_160000]
1. GPU : Intel(R) OpenCL HD Graphics 3.0 [21.30.20482]
2. ACC : Intel(R) FPGA Emulation Platform for OpenCL(TM) 1.2 [2021.12.6.0.19_160000]
3. GPU : Intel(R) Level-Zero 1.1 [1.1.20482]
4. HOST: SYCL host platform 1.2 [1.2]
root@Eklenov:~/eclipse/parallel-2021-06/eclipse# dpcpp --version
Intel(R) oneAPI DPC++/C++ Compiler 2021.3.0 (2021.3.0.20210619)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/intel/oneapi/compiler/2021.3.0/linux/bin
root@Eklenov:~/eclipse/parallel-2021-06/eclipse# ./eclipse
OpenJDK 64-Bit Server VM warning: Option --illegal-access is deprecated and will be removed in a future release.
авг. 06, 2021 5:29:51 PM com.intel.launchers.main.Activator loadComponents
INFO: Processing component xml file: /resources/components/advisor.xml
авг. 06, 2021 5:29:51 PM com.intel.launchers.main.Activator loadComponents
INFO: Processing component xml file: /resources/components/vtune.xml
updateData platformConfiguration : com.intel.samples.platform.PlatformConfigurationWorkingCopy@3755b8da
updateData location : /root/eclipse-workspace
updateData builder : make
updateData projectName : Base__Vector_Add
updateData sample : com.intel.samples.core.Sample@6809add8

0 Kudos
Khalik_K_Intel
Moderator
2,712 Views

This looks like something is wrong with your setup.

This could be the indexer. You can try to flush it: Project -> C/C++ Index -> Rebuild.


Buffers and accessors are part of CL/sycl.hpp, so it might be something with your includes also.

If you did not change the source code, then everything should work for standard settings.

You could try to update your includes.

E.g. Project -> C/C++ Index -> Re-resolve unresolved includes.


Hope that this helps.


Regards,

Khalik.


0 Kudos
ivpran521
Beginner
2,689 Views

This didn't help, thanks for the recommendations anyway.

0 Kudos
Khalik_K_Intel
Moderator
2,685 Views

Can you please check that sycl folder is present in your include paths?

Project -> Properties -> C/C++ General -> Paths and Symbols -> Includes.


Please ensure CL/sycl.hpp can be found by Eclipse.

The CL/sycl.hpp is placed at /installation_path/oneapi/compiler/latest/linux/include/sycl/

It contains various include files, such as CL/sycl/accessor.hpp and CL/sycl/buffer.hpp.


This is surely something with your includes as the sample should work from the box and it works ( I checked on my end).


Regards,

Khalik.


0 Kudos
Khalik_K_Intel
Moderator
2,663 Views

Hello,


Did you manage to fix your issue?


The way to check if the include files are seen is to try to open the declaration of accessor/buffer.


E.g. Point to occurrence of "buffer" -> right click -> Open declaration.

If buffer.hpp file is opened for you, then your includes are seen in your current project.


There is also a way to suppress "type could not be resolved" error:

Point to occurrence of "buffer" -> right click -> Preferences... -> Code Analysis -> Syntax and Semantic Errors -> untick "Type cannot be resolved".

This is not a perfect way to deal with this issue as it will disable all such errors, which could be impactful for big projects.


Please feel free to inform us on your progress or issues.


Regards,

Khalik.


0 Kudos
Khalik_K_Intel
Moderator
2,601 Views

Hello Vitaly,


Has your issue been resolved?


Regards,

Khalik.


0 Kudos
Khalik_K_Intel
Moderator
2,448 Views

Hello,

More information on this issue.

This is a known issue in Eclipse CDT indexer. Eclipse CDT indexer does not support Class template argument deduction (CTAD).

vector-add sample code uses the CTAD C++17 language feature, but Eclipse CDT indexer can not support CTAD in code below:


buffer a_buf(a_vector);

buffer b_buf(b_vector);

buffer sum_buf(sum_parallel.data(), num_items);


accessor a(a_buf, h, read_only);

accessor b(b_buf, h, read_only);

accessor sum(sum_buf, h, write_only, no_init);


The bug/feature in Eclipse CDT indexer is at link https://bugs.eclipse.org/bugs/show_bug.cgi?id=567764.

It's still not implemented in Eclipse 2021-06 yet.

 The workaround is to specify explicit arguments to class template 'buffer' and 'accessor'. For example,

 

buffer<int> a_buf(a_vector);

buffer<int> b_buf(b_vector);

buffer<int> sum_buf(sum_parallel.data(), num_items);


accessor<int, 1, access::mode::read> a(a_buf, h, read_only);

accessor<int, 1, access::mode::read> b(b_buf, h, read_only);

accessor<int, 1, access::mode::write> sum(sum_buf, h, write_only, no_init);


As, there is been no communication from thread originator for a long time and several workarounds has been provided we are closing this thread. We will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread.

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


0 Kudos
Reply