Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and GDB*
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.
415 Discussions

SYCL program stops when declarating queue but gives no error or output (works in the VS Debugger)

frmar
Beginner
971 Views

I am new to SYCL and I am trying to execute a very simple code. Here it is:

#include <CL/sycl.hpp>
using namespace sycl;

int main() {
    default_selector device_selector;
    std::cout << "Device selector has been initialized.\n";

    queue q(device_selector);
    std::cout << "Queue has been initialized.\n";

    return 0;
}

 

I am using Visual Studio 2019 and I am compilating with Intel oneAPI DPC++ 2022. If I run the code in the Visual Studio Debugger, I obtain:

> Device selector has been initialized.
> Queue has been initialized.
> Sortie de C:\Users\...\Release\test.exe (processus 8516). Code : 0.
> Press any key to continue...

 

So this is perfectly what I am expecting. But if I run the same .exe in my command prompt, I obtain:

> C:\Users\...\Release>test.exe
> Device selector has been initialized.
>
> C:\Users\...\Release>

 

It appears that an error occured during the declaration of the queue.  But what I get back is nothing, no error, just as if the program ran perfectly.

I have also noticed that during the short time when the program is running in the command prompt (something like one second), I saw that the program Windows Problem Reporting ran in the Task Manager. Than it vanished as soon as the program apparently finished to compute.

 

I also tried this code:

#include <CL/sycl.hpp>
using namespace sycl;

int main() {
    default_selector device_selector;
    std::cout << "Device selector has been initialized.\n";

    try {
        queue q(device_selector);
    } catch (...) {
        std::cout << "There's an error! Maybe.\n";
    }

    std::cout << "Queue has been initialized.\n";

    return 0;
}

 

The output was exactly the same.

If someone has a hint or an idea, I would be pleased to read it.

0 Kudos
1 Solution
DitiD_Intel
Moderator
904 Views

Hi,

 

Thank you for posting in Intel Communities.

 

I've tried compiling both the sample codes that you've provided and I am able to get the expected results.

 

Please refer to the attached screenshots for more information.

 

Could you please let us know if you're using Intel oneAPI command prompt or System command prompt?

 

If you wish to execute the code on System command prompt, then please configure the oneAPI environment by following the steps mentioned below.

 

Go to File Explorer --> C:\Program Files (x86)\intel\oneAPI --> Copy Address --> Open System command prompt and go to this path --> Then enter the command "setvars.bat" to configure your oneAPI environment.

 

Also, could you please try compiling a sample code on oneAPI CLI and let us know if you're facing the same issue?

 

Please follow the steps mentioned in the link below to build and run a sample project.

 

https://www.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-base-win...

 

Please do let us know if you are still facing the same issue while compiling the sample code.

 

Thanks and Regards,

Ditipriya.

 

View solution in original post

3 Replies
DitiD_Intel
Moderator
905 Views

Hi,

 

Thank you for posting in Intel Communities.

 

I've tried compiling both the sample codes that you've provided and I am able to get the expected results.

 

Please refer to the attached screenshots for more information.

 

Could you please let us know if you're using Intel oneAPI command prompt or System command prompt?

 

If you wish to execute the code on System command prompt, then please configure the oneAPI environment by following the steps mentioned below.

 

Go to File Explorer --> C:\Program Files (x86)\intel\oneAPI --> Copy Address --> Open System command prompt and go to this path --> Then enter the command "setvars.bat" to configure your oneAPI environment.

 

Also, could you please try compiling a sample code on oneAPI CLI and let us know if you're facing the same issue?

 

Please follow the steps mentioned in the link below to build and run a sample project.

 

https://www.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-base-win...

 

Please do let us know if you are still facing the same issue while compiling the sample code.

 

Thanks and Regards,

Ditipriya.

 

frmar
Beginner
847 Views

Hello Ditipriya,

 

Thanks a lot for your answer. The .exe file was indeed working when I was using the Intel oneAPI command prompt. After using setvars.bat, everything is working perfectly, even in the Windows command prompt.

 

Have a nice day.

DitiD_Intel
Moderator
717 Views

Hi, 


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


Thanks and Regards,

Ditipriya.



Reply