- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Hi there,
I am porting a large C++ application to MIC. I wrote a bit sample which allocate data using to offload pragma. When I try to run executable file, I have error "offload error: cannot load library to the device 0 (error code 5)".
Ссылка скопирована
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Can any one help me?
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
There is not enough information in that portion of the error alone to draw any concrete conclusion on what might be the cause. Can you share the sample code that produced that error?
Have you tried the MIC product samples that ship with the Composer XE 2013 Product or any of the examples/tutorials at http://software.intel.com/mic-developer to know if other simple offload programs execute successfully?
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
I added this line of code
float x[4];
#pragma offload target (mic:0) \
inout(x : ALLOC)
{
#ifdef __MIC__
printf("MIC");
#else
printf("CPU");
#endif
}
#pragma offload target (mic:0) \
nocopy(x : FREE)
{
}
And there was this error.
The MIC product samples that ship with the Composer XE 2013 Product execute successfully.
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Ok. So the sample code was added to your large C++ app which when built produces the error. Is that extent of the error or is there more that you are not sharing?
Typically there’s more that precedes the error you posted. Are there any errors regarding dlopen failed? Or undefined symbol?
When building your app, please try adding the following option to the final link step: -offload-option,mic,ld,"--no-undefined"
For any reported undefined references the associated entity likely requires decorating with __attribute__ ((target(mic))) to ensure an instance is created in the offload executable.
If you find none of this is applicable then more source code context is needed to show where this sample code appears to help understand what could lead to the error.
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
My project is daemon for Linux. I created a minimal application that replicates my mistake.
int main(int argc, char *argv[]) {
::chdir("/"); // allow file system unmountingprintf("Hello\n");
float x[4];
#pragma offload target (mic:0) \
inout(x : ALLOC)
{
#ifdef __MIC__
printf("MIC");
#else
printf("CPU");
#endif
}
#pragma offload target (mic:0) \
nocopy(x : FREE)
{
}
}
If I delete this line "::chdir("/"); // allow file system unmounting", then error disappear.
For me this line of code is't critical. So I resolved my problem.
Thanks so much for the help.
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Ah very interesting. Thank you for the efforts to find and post this. Yes, I can see now how this leads to only the error in your original post. When you change directory away from where the MIC image currently resides the load of this image fails.
There are two ways to deal with this.
1. Delay the chdir until after the first offload, or throw in a counterfeit offload_transfer before the chdir to cover all installed devices. Something like:
[cpp]int main(int argc, char *argv[]) {
int i;
for (i=0; i < _Offload_number_of_devices(); i++)
{
#pragma offload_transfer target (mic:i)
}
chdir("/");
<rest of code>[/cpp]
2. Use the OFFLOAD_INIT=on_start environment variable setting to initialize the target devices before entering main().
Thanks for the interesting issue!
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Thanks for ways to deal with this. I tried and all ok.
- Подписка на RSS-канал
- Отметить тему как новую
- Отметить тему как прочитанную
- Выполнить отслеживание данной Тема для текущего пользователя
- Закладка
- Подписаться
- Страница в формате печати