Intel® oneAPI Data Analytics Library
Learn from community members on how to build compute-intensive applications that run efficiently on Intel® architecture.
224 Discussions

dbscan_brute_force_batch.cpp exception at result_compute.get_responses()

sgaumer
Beginner
3,987 Views

I downloaded oneAPI Data Analytics Library and I'm trying to run the dbscan example. It's compiling with Intel C++ Compiler 2022 in Visual Studio 2019.

 

oneAPI\dal\2021.7.1\examples\oneapi\cpp\source\dbscan\dbscan_brute_force_batch.cpp

 

The .csv file is being found and read, and result_compute.get_cluster_count() is returning 9 clusters.

 

result_compute.get_responses() is giving an exception.

 

Unhandled exception at 0x00007FF9CF7ECD29 in dbscan_brute_force_batch.exe: Microsoft C++ exception: oneapi::dal::v1::invalid_argument at memory location 0x00000028381BCB80.

 

Please help with resolving this.

 

 

0 Kudos
16 Replies
VaradJ_Intel
Moderator
3,968 Views

Hi,


Good day to you.


Thanks for posting in Intel Communities.


Please can you share the exact steps and commands you followed so that we can reproduce the error from our side?


Thank You!


0 Kudos
sgaumer
Beginner
3,963 Views

Here is the code. Exception at line 30.
-----------------------------------------------


#include "oneapi/dal/algo/dbscan.hpp"
#include "oneapi/dal/io/csv.hpp"
//#include "C:\Program Files (x86)\Intel\oneAPI\dal\2021.7.1\examples\oneapi\cpp\source\example_util\utils.hpp"
#include "C:\Program Files (x86)\Intel\oneAPI\dal\2021.7.1\examples\oneapi\cpp\source\example_util\input_helpers.hpp"
#include "C:\Program Files (x86)\Intel\oneAPI\dal\2021.7.1\examples\oneapi\cpp\source\example_util\output_helpers.hpp"
#include <iostream>

namespace dal = oneapi::dal;

int main(int argc, char const *argv[]) {

// example DBSCAN from Intel oneDAL:
// https://www.intel.com/content/www/us/en/develop/documentation/onedal-developer-guide-and-reference/top/oneapi-interfaces/oneapi-examples/oneapi-c-examples/dbscan-brute-force-batch-cpp.html#dbscan-brute-force-batch-cpp_cpp-dbscan-brute-force-batch-cpp

const auto data_file_name = get_data_path("dbscan_dense.csv");

const auto x_data = dal::read<dal::table>(dal::csv::data_source{ data_file_name });

double epsilon = 0.04;
std::int64_t min_observations = 45;
auto dbscan_desc = dal::dbscan::descriptor<>(epsilon, min_observations);
dbscan_desc.set_result_options(dal::dbscan::result_options::responses);


// const auto x_data = dal::read<dal::table>(dal::csv::data_source{ data_file_name });

const auto result_compute = dal::compute(dbscan_desc, x_data);

std::cout << "Cluster count: " << result_compute.get_cluster_count() << std::endl;
std::cout << "Responses:\n" << result_compute.get_responses() << std::endl;

return 0;
}

0 Kudos
AlekhyaV_Intel
Moderator
3,918 Views

Hi,


Good day to you.


Please follow the below steps to run the executable:


1. In Visual Studio 2019 change the Solution Configuration from 'Debug.dynamic.sequential' to 'Release.dynamic.sequential' and build the solution


2. Open the command prompt using 'Run as administrator' option


3. Once the command prompt is open go to 'oneAPI\dal\2021.7.1\env' directory and run vars.bat file in command prompt itself to source the environment variables


4. Now go to 'oneAPI\dal\2021.7.1\examples\oneapi\data' and copy 'dbscan_dense.csv' and paste it to the folder where executable file(dbscan_brute_force_batch.exe) is present.


5. Now run the executable.


Thank You,

Alekhya


0 Kudos
sgaumer
Beginner
3,909 Views

Thank you Alekhya. Unfortunately, it didn't work.
Even after sourcing vars.bat from a command prompt with Administrator privileges, the following DLLs are not still found.
     onedal_core.1.dll
     onedal_dpc.1.dll
     onedal_thread.1.dll
     sycl.dll

 

After manually copying those DLLs into the same directly as dbscan_brute_force_batch.exe, the executable will run. However, it still crashes at the same point. It doesn't get past result_compute.get_responses().

 

I could find no references to 'Debug.dynamic.sequential' or 'Release.dynamic.sequential'. I did change the configuration to "Release". Could you provide a reference to these configuration options? I'm using Visual Studio 2019.

 

Does it matter what compiler I use? I've tried Intel DPC++ compiler and Visual C++ compiler. The software crashes at the same point in both cases.

0 Kudos
AlekhyaV_Intel
Moderator
3,894 Views

Hi,


We tried with the latest version of the base toolkit and it worked fine for us. Could you please try re-installing the oneapi base toolkit(latest version) and check if the issue still persists?


Regards,

Alekhya


0 Kudos
sgaumer
Beginner
3,839 Views

Hi Alekhya,

 

After installing oneAPI Base Toolkit 2022.3.1.19798, the problem still persists. The base toolkit contains the same version of Data Analytics Library as in the standalone installer (2021.7.1). We've tried this on three different computers with the same results. It crashes at result_compute.get_responses().

What version of base toolkit do you have? What compiler did you use? What do you mean by 'Release.dynamic.sequential'? Is the example code correct (https://oneapi-src.github.io/oneDAL/examples/dpc/dbscan_brute_force_batch.html#dpc-dbscan-brute-force-batch-cpp)? Does it make sense to try an older version of Data Analytics Library? Perhaps this bug was introduced recently (?).


 Please help in fixing this bug that prevents getting results from DBSCAN in Data Analytics Library. Thank you.

0 Kudos
VaradJ_Intel
Moderator
3,791 Views

Hi,

 

Good day to you.

 

Here are the answers for the questions you asked

 

1. What version of base toolkit do you have?

We have the latest version of base toolkit that is version 2022.3.1

 

2. What compiler did you use?

We are using Intel DPC++/C++ complier

 

3. What do you mean by 'Release.dynamic.sequential'?

In Visual Studio 2019 there is a tab for 'Solution Configurations' which you have to select 'Release.dynamic.sequential'.

 

You can refer the below screenshots for it:

VaradJ_Intel_0-1669275698801.png

 

VaradJ_Intel_1-1669275735294.png

 

4. Is the example code correct (https://oneapi-src.github.io/oneDAL/examples/dpc/dbscan_brute_force_batch.html#dpc-dbscan-brute-forc...)?

Yes the example code is correct.

 

5. Does it make sense to try an older version of Data Analytics Library? Perhaps this bug was introduced recently ?

It is not a bug, we were able to run it.

 

You can change the solution configuration in Visual Studio 2019 to 'Release.dynamic.sequential'and try running it as per the steps provided above.

 

Please do let us know if you still face any issues.

 

If this resolves your issue, make sure to accept this as a solution. This would help others with similar issues. 

 

Thank You!

 

0 Kudos
sgaumer
Beginner
3,765 Views

Thank you. I see. 'Release.dynamic.sequential', etc. are custom build configurations defined in the examples solution (oneDALExamples.sln). Those obviously aren't available if I create a new solution, which is what I had done.

Are these build configurations defined/documented somewhere? Would it be possible to set up a working build configuration with, for example, CMake?

After copying and using the examples solution, the code is running successfully.

0 Kudos
VaradJ_Intel
Moderator
3,702 Views

Hi,


Good day to you


Glad to know that your issue is resolved.


We have raised your concerns to the respective team.


We will get back to you soon with an update


Thank You!


0 Kudos
Aditya18
Moderator
3,680 Views

Hi,

What custom builds are you talking about, could you share that? Debug and Release modes have nothing to do with oneAPI. Debug mode tells the compiler to add debug information that may need extra functions/libraries. And it might be causing that issue. It's not recommended if you want to run the samples.

Thanks


0 Kudos
sgaumer
Beginner
3,674 Views

 'Release.dynamic.sequential', etc. are custom build configurations that you created in your examples solution. Those configurations don't exist outside your examples solution. Are they documented? How did you define them? It's clear that there are specific configuration settings required to get your library to run successfully as a generic "Release" configuration in a new solution doesn't work. What are those settings?

0 Kudos
Aditya18
Moderator
3,666 Views

Hi,

all the configs required for the sample are already there in the sample solution. But there might be some mismapping in configs. And it is corrected automatically if you open the project solution. I saw this kind of error/warning on top when I opened sln.

Current solution contains incorrect configs mappings. It may cause projects to not work correctly. Open the Configuration Manager to fix them.

After correcting configs mappings, the issue is not there. With normal build, it runs fine.

SW installations and versions: Visual Studio 2022 oneDAL 2021.7.1

For a custom solution, you need to follow the sample and its requirements and check the oneAPI directories linked with the particular sample.

I don't think you should be worried about the config mode.


0 Kudos
Aditya18
Moderator
3,653 Views

Hi,

Could you check building the sample solution with Visual Studio 2022? I could see all these configs mismappings fixed automatically in Visual Studio 2022.

Meanwhile, I am checking internally for Visual Studio 2019.


0 Kudos
Aditya18
Moderator
3,640 Views

Hi Scott,

I checked Visual Studio 2019. The issue is that:

Error MSB8020 The build tools for v143 (Platform Toolset = 'v143') cannot be found. To build using the v143 build tools, please install v143 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". dbscan_brute_force_batch


If you can retarget the solution that is good. But in some cases, we don't get an option to "Retarget solution"

And also I see that there is no option for installing build tools for v143 from Visual Studio Installer. In my case, it is v142.


So seems like this issue is from Visual Studio 2019 compatibility. Nothing to do with oneAPI sample. As it's running fine in Visual Studio 2022. We'd test more and update the system requirements for oneDAL and also if there is any official work around to use oneDAL with Visual Studio 2019.

I want you to check Visual Studio 2022. I hope you won't see any build issue. And will be able to make custom solutions.


Thanks



0 Kudos
Aditya18
Moderator
3,589 Views

Hi,

There are two points to mention here.

Currently, the issue with Visual Studio 2019 is the configs mismappings for oneDAL by default. This can be fixed by updating the build toolset provided in the sample sln. oneDAL sln will be updated with the newer build tools. But in general, users are expected to retarget example to their particular versions that they have installed.

In VS 2022, this retarget is happening automatically. But in VS 2019, not.


Another point as you mentioned, Would it be possible to set up a working build configuration with, for example, CMake?

Currently, there is no such option. However, we have plans to stop using solutions and move to a more reasonable way such as CMake. Although there is no timeline fixed for this.

oneDAL 2023.0 is also releasing soon.

Closing the case for now as we have not heard anything from you. Please accept it as the solution if you find it useful.


0 Kudos
Nikolay_P_Intel1
Employee
3,112 Views

Just as an update - we've update our CMake examples and they would be available in next release.  Alternatively you can try them from examples directory - this might take some extra work for integrating them though. 

https://github.com/oneapi-src/oneDAL/tree/master/examples

Also i would like to note that sln and make examples would be deprecated in favor of CMake examples. 

0 Kudos
Reply