- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I need for a project a 128 bit integer data type. As far as I could find out the intel compiler supports __int128 and __uint128. This works fine as long as I do not use %. Here is a complete sample to reproduce the problem:
Environment:
- windows 11, all updates
- intel C++ 2024 latest version
int main()
{
__int128 l_i128Result = 12345678;
l_i128Result %= 13;
}
output:
1>R:\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.cpp(4,11): : warning : variable 'l_i128Result' set but not used [-Wunused-but-set-variable]
1> 4 | __int128 l_i128Result = 12345678;
1> | ^
1>1 warning generated.
1>ConsoleApplication1.obj : : error LNK2019: unresolved external symbol __modti3 referenced in function main
1>R:\ConsoleApplication1\x64\Debug\ConsoleApplication1.exe : : error LNK1120: 1 unresolved externals
1>Done building project "ConsoleApplication1.vcxproj" -- FAILED.
I could not find out which library I need to add to fix this function call.
Thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This issue is resolved with the clang builtins library. You can build the code with the library clang_rt.builtins-x86_64.lib, for example,
icx-cl.exe /Od ConsoleApplication1.cpp clang_rt.builtins-x86_64.lib
This library was not available in the 2024.0 release, but we have it in the 2024.1 release that become available for download now. Please download the 2024.1 release.
Thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I created a new console project for the intel compiler. Add the lines of code and click on compile. I use the intel project template.
Is it that you are asking or does your question point to something else?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Daniel_D it looks like you used Visual Studio instead of Intel oneAPI command prompt?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes- all in VS:
Create a new c++ console project. Add the few code lines. Switch to intel compiler and click on compile.
I already found a workaround and use boost:
#include "boost/multiprecision/cpp_int.hpp"
using namespace boost::multiprecision;
it comes with the types I need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Daniel:
boost::multiprecision is an arbitrary precision library that does NOT mimic a fixed-sized type like __int128. So any linear algebra you want to do will not have 'nice' memory layouts because the boost::multiprecision are not byte packed. A number system library that does is Universal (https://github.com/stillwater-sc/universal)
There are custom 128bit integers in the Universal Numbers library
In Universal you can ask for a specific integer parameterized in size, for example, integer<128>, for a 128-bit integer. Universal allows for parameterization at single bit precision, so if you want a 97 bit integer, you can get one via the declaration: integer<97>.
Universal is a headers-only lib, so all you would need to do is add the include file:
#include <universal/number/integer/integer.hpp>
and you would be off to the races.
Hope that helps.
Theo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Daniel_D I've noticed that this problem happens when you use Visual Studio, but if you Intel oneAPI command prompt then there's no problem. Thus I escalated this issue so our developers can take a look.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
i have compile this code fragment under Linux ( OpenSUSE Tumbleweed) with the oneAPI 2024 icx
no problems, no compiler error , nothing all works fine
regards
Franz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks to taking care!
Will switch to Linux later in the project. At the moment I need windows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tested the code and got the same error with Debug configuration. But with Release configuration, the code could be built successfully. So as a workaround, you can use Release configuration. In the meantime, I will report the issue to our development team to fix it.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue is related to the option "/Od". In the Debug configuration, the default optimization is "/Od", you can change it to "/O1" or "/O2" or "/O3", then the code can run successfully.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This issue is resolved with the clang builtins library. You can build the code with the library clang_rt.builtins-x86_64.lib, for example,
icx-cl.exe /Od ConsoleApplication1.cpp clang_rt.builtins-x86_64.lib
This library was not available in the 2024.0 release, but we have it in the 2024.1 release that become available for download now. Please download the 2024.1 release.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page