<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using MKL inside #pragma offload region in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Using-MKL-inside-pragma-offload-region/m-p/977834#M25401</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have problems with the exact same thing every time - linking with MKL when using &lt;STRONG&gt;compiler assisted offload&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;1. When I build offloaded code that &lt;STRONG&gt;does not make any MKL calls in the offloaded region&lt;/STRONG&gt;, I compile with &lt;STRONG&gt;-DMKL_ILP64 -mkl=sequential&lt;/STRONG&gt; and link with &lt;STRONG&gt;-lpthread -lm&lt;/STRONG&gt; as recommended by &lt;STRONG&gt;Ver 4&lt;/STRONG&gt; of the Link Line advisor located here - &lt;A href="http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor"&gt;http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor&lt;/A&gt;. I know that I'm running the sequential&lt;/P&gt;

&lt;P&gt;2. Now when I &lt;STRONG&gt;include MKL calls (to DFTI descriptor configuration) in the offloaded region&lt;/STRONG&gt;, I compile with &lt;STRONG&gt;-DMKL_ILP64 -mkl=sequential&lt;/STRONG&gt; and link with &lt;STRONG&gt;-lpthread -lm&lt;/STRONG&gt; i.e. the same compiler and linking options used when there was no MKL code in the offloaded regions. When i run my code, I get the following error -&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;offload error: process on the device 0 was terminated by signal 11 (SIGSEGV)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;3. Using Ver 4 of the Link Line advisor located here - &lt;A href="http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor"&gt;http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor&lt;/A&gt;, I select the following options -&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;Select Intel® product: Intel Composer XE 2013 SP1&lt;/LI&gt;
	&lt;LI&gt;Select OS: Linux&lt;/LI&gt;
	&lt;LI&gt;Select usage model of Intel® Xeon Phi™ Coprocessor: Compiler assisted Offload&lt;/LI&gt;
	&lt;LI&gt;Select compiler: Intel C/C++&lt;/LI&gt;
	&lt;LI&gt;Select architecture: Intel 64&lt;/LI&gt;
	&lt;LI&gt;Select dynamic or static linking: Dynamic&lt;/LI&gt;
	&lt;LI&gt;Select Interface Layer: ILP64 (64-bit Integer)&lt;/LI&gt;
	&lt;LI&gt;Select sequential or multi-threaded layer: Sequential&lt;/LI&gt;
	&lt;LI&gt;
		&lt;TABLE cellpadding="0" cellspacing="5" height="43" id="MainTable" width="173"&gt;
			&lt;TBODY&gt;
				&lt;TR&gt;
					&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
					&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
				&lt;/TR&gt;
				&lt;TR&gt;
					&lt;TD&gt;
						&lt;P&gt;&amp;nbsp;&lt;/P&gt;
					&lt;/TD&gt;
				&lt;/TR&gt;
			&lt;/TBODY&gt;
		&lt;/TABLE&gt;
	&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;My Link Line I compile with &lt;STRONG&gt;-DMKL_ILP64 -mkl=sequential&lt;/STRONG&gt; &lt;STRONG&gt;-offload-attribute-target=mic&lt;/STRONG&gt;, and link with &lt;STRONG&gt;-lpthread -lm&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;On the sink, dlopen() returned NULL. The result of dlerror() is "/tmp/coi_procs/1/5217/load_lib/icpcoutBZOw1k: undefined symbol: _ZN9KeplerObj11getRedShiftEv"&lt;BR /&gt;
	On the remote process, dlopen() failed. The error message sent back from the sink is /tmp/coi_procs/1/5217/load_lib/icpcoutBZOw1k: undefined symbol: _ZN9KeplerObj11getRedShiftEv&lt;BR /&gt;
	offload error: cannot load library to the device 0 (error code 20)&lt;/P&gt;

&lt;P&gt;From my understanding of what the flag &lt;STRONG&gt;-offload-attribute-target=mic&lt;/STRONG&gt; does, it marks &lt;STRONG&gt;&lt;EM&gt;every&lt;/EM&gt;&lt;/STRONG&gt; function and variable in the source file as offload-able!!! (&lt;A href="http://software.intel.com/en-us/node/459710"&gt;http://software.intel.com/en-us/node/459710&lt;/A&gt;). Correct me if I am wrong, but that is not the compiler option for me simply because I have C++ classes etc in my code (not meant to be offloaded) that are not supported for offload by&lt;STRONG&gt; #pragma offload {}&lt;/STRONG&gt;. Now based on Kevin Davis's article - '&lt;STRONG&gt;Effective Use of the intel Compiler's Offload Feature&lt;/STRONG&gt;' (&lt;A href="http://software.intel.com/en-us/articles/effective-use-of-the-intel-compilers-offload-features"&gt;http://software.intel.com/en-us/articles/effective-use-of-the-intel-compilers-offload-features&lt;/A&gt;), based on my reading of the section on '&lt;STRONG&gt;Using MKL and TBB on MIC&lt;/STRONG&gt;', my using the &lt;STRONG&gt;-DMKL_ILP64&lt;/STRONG&gt; flag should be enough to make the compiler build MIC versions of my MKL code. So what's the problem? Could it be my MPSS? My MKL version? My compiler version?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;I have tried many variants of the linking but while i can get simple code to compile and run, the code I need to get running simply does not work once I begin including MKL in the offload sections. I am willing to be as co-operative as is possible to help troubleshoot this. I would be happy to email someone my code (and a sample of the data that it needs to run on) so they can verify what's going on. Please help! &lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2014 17:04:05 GMT</pubDate>
    <dc:creator>Vishal1</dc:creator>
    <dc:date>2014-02-06T17:04:05Z</dc:date>
    <item>
      <title>Using MKL inside #pragma offload region</title>
      <link>https://community.intel.com/t5/Software-Archive/Using-MKL-inside-pragma-offload-region/m-p/977834#M25401</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have problems with the exact same thing every time - linking with MKL when using &lt;STRONG&gt;compiler assisted offload&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;1. When I build offloaded code that &lt;STRONG&gt;does not make any MKL calls in the offloaded region&lt;/STRONG&gt;, I compile with &lt;STRONG&gt;-DMKL_ILP64 -mkl=sequential&lt;/STRONG&gt; and link with &lt;STRONG&gt;-lpthread -lm&lt;/STRONG&gt; as recommended by &lt;STRONG&gt;Ver 4&lt;/STRONG&gt; of the Link Line advisor located here - &lt;A href="http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor"&gt;http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor&lt;/A&gt;. I know that I'm running the sequential&lt;/P&gt;

&lt;P&gt;2. Now when I &lt;STRONG&gt;include MKL calls (to DFTI descriptor configuration) in the offloaded region&lt;/STRONG&gt;, I compile with &lt;STRONG&gt;-DMKL_ILP64 -mkl=sequential&lt;/STRONG&gt; and link with &lt;STRONG&gt;-lpthread -lm&lt;/STRONG&gt; i.e. the same compiler and linking options used when there was no MKL code in the offloaded regions. When i run my code, I get the following error -&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;offload error: process on the device 0 was terminated by signal 11 (SIGSEGV)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;3. Using Ver 4 of the Link Line advisor located here - &lt;A href="http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor"&gt;http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor&lt;/A&gt;, I select the following options -&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;Select Intel® product: Intel Composer XE 2013 SP1&lt;/LI&gt;
	&lt;LI&gt;Select OS: Linux&lt;/LI&gt;
	&lt;LI&gt;Select usage model of Intel® Xeon Phi™ Coprocessor: Compiler assisted Offload&lt;/LI&gt;
	&lt;LI&gt;Select compiler: Intel C/C++&lt;/LI&gt;
	&lt;LI&gt;Select architecture: Intel 64&lt;/LI&gt;
	&lt;LI&gt;Select dynamic or static linking: Dynamic&lt;/LI&gt;
	&lt;LI&gt;Select Interface Layer: ILP64 (64-bit Integer)&lt;/LI&gt;
	&lt;LI&gt;Select sequential or multi-threaded layer: Sequential&lt;/LI&gt;
	&lt;LI&gt;
		&lt;TABLE cellpadding="0" cellspacing="5" height="43" id="MainTable" width="173"&gt;
			&lt;TBODY&gt;
				&lt;TR&gt;
					&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
					&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
				&lt;/TR&gt;
				&lt;TR&gt;
					&lt;TD&gt;
						&lt;P&gt;&amp;nbsp;&lt;/P&gt;
					&lt;/TD&gt;
				&lt;/TR&gt;
			&lt;/TBODY&gt;
		&lt;/TABLE&gt;
	&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;My Link Line I compile with &lt;STRONG&gt;-DMKL_ILP64 -mkl=sequential&lt;/STRONG&gt; &lt;STRONG&gt;-offload-attribute-target=mic&lt;/STRONG&gt;, and link with &lt;STRONG&gt;-lpthread -lm&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;On the sink, dlopen() returned NULL. The result of dlerror() is "/tmp/coi_procs/1/5217/load_lib/icpcoutBZOw1k: undefined symbol: _ZN9KeplerObj11getRedShiftEv"&lt;BR /&gt;
	On the remote process, dlopen() failed. The error message sent back from the sink is /tmp/coi_procs/1/5217/load_lib/icpcoutBZOw1k: undefined symbol: _ZN9KeplerObj11getRedShiftEv&lt;BR /&gt;
	offload error: cannot load library to the device 0 (error code 20)&lt;/P&gt;

&lt;P&gt;From my understanding of what the flag &lt;STRONG&gt;-offload-attribute-target=mic&lt;/STRONG&gt; does, it marks &lt;STRONG&gt;&lt;EM&gt;every&lt;/EM&gt;&lt;/STRONG&gt; function and variable in the source file as offload-able!!! (&lt;A href="http://software.intel.com/en-us/node/459710"&gt;http://software.intel.com/en-us/node/459710&lt;/A&gt;). Correct me if I am wrong, but that is not the compiler option for me simply because I have C++ classes etc in my code (not meant to be offloaded) that are not supported for offload by&lt;STRONG&gt; #pragma offload {}&lt;/STRONG&gt;. Now based on Kevin Davis's article - '&lt;STRONG&gt;Effective Use of the intel Compiler's Offload Feature&lt;/STRONG&gt;' (&lt;A href="http://software.intel.com/en-us/articles/effective-use-of-the-intel-compilers-offload-features"&gt;http://software.intel.com/en-us/articles/effective-use-of-the-intel-compilers-offload-features&lt;/A&gt;), based on my reading of the section on '&lt;STRONG&gt;Using MKL and TBB on MIC&lt;/STRONG&gt;', my using the &lt;STRONG&gt;-DMKL_ILP64&lt;/STRONG&gt; flag should be enough to make the compiler build MIC versions of my MKL code. So what's the problem? Could it be my MPSS? My MKL version? My compiler version?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;I have tried many variants of the linking but while i can get simple code to compile and run, the code I need to get running simply does not work once I begin including MKL in the offload sections. I am willing to be as co-operative as is possible to help troubleshoot this. I would be happy to email someone my code (and a sample of the data that it needs to run on) so they can verify what's going on. Please help! &lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 17:04:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Using-MKL-inside-pragma-offload-region/m-p/977834#M25401</guid>
      <dc:creator>Vishal1</dc:creator>
      <dc:date>2014-02-06T17:04:05Z</dc:date>
    </item>
    <item>
      <title>Hi Vishal,</title>
      <link>https://community.intel.com/t5/Software-Archive/Using-MKL-inside-pragma-offload-region/m-p/977835#M25402</link>
      <description>&lt;P&gt;Hi Vishal,&lt;/P&gt;

&lt;P&gt;Please send your code (and data) so that we can reproduce your problem. I will ask&amp;nbsp;an MKL expert to help you. Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2014 23:54:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Using-MKL-inside-pragma-offload-region/m-p/977835#M25402</guid>
      <dc:creator>Loc_N_Intel</dc:creator>
      <dc:date>2014-02-07T23:54:08Z</dc:date>
    </item>
  </channel>
</rss>

