<?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 Creating Windows DLLs containing MIC offload code on VS2012 in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Creating-Windows-DLLs-containing-MIC-offload-code-on-VS2012/m-p/1135077#M78000</link>
    <description>&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;Hello Everyone,&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;I am trying to build a Windows DLL that contains code that does offload to MIC. I managed to compile the DLL, but it failed (and I see that in my output directory a file called &amp;lt;dll-name&amp;gt;MIC.out has not been created).&amp;nbsp;&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp;Tools: &amp;nbsp;windows sever 2012R2 , visual studio 2012, Intel Parallel Studio 2015 .&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; I create two projects: one is a DLL project inculding a function ,another is a main function which call the DLL.&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt; DLL project: (demodll)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Export.h :&lt;/STRONG&gt;&lt;/EM&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;extern "C" __declspec(dllexport) double decode_process(int n);&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&lt;STRONG&gt;&amp;nbsp;Export.cpp:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;__declspec(dllexport) double decode_process(int n)&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;double sum = 0.0;&lt;BR /&gt;
	#pragma offload target(mic) inout(sum)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i = 0; i &amp;lt; n;i++)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int j = 0; j &amp;lt; n; j++)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;sum += i*j;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;return sum;&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Main function (Demo):&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;#include&amp;lt;iostream&amp;gt;&lt;BR /&gt;
	#include "../demodll/Export.h"&lt;/P&gt;

&lt;P&gt;#pragma comment(lib,"demodll.lib")&lt;BR /&gt;
	using namespace std;&lt;BR /&gt;
	int main()&lt;BR /&gt;
	{&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cout&amp;lt;&amp;lt;decode_process(1000);&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;BR /&gt;
	}&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp;When I&amp;nbsp;Compile the &lt;STRONG&gt;&lt;EM&gt;demodll , &amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;errors occured.&lt;B&gt;:&lt;/B&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;5 &amp;nbsp;error #10340:problem encountered when performing target compliation&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp;3 error #1292: *MIC* unknown attribute "dllexport" &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Export.cpp&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; It means the Intel C++ compiler cannot &amp;nbsp;recognize the&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;"dllexport"&lt;/STRONG&gt; &amp;nbsp;on MIC , but if I comment out the words :&amp;nbsp;&lt;/EM&gt;#pragma offload target(mic) inout(sum), it succded&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;and the whole solution works correctly, which means the Intel compiler can recognize the&lt;STRONG&gt; &lt;/STRONG&gt;&lt;EM&gt;&lt;STRONG&gt;"dllexport" &amp;nbsp;&lt;/STRONG&gt;on CPU&lt;/EM&gt;.&amp;nbsp;&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN style="line-height: 1.5;"&gt;Can anyone please advice me on what I can do that the Intel &amp;nbsp;compiler recognize the &lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;"dllexport" &lt;/STRONG&gt;&amp;nbsp;on MIC&amp;nbsp;&lt;/EM&gt;&lt;SPAN style="line-height: 1.5;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Oct 2017 12:32:10 GMT</pubDate>
    <dc:creator>Linm_F_</dc:creator>
    <dc:date>2017-10-03T12:32:10Z</dc:date>
    <item>
      <title>Creating Windows DLLs containing MIC offload code on VS2012</title>
      <link>https://community.intel.com/t5/Software-Archive/Creating-Windows-DLLs-containing-MIC-offload-code-on-VS2012/m-p/1135077#M78000</link>
      <description>&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;Hello Everyone,&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;I am trying to build a Windows DLL that contains code that does offload to MIC. I managed to compile the DLL, but it failed (and I see that in my output directory a file called &amp;lt;dll-name&amp;gt;MIC.out has not been created).&amp;nbsp;&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp;Tools: &amp;nbsp;windows sever 2012R2 , visual studio 2012, Intel Parallel Studio 2015 .&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; I create two projects: one is a DLL project inculding a function ,another is a main function which call the DLL.&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt; DLL project: (demodll)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Export.h :&lt;/STRONG&gt;&lt;/EM&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;extern "C" __declspec(dllexport) double decode_process(int n);&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&lt;STRONG&gt;&amp;nbsp;Export.cpp:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;__declspec(dllexport) double decode_process(int n)&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;double sum = 0.0;&lt;BR /&gt;
	#pragma offload target(mic) inout(sum)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i = 0; i &amp;lt; n;i++)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int j = 0; j &amp;lt; n; j++)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;sum += i*j;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;return sum;&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Main function (Demo):&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;#include&amp;lt;iostream&amp;gt;&lt;BR /&gt;
	#include "../demodll/Export.h"&lt;/P&gt;

&lt;P&gt;#pragma comment(lib,"demodll.lib")&lt;BR /&gt;
	using namespace std;&lt;BR /&gt;
	int main()&lt;BR /&gt;
	{&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cout&amp;lt;&amp;lt;decode_process(1000);&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;BR /&gt;
	}&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp;When I&amp;nbsp;Compile the &lt;STRONG&gt;&lt;EM&gt;demodll , &amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;errors occured.&lt;B&gt;:&lt;/B&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;5 &amp;nbsp;error #10340:problem encountered when performing target compliation&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp;3 error #1292: *MIC* unknown attribute "dllexport" &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Export.cpp&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp; It means the Intel C++ compiler cannot &amp;nbsp;recognize the&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;"dllexport"&lt;/STRONG&gt; &amp;nbsp;on MIC , but if I comment out the words :&amp;nbsp;&lt;/EM&gt;#pragma offload target(mic) inout(sum), it succded&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;and the whole solution works correctly, which means the Intel compiler can recognize the&lt;STRONG&gt; &lt;/STRONG&gt;&lt;EM&gt;&lt;STRONG&gt;"dllexport" &amp;nbsp;&lt;/STRONG&gt;on CPU&lt;/EM&gt;.&amp;nbsp;&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN style="line-height: 1.5;"&gt;Can anyone please advice me on what I can do that the Intel &amp;nbsp;compiler recognize the &lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;"dllexport" &lt;/STRONG&gt;&amp;nbsp;on MIC&amp;nbsp;&lt;/EM&gt;&lt;SPAN style="line-height: 1.5;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P style="word-wrap: break-word; font-size: 12px;"&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 12:32:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Creating-Windows-DLLs-containing-MIC-offload-code-on-VS2012/m-p/1135077#M78000</guid>
      <dc:creator>Linm_F_</dc:creator>
      <dc:date>2017-10-03T12:32:10Z</dc:date>
    </item>
    <item>
      <title>I am basically having the</title>
      <link>https://community.intel.com/t5/Software-Archive/Creating-Windows-DLLs-containing-MIC-offload-code-on-VS2012/m-p/1135078#M78001</link>
      <description>&lt;P&gt;I am basically having the same kind of problems, trying to build a DLL with offload code in VS2013.&lt;/P&gt;

&lt;P&gt;It looks to me that the problem is that since MIC is linux-based, it does not recognize Windows specific stuff (dllexport, or in my case, it does not open source file "windows.h")&lt;/P&gt;

&lt;P&gt;All I have found this notice&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/articles/xeon-phi-coprocessor-fat-binary-for-windows-static-and-dynamic-link-library-with-offload" target="_blank"&gt;https://software.intel.com/en-us/articles/xeon-phi-coprocessor-fat-binary-for-windows-static-and-dynamic-link-library-with-offload&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Saying that using older versions of Intel compiler , you need to handle .DLL and .so libraries separately.&lt;/P&gt;

&lt;P&gt;Is there any tutorial or walkthrough to create a DLL using offload code? Or how to use .dll and .so libraries separately?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 11:05:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Creating-Windows-DLLs-containing-MIC-offload-code-on-VS2012/m-p/1135078#M78001</guid>
      <dc:creator>Plaza_del_Olmo__Juli</dc:creator>
      <dc:date>2017-11-07T11:05:37Z</dc:date>
    </item>
  </channel>
</rss>

