- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
The following test returns an undefined reference for the target code
#include <algorithm>
void test()
{
#pragma offload target(mic)
{
double a=1.0;
double b=1.0;
double c=std::max(a,b);
}
}
int main()
{
test();
}
icpc -openmp -offload-option,mic,ld,'-zdefs' micstl.cxx
/tmp/icpcwXQiLo.o: In function `__offload_entry_micstl_cxx_6test_11b7a23007ddafd41960e6289788656dicpc326259940ELibIR':
micstl.cxx:(.text+0x72): undefined reference to `double const& std::max<double>(double const&, double const&)'
icpc --version
icpc (ICC) 14.0.4 20140805
Copyright (C) 1985-2014 Intel Corporation. All rights reserved.
Do I need to link to a specific library on the mic?
Thanks
Jamil
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
icpc should normally generate in-line code for std::max(), avoiding a library reference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Pardon the delay, you probably already determined the system header <algorithm> requires decoration/declaration for inclusion in the coprocessor (target) compilation as follows:
#pragma offload_attribute (push, target(mic)) #include <algorithm> #pragma offload_attribute (pop)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kevin
Thanks for the tip. I assume I can follow a similar approach for header only boost functionality.
Thanks
Jamil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not knowledgeable on Boost but I expect that's correct. Any headers containing function declarations used within the offload code will require this style of decoration/declaration. Let me know if you run into problems and I'll solicit help from our Developers.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page