- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I created the DPC++ sample console vector add application. Creating/compiling and executing works well on my system:
Windows 11 - all updates
VS 2022 - latest release (17.2.5)
DPC++ from oneAPI_2022.1.0.256
This is the project template I use. I have not changed anything else than the two lines below:
Now I want to use a boost thread in this application. For that I add these 2 lines to the top of the DPCPPConsoleApplication1.cpp file like this:
//==============================================================
// Copyright © Intel Corporation
//
// SPDX-License-Identifier: MIT
// =============================================================
#define _WIN32_WINNT _WIN32_WINNT_WIN8
#include <boost/thread.hpp>
#include <CL/sycl.hpp>
#include <vector>
#include <iostream>
#if FPGA || FPGA_EMULATOR
#include <ext/intel/fpga_extensions.hpp>
#endif
No other changes made. Now I cannot compile this application anymore because I get an error and several warning:
1>T:\\Development\\3rdParty\\boost_1_79_0\\include\boost/config/requires_threads.hpp(82,4): : error : "Compiler threading support is not turned on. Please set the correct command line options for threading: either /MT /MTd /MD or /MDd"
1># error "Compiler threading support is not turned on. Please set the correct command line options for threading: either /MT /MTd /MD or /MDd"
The /MDd flag is already set from thew sample app. The complete commandline looks like this:
/Od //I"T:\Development\3rdParty\boost_1_79_0\include" /Zi /D "_DEBUG" /WX- /MDd /std:c++17 /EHsc /W3 /nologo /Fo"x64\Debug\"
and:
/Zc:__cplusplus
as additional option
Any idea how I can use boost together with DPC++?
Thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Daniel,
Thanks for reaching out to us.
Since you want to use boost thread along with dpcpp sycl code we would like to understand the use case behind it so that it would help us to address your issue better.
Regards,
Vidya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vidya,
thanks for your fast reply. In this case I have to call a function in a 3rd party library. This function can take up to some minutes to return. So I call it in a thread. If the user want now to exit my application I need to cancel the execution of this thread. std::thread does not offer this option. So I have to use boost::thread. I can cancel the execution and I can terminate my application. This is one sample why I use boost - but there are much more.
Thanks,
Daniel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Daniel,
Apologies for the delay and thanks for your patience.
The issue raised by you is reproducible from our end as well.
We are working on it. we will get back to you soon.
Regards,
Vidya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Daniel,
Please refer to https://www.intel.com/content/www/us/en/developer/articles/technical/building-boost-with-oneapi.html and let me know if you have further questions.
Regards,
Subarna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Subarna,
thanks for your information. As you might have overread, the problem is NOT to build boost with DPC++. The problem I have is that I cannot USE boost in a DPC++ console application. If you follow this guide, you may see the problem I have:
Create a new project:
and make this modification to add boost support:
Now I want to use a boost thread in this application. For that I add these 2 lines to the top of the DPCPPConsoleApplication1.cpp file like this:
//==============================================================
// Copyright © Intel Corporation
//
// SPDX-License-Identifier: MIT
// =============================================================
#define _WIN32_WINNT _WIN32_WINNT_WIN8
#include <boost/thread.hpp>
#include <CL/sycl.hpp>
#include <vector>
#include <iostream>
#if FPGA || FPGA_EMULATOR
#include <ext/intel/fpga_extensions.hpp>
#endif
You will see that it is now no longer possible to compile the project. So, using boost in a DPC++ application is not possible and the problem I have. Not building boost with DPC.
Daniel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In dpcpp compiler, the macro "BOOST_HAS_THREADS" isn't recognized. So it generates that error.
There is a workaround, which is defining this macro by yourself before including the boost/thread.hpp file, as follows,
#define BOOST_HAS_THREADS
#include <boost/thread.hpp>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue has been resolved and 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.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page