<?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 data transfer issue on MIC in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/data-transfer-issue-on-MIC/m-p/1074360#M59373</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;

&lt;P&gt;I'm optimizing an application with Xeon Phi 5110P. And its initialization part looks as below:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

typedef struct {
	float *W[7];
	float *B[7];
	//float *dW[7];
	//float *dB[7];
} net;

int main(int argc, char *argv[])
{
	int a[8];
	a[:] = 1024;
	//a[:] = 64;
	int arr1[7], arr2[7];
	arr1[0:7] = a[0:7]*a[1:7];
	arr2[0:7] = a[1:7];

	net n1;

	for(int i=0; i&amp;lt;7; i++)
	{
		n1.W&lt;I&gt; = new float[arr1&lt;I&gt;];
		memset(n1.W&lt;I&gt;, 0, arr1&lt;I&gt;*sizeof(float));
		#pragma offload_transfer target(mic:0) in(n1.W&lt;I&gt;:extent(0:arr1&lt;I&gt;) alloc_if(1) free_if(0)) 
		n1.B&lt;I&gt; = new float[arr2&lt;I&gt;];
		memset(n1.B&lt;I&gt;, 0, arr2&lt;I&gt;*sizeof(float));
		#pragma offload_transfer target(mic:0) in(n1.B&lt;I&gt;:extent(0:arr2&lt;I&gt;) alloc_if(1) free_if(0))
	}
	//calculation on phi

	#pragma offload_transfer target(mic:0) out(n1.W[0:7]:extent(0:arr1[0:7]) alloc_if(0) free_if(1))
	#pragma offload_transfer target(mic:0) out(n1.B[0:7]:extent(0:arr2[0:7]) alloc_if(0) free_if(1))

	return 0;
}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;In the initialization step, I tried to allocate memory for the arrays of pointers on the host and transfer data to Phi. If I set the elements of array a with 64, the program runs correctly. But when I tried to set array a as 1024 as above, the program gives "offload error: allocation (base=0x10d6010, size=8388608) overlaps with existing allocation (base=0xcd6000, size=8388608)".&lt;/P&gt;

&lt;P&gt;I'm wondering whether this problem comes from memory size limits or other reasons.&lt;/P&gt;

&lt;P&gt;I'd appreciate if someone could help to explain this problem. thx&lt;/P&gt;</description>
    <pubDate>Tue, 16 Feb 2016 13:30:51 GMT</pubDate>
    <dc:creator>Geoffrey_Q</dc:creator>
    <dc:date>2016-02-16T13:30:51Z</dc:date>
    <item>
      <title>data transfer issue on MIC</title>
      <link>https://community.intel.com/t5/Software-Archive/data-transfer-issue-on-MIC/m-p/1074360#M59373</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;

&lt;P&gt;I'm optimizing an application with Xeon Phi 5110P. And its initialization part looks as below:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

typedef struct {
	float *W[7];
	float *B[7];
	//float *dW[7];
	//float *dB[7];
} net;

int main(int argc, char *argv[])
{
	int a[8];
	a[:] = 1024;
	//a[:] = 64;
	int arr1[7], arr2[7];
	arr1[0:7] = a[0:7]*a[1:7];
	arr2[0:7] = a[1:7];

	net n1;

	for(int i=0; i&amp;lt;7; i++)
	{
		n1.W&lt;I&gt; = new float[arr1&lt;I&gt;];
		memset(n1.W&lt;I&gt;, 0, arr1&lt;I&gt;*sizeof(float));
		#pragma offload_transfer target(mic:0) in(n1.W&lt;I&gt;:extent(0:arr1&lt;I&gt;) alloc_if(1) free_if(0)) 
		n1.B&lt;I&gt; = new float[arr2&lt;I&gt;];
		memset(n1.B&lt;I&gt;, 0, arr2&lt;I&gt;*sizeof(float));
		#pragma offload_transfer target(mic:0) in(n1.B&lt;I&gt;:extent(0:arr2&lt;I&gt;) alloc_if(1) free_if(0))
	}
	//calculation on phi

	#pragma offload_transfer target(mic:0) out(n1.W[0:7]:extent(0:arr1[0:7]) alloc_if(0) free_if(1))
	#pragma offload_transfer target(mic:0) out(n1.B[0:7]:extent(0:arr2[0:7]) alloc_if(0) free_if(1))

	return 0;
}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;In the initialization step, I tried to allocate memory for the arrays of pointers on the host and transfer data to Phi. If I set the elements of array a with 64, the program runs correctly. But when I tried to set array a as 1024 as above, the program gives "offload error: allocation (base=0x10d6010, size=8388608) overlaps with existing allocation (base=0xcd6000, size=8388608)".&lt;/P&gt;

&lt;P&gt;I'm wondering whether this problem comes from memory size limits or other reasons.&lt;/P&gt;

&lt;P&gt;I'd appreciate if someone could help to explain this problem. thx&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 13:30:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/data-transfer-issue-on-MIC/m-p/1074360#M59373</guid>
      <dc:creator>Geoffrey_Q</dc:creator>
      <dc:date>2016-02-16T13:30:51Z</dc:date>
    </item>
    <item>
      <title>The larger size and offload</title>
      <link>https://community.intel.com/t5/Software-Archive/data-transfer-issue-on-MIC/m-p/1074361#M59374</link>
      <description>&lt;P&gt;The larger size and offload allocation overlap error probably relate to exhausting available resources on the coprocessor. I can reproduce that scenario but at smaller sizes (even &amp;lt;64) I experience a segmentation fault. You did not mention seeing that though. I have to check with others on this.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 21:27:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/data-transfer-issue-on-MIC/m-p/1074361#M59374</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2016-02-16T21:27:11Z</dc:date>
    </item>
  </channel>
</rss>

