- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sorry to disturb you. I'm a oneAPI beginner. I'm learning how to migrate C++ to oneAPI, but I'm running into some problems. When I encounter nested loops or multiple loops, I don't know how to migrate to oneAPI. So, I'm here to ask for some help. Attached is my code, I have migrated part of it, I don't know what to do when there are only multiple loops and nested loops. The TXT file contains part of the code,I just want to know how to migrate the code in the file. Thanks!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for posting in Intel Communities.
When you have multiple or nested loops, You can create kernels for each loop or you can use different for loops in a single kernel. Based on your use case you can use any of these methods.
Please refer to below link for more details:
https://link.springer.com/book/10.1007/978-1-4842-5574-2
We have tried with a sample code creating two kernels in a single for loop. Please find the attached file for the sample code.
Please try to implement your code based on the above methods. If you face any issues, please provide us with a complete code along with compiler version and OS details.
Thanks & Regards,
Noorjahan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We haven't heard back from you. Could you please provide an update on your issue?
Thanks & Regards,
Noorjahan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for only replying to you now! I just received the subscription information in my email yesterday. Maybe I didn't explain my question clearly. In my attachment, test is a program written in C++ code, DPC++ is written using oneAPI, and ADdata is the matlab file to be read. During my migration process, I mainly found the following problems. The data obtained after the migration of func_apod is different from that of C++; and it will stop running when running the main function; the last problem is that the main function does not know how to migrate to oneAPI, because Vector assignment is used during the loop. I hope you can help me solve the problem, thank you very much! In this process, Matlab and opencv need to be installed, because the lib package is needed to read Matlab files and display images.Due to file size limitations, I can only upload some CPP files to attachments, not the entire program! terribly sorry! Sorry to trouble you, thank you very much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for providing the details.
Could you please provide us with complete steps you have followed to link openCV with your sample code?
We tried it from our end but got lot of errors. Could you pleas help us to resolve these errors.
Please find the below screenshot for errors we got:
>>The data obtained after the migration of func_apod is different from that of C++
Could you please provide data obtained from C++ and migrated code?
Do you want to migrate func_apod code to oneAPI with correct output as of C++. Is this correct? Please correct us if it is wrong.
Also please let us know why hanning() function is commented in your migrated code but not in C++ in func_apod.cpp file.
If you have multiple loops, we can write multiple kernels for each loop. Please refer to above links that we have provided for more details.
Thanks & Regards,
Noorjahan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The data obtained by Fun_apod is the main function that has been commented out. This is also found in the C++ file. The main functions of both are the same, but the data displayed is different. Also, the hanning function exists in c++ but not in oneAPI because during the migration process I found that if I use the hanning function, oneAPI will not run successfully, so I implemented the hanning function inside the func_apod function. Sorry to trouble you! Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, I found a problem that if func_delaycalc is not migrated to oneAPI in the last main function, the program will run successfully; but if it is migrated to oneAPI, the program will stop. Is that why? Please see the screenshot below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since the installation locations of matlab and Opencv are different, the include directories and library directories will be different. Since the installed versions of opencv are inconsistent, the names of the lib packages will be inconsistent. For details, see opencv/build/x64/vc16/lib.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for providing the details.
>>the program will run successfully; but if it is migrated to oneAPI, the program will stop
Could you please provide the results you obtained when you run C++ code. Also please share the complete visual studio(C++ and DPC++) project with detailed steps you have followed.
We tried the code from our end, but we are getting errors from Matlab. we tried downloading it, but it requires a License. Could you please share the Matlab dependency files so that we can investigate the issue at our end.
Thanks & Regards,
Noorjahan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since the matlab file needs to be read, the package in Matlab needs to be imported into Visual Studio. Since the location and version of Matlab installation are different, it is for reference only.
1.C/C++>General->Additional include directories add:
MATLAB\extern\include
MATLAB\extern\include\win64
2. Linker->General->Additional Library Directory Add:
MATLAB\extern\lib\win64\microsoft
MATLAB\extern\lib\win32\microsoft
3. Linker->Input->Additional Dependent Library Add:
libmat.lib
libmx.lib
libmex.lib
libeng.lib
4. Top menu->Generate->Configuration Manager->Platform: X64 (Since the installed matlab is 64-bit, to call its functions, the project needs to be converted to X64)
5. Linker->Advanced->Target Computer:
MachineX64(/MACHINE:X64)
6. Modify the computer environment variable->path and add:
*\MATLAB\extern\lib\win64\microsoft;
*\MATLAB\bin\win64;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We are working on your issue. We will get back to you soon.
Thanks & Regards,
Noorjahan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We are having problem to duplicate your issue at our end. Could you please provide a self-contain reproducer?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Gentle reminder to respond.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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