Quantcast
Channel: Intel® Software - Intel® Many Integrated Core Architecture (Intel MIC Architecture)
Viewing all articles
Browse latest Browse all 1789

How to debug a library used by a program in the offload section?

$
0
0

Hi!

I want to debug my library which my program uses in the offload section.

1. I tried to use library with debugging information. ​I use the following command line to build the library:

:: set environment
call D:\Intel\compilers_and_libraries\windows\bin\compilervars.bat intel64

:: compile
icl /Qmic -c -g -Wall -Werror -fpic mylib/*.cpp -lm
icl /Qmic -g -shared -o libmylib.so *.o

The size of the library tells me that the debugging information is included in it. When I'm try to debug a program (I use VS 2015 and Intell Parallel Studio 2017), the debugger does not go inside a library.

2. I tried to use the library source files for debugging, but I can't compile a program. 

Simple example:

main.cpp

#pragma offload_attribute(push, target(mic))
#include "nativelib.h"
#include <iostream>
#pragma offload_attribute(pop)

int main(int artc, char* argv[])
{
#pragma offload target(mic)
	{
		std::cout << someFunc(3, 5);
	}
    return 0;
};

nativelib.h

#ifndef nativelib_h__
#define nativelib_h__
int someFunc(int, int);
#endif 

nativelib.cpp

#include "nativelib.h"

int someFunc(int a, int b) {
	return a + 2 * b;
};

And it lead to link error: "undefined reference to `someFunc(int, int)' ". Of course I can only use header files, but this is not a very nice option.

Please tell me what I'm doing wrong in the above options or explain another version of the debugging the library used in the offload section.

 

Best regards, Alexander.


Viewing all articles
Browse latest Browse all 1789

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>